diff options
Diffstat (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp')
| -rw-r--r-- | llvm/tools/llvm-mca/llvm-mca.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index 1826491f3f30..409de283e5a1 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -465,6 +465,21 @@ int main(int argc, char **argv) { const MCSchedModel &SM = STI->getSchedModel(); + std::unique_ptr<mca::InstrPostProcess> IPP; + if (!DisableCustomBehaviour) { + // TODO: It may be a good idea to separate CB and IPP so that they can + // be used independently of each other. What I mean by this is to add + // an extra command-line arg --disable-ipp so that CB and IPP can be + // toggled without needing to toggle both of them together. + IPP = std::unique_ptr<mca::InstrPostProcess>( + TheTarget->createInstrPostProcess(*STI, *MCII)); + } + if (!IPP) { + // If the target doesn't have its own IPP implemented (or the -disable-cb + // flag is set) then we use the base class (which does nothing). + IPP = std::make_unique<mca::InstrPostProcess>(*STI, *MCII); + } + // Create an instruction builder. mca::InstrBuilder IB(*STI, *MCII, *MRI, MCIA.get()); @@ -479,7 +494,7 @@ int main(int argc, char **argv) { unsigned RegionIdx = 0; std::unique_ptr<MCCodeEmitter> MCE( - TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx)); + TheTarget->createMCCodeEmitter(*MCII, Ctx)); assert(MCE && "Unable to create code emitter!"); std::unique_ptr<MCAsmBackend> MAB(TheTarget->createMCAsmBackend( @@ -498,16 +513,7 @@ int main(int argc, char **argv) { ArrayRef<MCInst> Insts = Region->getInstructions(); mca::CodeEmitter CE(*STI, *MAB, *MCE, Insts); - std::unique_ptr<mca::InstrPostProcess> IPP; - if (!DisableCustomBehaviour) { - IPP = std::unique_ptr<mca::InstrPostProcess>( - TheTarget->createInstrPostProcess(*STI, *MCII)); - } - if (!IPP) - // If the target doesn't have its own IPP implemented (or the - // -disable-cb flag is set) then we use the base class - // (which does nothing). - IPP = std::make_unique<mca::InstrPostProcess>(*STI, *MCII); + IPP->resetState(); SmallVector<std::unique_ptr<mca::Instruction>> LoweredSequence; for (const MCInst &MCI : Insts) { @@ -536,7 +542,8 @@ int main(int argc, char **argv) { LoweredSequence.emplace_back(std::move(Inst.get())); } - mca::SourceMgr S(LoweredSequence, PrintInstructionTables ? 1 : Iterations); + mca::CircularSourceMgr S(LoweredSequence, + PrintInstructionTables ? 1 : Iterations); if (PrintInstructionTables) { // Create a pipeline, stages, and a printer. |
