xref: /freebsd/contrib/llvm-project/llvm/tools/llvm-mca/Views/TimelineView.cpp (revision 8bcb0991864975618c09697b1aca10683346d9f0)
10b57cec5SDimitry Andric //===--------------------- TimelineView.cpp ---------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric /// \brief
90b57cec5SDimitry Andric ///
100b57cec5SDimitry Andric /// This file implements the TimelineView interface.
110b57cec5SDimitry Andric ///
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #include "Views/TimelineView.h"
15*8bcb0991SDimitry Andric #include <numeric>
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric namespace llvm {
180b57cec5SDimitry Andric namespace mca {
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric TimelineView::TimelineView(const MCSubtargetInfo &sti, MCInstPrinter &Printer,
210b57cec5SDimitry Andric                            llvm::ArrayRef<llvm::MCInst> S, unsigned Iterations,
220b57cec5SDimitry Andric                            unsigned Cycles)
230b57cec5SDimitry Andric     : STI(sti), MCIP(Printer), Source(S), CurrentCycle(0),
240b57cec5SDimitry Andric       MaxCycle(Cycles == 0 ? 80 : Cycles), LastCycle(0), WaitTime(S.size()),
250b57cec5SDimitry Andric       UsedBuffer(S.size()) {
260b57cec5SDimitry Andric   unsigned NumInstructions = Source.size();
270b57cec5SDimitry Andric   assert(Iterations && "Invalid number of iterations specified!");
280b57cec5SDimitry Andric   NumInstructions *= Iterations;
290b57cec5SDimitry Andric   Timeline.resize(NumInstructions);
300b57cec5SDimitry Andric   TimelineViewEntry InvalidTVEntry = {-1, 0, 0, 0, 0};
310b57cec5SDimitry Andric   std::fill(Timeline.begin(), Timeline.end(), InvalidTVEntry);
320b57cec5SDimitry Andric 
330b57cec5SDimitry Andric   WaitTimeEntry NullWTEntry = {0, 0, 0};
340b57cec5SDimitry Andric   std::fill(WaitTime.begin(), WaitTime.end(), NullWTEntry);
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric   std::pair<unsigned, int> NullUsedBufferEntry = {/* Invalid resource ID*/ 0,
370b57cec5SDimitry Andric                                                   /* unknown buffer size */ -1};
380b57cec5SDimitry Andric   std::fill(UsedBuffer.begin(), UsedBuffer.end(), NullUsedBufferEntry);
390b57cec5SDimitry Andric }
400b57cec5SDimitry Andric 
410b57cec5SDimitry Andric void TimelineView::onReservedBuffers(const InstRef &IR,
420b57cec5SDimitry Andric                                      ArrayRef<unsigned> Buffers) {
430b57cec5SDimitry Andric   if (IR.getSourceIndex() >= Source.size())
440b57cec5SDimitry Andric     return;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   const MCSchedModel &SM = STI.getSchedModel();
470b57cec5SDimitry Andric   std::pair<unsigned, int> BufferInfo = {0, -1};
480b57cec5SDimitry Andric   for (const unsigned Buffer : Buffers) {
490b57cec5SDimitry Andric     const MCProcResourceDesc &MCDesc = *SM.getProcResource(Buffer);
500b57cec5SDimitry Andric     if (!BufferInfo.first || BufferInfo.second > MCDesc.BufferSize) {
510b57cec5SDimitry Andric       BufferInfo.first = Buffer;
520b57cec5SDimitry Andric       BufferInfo.second = MCDesc.BufferSize;
530b57cec5SDimitry Andric     }
540b57cec5SDimitry Andric   }
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric   UsedBuffer[IR.getSourceIndex()] = BufferInfo;
570b57cec5SDimitry Andric }
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric void TimelineView::onEvent(const HWInstructionEvent &Event) {
600b57cec5SDimitry Andric   const unsigned Index = Event.IR.getSourceIndex();
610b57cec5SDimitry Andric   if (Index >= Timeline.size())
620b57cec5SDimitry Andric     return;
630b57cec5SDimitry Andric 
640b57cec5SDimitry Andric   switch (Event.Type) {
650b57cec5SDimitry Andric   case HWInstructionEvent::Retired: {
660b57cec5SDimitry Andric     TimelineViewEntry &TVEntry = Timeline[Index];
670b57cec5SDimitry Andric     if (CurrentCycle < MaxCycle)
680b57cec5SDimitry Andric       TVEntry.CycleRetired = CurrentCycle;
690b57cec5SDimitry Andric 
700b57cec5SDimitry Andric     // Update the WaitTime entry which corresponds to this Index.
710b57cec5SDimitry Andric     assert(TVEntry.CycleDispatched >= 0 && "Invalid TVEntry found!");
720b57cec5SDimitry Andric     unsigned CycleDispatched = static_cast<unsigned>(TVEntry.CycleDispatched);
730b57cec5SDimitry Andric     WaitTimeEntry &WTEntry = WaitTime[Index % Source.size()];
740b57cec5SDimitry Andric     WTEntry.CyclesSpentInSchedulerQueue +=
750b57cec5SDimitry Andric         TVEntry.CycleIssued - CycleDispatched;
760b57cec5SDimitry Andric     assert(CycleDispatched <= TVEntry.CycleReady &&
770b57cec5SDimitry Andric            "Instruction cannot be ready if it hasn't been dispatched yet!");
780b57cec5SDimitry Andric     WTEntry.CyclesSpentInSQWhileReady +=
790b57cec5SDimitry Andric         TVEntry.CycleIssued - TVEntry.CycleReady;
800b57cec5SDimitry Andric     WTEntry.CyclesSpentAfterWBAndBeforeRetire +=
810b57cec5SDimitry Andric         (CurrentCycle - 1) - TVEntry.CycleExecuted;
820b57cec5SDimitry Andric     break;
830b57cec5SDimitry Andric   }
840b57cec5SDimitry Andric   case HWInstructionEvent::Ready:
850b57cec5SDimitry Andric     Timeline[Index].CycleReady = CurrentCycle;
860b57cec5SDimitry Andric     break;
870b57cec5SDimitry Andric   case HWInstructionEvent::Issued:
880b57cec5SDimitry Andric     Timeline[Index].CycleIssued = CurrentCycle;
890b57cec5SDimitry Andric     break;
900b57cec5SDimitry Andric   case HWInstructionEvent::Executed:
910b57cec5SDimitry Andric     Timeline[Index].CycleExecuted = CurrentCycle;
920b57cec5SDimitry Andric     break;
930b57cec5SDimitry Andric   case HWInstructionEvent::Dispatched:
940b57cec5SDimitry Andric     // There may be multiple dispatch events. Microcoded instructions that are
950b57cec5SDimitry Andric     // expanded into multiple uOps may require multiple dispatch cycles. Here,
960b57cec5SDimitry Andric     // we want to capture the first dispatch cycle.
970b57cec5SDimitry Andric     if (Timeline[Index].CycleDispatched == -1)
980b57cec5SDimitry Andric       Timeline[Index].CycleDispatched = static_cast<int>(CurrentCycle);
990b57cec5SDimitry Andric     break;
1000b57cec5SDimitry Andric   default:
1010b57cec5SDimitry Andric     return;
1020b57cec5SDimitry Andric   }
1030b57cec5SDimitry Andric   if (CurrentCycle < MaxCycle)
1040b57cec5SDimitry Andric     LastCycle = std::max(LastCycle, CurrentCycle);
1050b57cec5SDimitry Andric }
1060b57cec5SDimitry Andric 
1070b57cec5SDimitry Andric static raw_ostream::Colors chooseColor(unsigned CumulativeCycles,
1080b57cec5SDimitry Andric                                        unsigned Executions, int BufferSize) {
1090b57cec5SDimitry Andric   if (CumulativeCycles && BufferSize < 0)
1100b57cec5SDimitry Andric     return raw_ostream::MAGENTA;
1110b57cec5SDimitry Andric   unsigned Size = static_cast<unsigned>(BufferSize);
1120b57cec5SDimitry Andric   if (CumulativeCycles >= Size * Executions)
1130b57cec5SDimitry Andric     return raw_ostream::RED;
1140b57cec5SDimitry Andric   if ((CumulativeCycles * 2) >= Size * Executions)
1150b57cec5SDimitry Andric     return raw_ostream::YELLOW;
1160b57cec5SDimitry Andric   return raw_ostream::SAVEDCOLOR;
1170b57cec5SDimitry Andric }
1180b57cec5SDimitry Andric 
1190b57cec5SDimitry Andric static void tryChangeColor(raw_ostream &OS, unsigned Cycles,
1200b57cec5SDimitry Andric                            unsigned Executions, int BufferSize) {
1210b57cec5SDimitry Andric   if (!OS.has_colors())
1220b57cec5SDimitry Andric     return;
1230b57cec5SDimitry Andric 
1240b57cec5SDimitry Andric   raw_ostream::Colors Color = chooseColor(Cycles, Executions, BufferSize);
1250b57cec5SDimitry Andric   if (Color == raw_ostream::SAVEDCOLOR) {
1260b57cec5SDimitry Andric     OS.resetColor();
1270b57cec5SDimitry Andric     return;
1280b57cec5SDimitry Andric   }
1290b57cec5SDimitry Andric   OS.changeColor(Color, /* bold */ true, /* BG */ false);
1300b57cec5SDimitry Andric }
1310b57cec5SDimitry Andric 
1320b57cec5SDimitry Andric void TimelineView::printWaitTimeEntry(formatted_raw_ostream &OS,
1330b57cec5SDimitry Andric                                       const WaitTimeEntry &Entry,
1340b57cec5SDimitry Andric                                       unsigned SourceIndex,
1350b57cec5SDimitry Andric                                       unsigned Executions) const {
136*8bcb0991SDimitry Andric   bool PrintingTotals = SourceIndex == Source.size();
137*8bcb0991SDimitry Andric   unsigned CumulativeExecutions = PrintingTotals ? Timeline.size() : Executions;
138*8bcb0991SDimitry Andric 
139*8bcb0991SDimitry Andric   if (!PrintingTotals)
1400b57cec5SDimitry Andric     OS << SourceIndex << '.';
141*8bcb0991SDimitry Andric 
1420b57cec5SDimitry Andric   OS.PadToColumn(7);
1430b57cec5SDimitry Andric 
1440b57cec5SDimitry Andric   double AverageTime1, AverageTime2, AverageTime3;
145*8bcb0991SDimitry Andric   AverageTime1 =
146*8bcb0991SDimitry Andric       (double)Entry.CyclesSpentInSchedulerQueue / CumulativeExecutions;
147*8bcb0991SDimitry Andric   AverageTime2 = (double)Entry.CyclesSpentInSQWhileReady / CumulativeExecutions;
148*8bcb0991SDimitry Andric   AverageTime3 =
149*8bcb0991SDimitry Andric       (double)Entry.CyclesSpentAfterWBAndBeforeRetire / CumulativeExecutions;
1500b57cec5SDimitry Andric 
1510b57cec5SDimitry Andric   OS << Executions;
1520b57cec5SDimitry Andric   OS.PadToColumn(13);
153*8bcb0991SDimitry Andric 
154*8bcb0991SDimitry Andric   int BufferSize = PrintingTotals ? 0 : UsedBuffer[SourceIndex].second;
155*8bcb0991SDimitry Andric   if (!PrintingTotals)
156*8bcb0991SDimitry Andric     tryChangeColor(OS, Entry.CyclesSpentInSchedulerQueue, CumulativeExecutions,
157*8bcb0991SDimitry Andric                    BufferSize);
1580b57cec5SDimitry Andric   OS << format("%.1f", floor((AverageTime1 * 10) + 0.5) / 10);
1590b57cec5SDimitry Andric   OS.PadToColumn(20);
160*8bcb0991SDimitry Andric   if (!PrintingTotals)
161*8bcb0991SDimitry Andric     tryChangeColor(OS, Entry.CyclesSpentInSQWhileReady, CumulativeExecutions,
162*8bcb0991SDimitry Andric                    BufferSize);
1630b57cec5SDimitry Andric   OS << format("%.1f", floor((AverageTime2 * 10) + 0.5) / 10);
1640b57cec5SDimitry Andric   OS.PadToColumn(27);
165*8bcb0991SDimitry Andric   if (!PrintingTotals)
166*8bcb0991SDimitry Andric     tryChangeColor(OS, Entry.CyclesSpentAfterWBAndBeforeRetire,
167*8bcb0991SDimitry Andric                    CumulativeExecutions, STI.getSchedModel().MicroOpBufferSize);
1680b57cec5SDimitry Andric   OS << format("%.1f", floor((AverageTime3 * 10) + 0.5) / 10);
1690b57cec5SDimitry Andric 
1700b57cec5SDimitry Andric   if (OS.has_colors())
1710b57cec5SDimitry Andric     OS.resetColor();
1720b57cec5SDimitry Andric   OS.PadToColumn(34);
1730b57cec5SDimitry Andric }
1740b57cec5SDimitry Andric 
1750b57cec5SDimitry Andric void TimelineView::printAverageWaitTimes(raw_ostream &OS) const {
1760b57cec5SDimitry Andric   std::string Header =
1770b57cec5SDimitry Andric       "\n\nAverage Wait times (based on the timeline view):\n"
1780b57cec5SDimitry Andric       "[0]: Executions\n"
1790b57cec5SDimitry Andric       "[1]: Average time spent waiting in a scheduler's queue\n"
1800b57cec5SDimitry Andric       "[2]: Average time spent waiting in a scheduler's queue while ready\n"
1810b57cec5SDimitry Andric       "[3]: Average time elapsed from WB until retire stage\n\n"
1820b57cec5SDimitry Andric       "      [0]    [1]    [2]    [3]\n";
1830b57cec5SDimitry Andric   OS << Header;
1840b57cec5SDimitry Andric 
1850b57cec5SDimitry Andric   // Use a different string stream for printing instructions.
1860b57cec5SDimitry Andric   std::string Instruction;
1870b57cec5SDimitry Andric   raw_string_ostream InstrStream(Instruction);
1880b57cec5SDimitry Andric 
1890b57cec5SDimitry Andric   formatted_raw_ostream FOS(OS);
1900b57cec5SDimitry Andric   unsigned Executions = Timeline.size() / Source.size();
1910b57cec5SDimitry Andric   unsigned IID = 0;
1920b57cec5SDimitry Andric   for (const MCInst &Inst : Source) {
1930b57cec5SDimitry Andric     printWaitTimeEntry(FOS, WaitTime[IID], IID, Executions);
1940b57cec5SDimitry Andric     // Append the instruction info at the end of the line.
1950b57cec5SDimitry Andric     MCIP.printInst(&Inst, InstrStream, "", STI);
1960b57cec5SDimitry Andric     InstrStream.flush();
1970b57cec5SDimitry Andric 
1980b57cec5SDimitry Andric     // Consume any tabs or spaces at the beginning of the string.
1990b57cec5SDimitry Andric     StringRef Str(Instruction);
2000b57cec5SDimitry Andric     Str = Str.ltrim();
2010b57cec5SDimitry Andric     FOS << "   " << Str << '\n';
2020b57cec5SDimitry Andric     FOS.flush();
2030b57cec5SDimitry Andric     Instruction = "";
2040b57cec5SDimitry Andric 
2050b57cec5SDimitry Andric     ++IID;
2060b57cec5SDimitry Andric   }
207*8bcb0991SDimitry Andric 
208*8bcb0991SDimitry Andric   // If the timeline contains more than one instruction,
209*8bcb0991SDimitry Andric   // let's also print global averages.
210*8bcb0991SDimitry Andric   if (Source.size() != 1) {
211*8bcb0991SDimitry Andric     WaitTimeEntry TotalWaitTime = std::accumulate(
212*8bcb0991SDimitry Andric         WaitTime.begin(), WaitTime.end(), WaitTimeEntry{0, 0, 0},
213*8bcb0991SDimitry Andric         [](const WaitTimeEntry &A, const WaitTimeEntry &B) {
214*8bcb0991SDimitry Andric           return WaitTimeEntry{
215*8bcb0991SDimitry Andric               A.CyclesSpentInSchedulerQueue + B.CyclesSpentInSchedulerQueue,
216*8bcb0991SDimitry Andric               A.CyclesSpentInSQWhileReady + B.CyclesSpentInSQWhileReady,
217*8bcb0991SDimitry Andric               A.CyclesSpentAfterWBAndBeforeRetire +
218*8bcb0991SDimitry Andric                   B.CyclesSpentAfterWBAndBeforeRetire};
219*8bcb0991SDimitry Andric         });
220*8bcb0991SDimitry Andric     printWaitTimeEntry(FOS, TotalWaitTime, IID, Executions);
221*8bcb0991SDimitry Andric     FOS << "   "
222*8bcb0991SDimitry Andric         << "<total>" << '\n';
223*8bcb0991SDimitry Andric     InstrStream.flush();
224*8bcb0991SDimitry Andric   }
2250b57cec5SDimitry Andric }
2260b57cec5SDimitry Andric 
2270b57cec5SDimitry Andric void TimelineView::printTimelineViewEntry(formatted_raw_ostream &OS,
2280b57cec5SDimitry Andric                                           const TimelineViewEntry &Entry,
2290b57cec5SDimitry Andric                                           unsigned Iteration,
2300b57cec5SDimitry Andric                                           unsigned SourceIndex) const {
2310b57cec5SDimitry Andric   if (Iteration == 0 && SourceIndex == 0)
2320b57cec5SDimitry Andric     OS << '\n';
2330b57cec5SDimitry Andric   OS << '[' << Iteration << ',' << SourceIndex << ']';
2340b57cec5SDimitry Andric   OS.PadToColumn(10);
2350b57cec5SDimitry Andric   assert(Entry.CycleDispatched >= 0 && "Invalid TimelineViewEntry!");
2360b57cec5SDimitry Andric   unsigned CycleDispatched = static_cast<unsigned>(Entry.CycleDispatched);
2370b57cec5SDimitry Andric   for (unsigned I = 0, E = CycleDispatched; I < E; ++I)
2380b57cec5SDimitry Andric     OS << ((I % 5 == 0) ? '.' : ' ');
2390b57cec5SDimitry Andric   OS << TimelineView::DisplayChar::Dispatched;
2400b57cec5SDimitry Andric   if (CycleDispatched != Entry.CycleExecuted) {
2410b57cec5SDimitry Andric     // Zero latency instructions have the same value for CycleDispatched,
2420b57cec5SDimitry Andric     // CycleIssued and CycleExecuted.
2430b57cec5SDimitry Andric     for (unsigned I = CycleDispatched + 1, E = Entry.CycleIssued; I < E; ++I)
2440b57cec5SDimitry Andric       OS << TimelineView::DisplayChar::Waiting;
2450b57cec5SDimitry Andric     if (Entry.CycleIssued == Entry.CycleExecuted)
2460b57cec5SDimitry Andric       OS << TimelineView::DisplayChar::DisplayChar::Executed;
2470b57cec5SDimitry Andric     else {
2480b57cec5SDimitry Andric       if (CycleDispatched != Entry.CycleIssued)
2490b57cec5SDimitry Andric         OS << TimelineView::DisplayChar::Executing;
2500b57cec5SDimitry Andric       for (unsigned I = Entry.CycleIssued + 1, E = Entry.CycleExecuted; I < E;
2510b57cec5SDimitry Andric            ++I)
2520b57cec5SDimitry Andric         OS << TimelineView::DisplayChar::Executing;
2530b57cec5SDimitry Andric       OS << TimelineView::DisplayChar::Executed;
2540b57cec5SDimitry Andric     }
2550b57cec5SDimitry Andric   }
2560b57cec5SDimitry Andric 
2570b57cec5SDimitry Andric   for (unsigned I = Entry.CycleExecuted + 1, E = Entry.CycleRetired; I < E; ++I)
2580b57cec5SDimitry Andric     OS << TimelineView::DisplayChar::RetireLag;
2590b57cec5SDimitry Andric   OS << TimelineView::DisplayChar::Retired;
2600b57cec5SDimitry Andric 
2610b57cec5SDimitry Andric   // Skip other columns.
2620b57cec5SDimitry Andric   for (unsigned I = Entry.CycleRetired + 1, E = LastCycle; I <= E; ++I)
2630b57cec5SDimitry Andric     OS << ((I % 5 == 0 || I == LastCycle) ? '.' : ' ');
2640b57cec5SDimitry Andric }
2650b57cec5SDimitry Andric 
2660b57cec5SDimitry Andric static void printTimelineHeader(formatted_raw_ostream &OS, unsigned Cycles) {
2670b57cec5SDimitry Andric   OS << "\n\nTimeline view:\n";
2680b57cec5SDimitry Andric   if (Cycles >= 10) {
2690b57cec5SDimitry Andric     OS.PadToColumn(10);
2700b57cec5SDimitry Andric     for (unsigned I = 0; I <= Cycles; ++I) {
2710b57cec5SDimitry Andric       if (((I / 10) & 1) == 0)
2720b57cec5SDimitry Andric         OS << ' ';
2730b57cec5SDimitry Andric       else
2740b57cec5SDimitry Andric         OS << I % 10;
2750b57cec5SDimitry Andric     }
2760b57cec5SDimitry Andric     OS << '\n';
2770b57cec5SDimitry Andric   }
2780b57cec5SDimitry Andric 
2790b57cec5SDimitry Andric   OS << "Index";
2800b57cec5SDimitry Andric   OS.PadToColumn(10);
2810b57cec5SDimitry Andric   for (unsigned I = 0; I <= Cycles; ++I) {
2820b57cec5SDimitry Andric     if (((I / 10) & 1) == 0)
2830b57cec5SDimitry Andric       OS << I % 10;
2840b57cec5SDimitry Andric     else
2850b57cec5SDimitry Andric       OS << ' ';
2860b57cec5SDimitry Andric   }
2870b57cec5SDimitry Andric   OS << '\n';
2880b57cec5SDimitry Andric }
2890b57cec5SDimitry Andric 
2900b57cec5SDimitry Andric void TimelineView::printTimeline(raw_ostream &OS) const {
2910b57cec5SDimitry Andric   formatted_raw_ostream FOS(OS);
2920b57cec5SDimitry Andric   printTimelineHeader(FOS, LastCycle);
2930b57cec5SDimitry Andric   FOS.flush();
2940b57cec5SDimitry Andric 
2950b57cec5SDimitry Andric   // Use a different string stream for the instruction.
2960b57cec5SDimitry Andric   std::string Instruction;
2970b57cec5SDimitry Andric   raw_string_ostream InstrStream(Instruction);
2980b57cec5SDimitry Andric 
2990b57cec5SDimitry Andric   unsigned IID = 0;
3000b57cec5SDimitry Andric   const unsigned Iterations = Timeline.size() / Source.size();
3010b57cec5SDimitry Andric   for (unsigned Iteration = 0; Iteration < Iterations; ++Iteration) {
3020b57cec5SDimitry Andric     for (const MCInst &Inst : Source) {
3030b57cec5SDimitry Andric       const TimelineViewEntry &Entry = Timeline[IID];
3040b57cec5SDimitry Andric       if (Entry.CycleRetired == 0)
3050b57cec5SDimitry Andric         return;
3060b57cec5SDimitry Andric 
3070b57cec5SDimitry Andric       unsigned SourceIndex = IID % Source.size();
3080b57cec5SDimitry Andric       printTimelineViewEntry(FOS, Entry, Iteration, SourceIndex);
3090b57cec5SDimitry Andric       // Append the instruction info at the end of the line.
3100b57cec5SDimitry Andric       MCIP.printInst(&Inst, InstrStream, "", STI);
3110b57cec5SDimitry Andric       InstrStream.flush();
3120b57cec5SDimitry Andric 
3130b57cec5SDimitry Andric       // Consume any tabs or spaces at the beginning of the string.
3140b57cec5SDimitry Andric       StringRef Str(Instruction);
3150b57cec5SDimitry Andric       Str = Str.ltrim();
3160b57cec5SDimitry Andric       FOS << "   " << Str << '\n';
3170b57cec5SDimitry Andric       FOS.flush();
3180b57cec5SDimitry Andric       Instruction = "";
3190b57cec5SDimitry Andric 
3200b57cec5SDimitry Andric       ++IID;
3210b57cec5SDimitry Andric     }
3220b57cec5SDimitry Andric   }
3230b57cec5SDimitry Andric }
3240b57cec5SDimitry Andric } // namespace mca
3250b57cec5SDimitry Andric } // namespace llvm
326