summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/include/SourceMgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/include/SourceMgr.h')
-rw-r--r--llvm/tools/llvm-mca/include/SourceMgr.h14
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; }
OpenPOWER on IntegriCloud