summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Views/TimelineView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-mca/Views/TimelineView.cpp')
-rw-r--r--llvm/tools/llvm-mca/Views/TimelineView.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/tools/llvm-mca/Views/TimelineView.cpp b/llvm/tools/llvm-mca/Views/TimelineView.cpp
index d802d42352d..de347b54bd9 100644
--- a/llvm/tools/llvm-mca/Views/TimelineView.cpp
+++ b/llvm/tools/llvm-mca/Views/TimelineView.cpp
@@ -19,15 +19,14 @@ using namespace llvm;
namespace mca {
TimelineView::TimelineView(const MCSubtargetInfo &sti, MCInstPrinter &Printer,
- const SourceMgr &S, unsigned MaxIterations,
+ llvm::ArrayRef<llvm::MCInst> S, unsigned Iterations,
unsigned Cycles)
- : STI(sti), MCIP(Printer), AsmSequence(S), CurrentCycle(0),
+ : STI(sti), MCIP(Printer), Source(S), CurrentCycle(0),
MaxCycle(Cycles == 0 ? 80 : Cycles), LastCycle(0), WaitTime(S.size()),
UsedBuffer(S.size()) {
- unsigned NumInstructions = AsmSequence.size();
- if (!MaxIterations)
- MaxIterations = DEFAULT_ITERATIONS;
- NumInstructions *= std::min(MaxIterations, AsmSequence.getNumIterations());
+ unsigned NumInstructions = Source.size();
+ assert(Iterations && "Invalid number of iterations specified!");
+ NumInstructions *= Iterations;
Timeline.resize(NumInstructions);
TimelineViewEntry InvalidTVEntry = {-1, 0, 0, 0, 0};
std::fill(Timeline.begin(), Timeline.end(), InvalidTVEntry);
@@ -42,7 +41,7 @@ TimelineView::TimelineView(const MCSubtargetInfo &sti, MCInstPrinter &Printer,
void TimelineView::onReservedBuffers(const InstRef &IR,
ArrayRef<unsigned> Buffers) {
- if (IR.getSourceIndex() >= AsmSequence.size())
+ if (IR.getSourceIndex() >= Source.size())
return;
const MCSchedModel &SM = STI.getSchedModel();
@@ -72,7 +71,7 @@ void TimelineView::onEvent(const HWInstructionEvent &Event) {
// Update the WaitTime entry which corresponds to this Index.
assert(TVEntry.CycleDispatched >= 0 && "Invalid TVEntry found!");
unsigned CycleDispatched = static_cast<unsigned>(TVEntry.CycleDispatched);
- WaitTimeEntry &WTEntry = WaitTime[Index % AsmSequence.size()];
+ WaitTimeEntry &WTEntry = WaitTime[Index % Source.size()];
WTEntry.CyclesSpentInSchedulerQueue +=
TVEntry.CycleIssued - CycleDispatched;
assert(CycleDispatched <= TVEntry.CycleReady &&
@@ -176,9 +175,9 @@ void TimelineView::printAverageWaitTimes(raw_ostream &OS) const {
raw_string_ostream InstrStream(Instruction);
formatted_raw_ostream FOS(OS);
- unsigned Executions = Timeline.size() / AsmSequence.size();
+ unsigned Executions = Timeline.size() / Source.size();
unsigned IID = 0;
- for (const MCInst &Inst : AsmSequence) {
+ for (const MCInst &Inst : Source) {
printWaitTimeEntry(FOS, WaitTime[IID], IID, Executions);
// Append the instruction info at the end of the line.
MCIP.printInst(&Inst, InstrStream, "", STI);
@@ -268,14 +267,14 @@ void TimelineView::printTimeline(raw_ostream &OS) const {
raw_string_ostream InstrStream(Instruction);
unsigned IID = 0;
- const unsigned Iterations = Timeline.size() / AsmSequence.size();
+ const unsigned Iterations = Timeline.size() / Source.size();
for (unsigned Iteration = 0; Iteration < Iterations; ++Iteration) {
- for (const MCInst &Inst : AsmSequence) {
+ for (const MCInst &Inst : Source) {
const TimelineViewEntry &Entry = Timeline[IID];
if (Entry.CycleRetired == 0)
return;
- unsigned SourceIndex = IID % AsmSequence.size();
+ unsigned SourceIndex = IID % Source.size();
printTimelineViewEntry(FOS, Entry, Iteration, SourceIndex);
// Append the instruction info at the end of the line.
MCIP.printInst(&Inst, InstrStream, "", STI);
OpenPOWER on IntegriCloud