diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-10-22 15:36:15 +0000 |
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-10-22 15:36:15 +0000 |
| commit | 01b9fd6868104bc05a48c819d7516078d325b929 (patch) | |
| tree | 7b8467b5ca5b07b3b039d7d5408616233efb1c35 /llvm/tools/llvm-mca/include | |
| parent | 6f5cd7c67fd104942738925b235ed2ca87e6d5d6 (diff) | |
| download | bcm5719-llvm-01b9fd6868104bc05a48c819d7516078d325b929.tar.gz bcm5719-llvm-01b9fd6868104bc05a48c819d7516078d325b929.zip | |
[llvm-mca] Use llvm::ArrayRef in class SourceMgr. NFCI
Class SourceMgr now uses type ArrayRef<MCInst> to reference the
sequence of code from a "CodeRegion".
llvm-svn: 344911
Diffstat (limited to 'llvm/tools/llvm-mca/include')
| -rw-r--r-- | llvm/tools/llvm-mca/include/SourceMgr.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/tools/llvm-mca/include/SourceMgr.h b/llvm/tools/llvm-mca/include/SourceMgr.h index 573ca7a9a00..89412836360 100644 --- a/llvm/tools/llvm-mca/include/SourceMgr.h +++ b/llvm/tools/llvm-mca/include/SourceMgr.h @@ -16,29 +16,29 @@ #ifndef LLVM_TOOLS_LLVM_MCA_SOURCEMGR_H #define LLVM_TOOLS_LLVM_MCA_SOURCEMGR_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/MC/MCInst.h" #include <vector> namespace mca { -typedef std::pair<unsigned, const llvm::MCInst *> SourceRef; +typedef std::pair<unsigned, const llvm::MCInst &> SourceRef; class SourceMgr { - using InstVec = std::vector<std::unique_ptr<const llvm::MCInst>>; - const InstVec &Sequence; + llvm::ArrayRef<llvm::MCInst> Sequence; unsigned Current; unsigned Iterations; static const unsigned DefaultIterations = 100; public: - SourceMgr(const InstVec &MCInstSequence, unsigned NumIterations) + SourceMgr(llvm::ArrayRef<llvm::MCInst> MCInstSequence, unsigned NumIterations) : Sequence(MCInstSequence), Current(0), Iterations(NumIterations ? NumIterations : DefaultIterations) {} unsigned getCurrentIteration() const { return Current / Sequence.size(); } unsigned getNumIterations() const { return Iterations; } unsigned size() const { return Sequence.size(); } - const InstVec &getSequence() const { return Sequence; } + llvm::ArrayRef<llvm::MCInst> getSequence() const { return Sequence; } bool hasNext() const { return Current < (Iterations * size()); } void updateNext() { Current++; } @@ -46,7 +46,7 @@ public: const SourceRef peekNext() const { assert(hasNext() && "Already at end of sequence!"); unsigned Index = getCurrentInstructionIndex(); - return SourceRef(Current, Sequence[Index].get()); + return SourceRef(Current, Sequence[Index]); } unsigned getCurrentInstructionIndex() const { @@ -54,7 +54,7 @@ public: } const llvm::MCInst &getMCInstFromIndex(unsigned Index) const { - return *Sequence[Index % size()]; + return Sequence[Index % size()]; } bool isEmpty() const { return size() == 0; } |

