diff options
author | Michael Maitland <michaeltmaitland@gmail.com> | 2022-11-15 18:01:19 -0800 |
---|---|---|
committer | Michael Maitland <michaeltmaitland@gmail.com> | 2022-11-15 18:01:46 -0800 |
commit | e8e92c8313a0481ad2770587310d399abddce665 (patch) | |
tree | 7afa8ceb6b4a120314b05f30ff777e606a2cf40f /llvm/lib/MCA | |
parent | b32831f4a93fd3b8c6718a6a1847e199c72b1385 (diff) | |
download | llvm-e8e92c8313a0481ad2770587310d399abddce665.zip llvm-e8e92c8313a0481ad2770587310d399abddce665.tar.gz llvm-e8e92c8313a0481ad2770587310d399abddce665.tar.bz2 |
Revert "[RISCV][llvm-mca] Use LMUL Instruments to provide more accurate reports on RISCV"
This reverts commit b88b8307bf9e24f53e7ef3052abf2c506ff55fd2.
Diffstat (limited to 'llvm/lib/MCA')
-rw-r--r-- | llvm/lib/MCA/CustomBehaviour.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/MCA/InstrBuilder.cpp | 50 |
2 files changed, 18 insertions, 43 deletions
diff --git a/llvm/lib/MCA/CustomBehaviour.cpp b/llvm/lib/MCA/CustomBehaviour.cpp index b593e96..a10a2f5 100644 --- a/llvm/lib/MCA/CustomBehaviour.cpp +++ b/llvm/lib/MCA/CustomBehaviour.cpp @@ -42,16 +42,5 @@ CustomBehaviour::getEndViews(llvm::MCInstPrinter &IP, return std::vector<std::unique_ptr<View>>(); } -SharedInstrument InstrumentManager::createInstrument(llvm::StringRef Desc, - llvm::StringRef Data) { - return std::make_shared<Instrument>(Desc, Data); -} - -unsigned InstrumentManager::getSchedClassID( - const MCInstrInfo &MCII, const MCInst &MCI, - const llvm::SmallVector<SharedInstrument> &IVec) const { - return MCII.get(MCI.getOpcode()).getSchedClass(); -} - } // namespace mca } // namespace llvm diff --git a/llvm/lib/MCA/InstrBuilder.cpp b/llvm/lib/MCA/InstrBuilder.cpp index 5a2989a..71c5652 100644 --- a/llvm/lib/MCA/InstrBuilder.cpp +++ b/llvm/lib/MCA/InstrBuilder.cpp @@ -30,9 +30,8 @@ char RecycledInstErr::ID = 0; InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii, const llvm::MCRegisterInfo &mri, - const llvm::MCInstrAnalysis *mcia, - const mca::InstrumentManager &im) - : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), IM(im), FirstCallInst(true), + const llvm::MCInstrAnalysis *mcia) + : STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), FirstCallInst(true), FirstReturnInst(true) { const MCSchedModel &SM = STI.getSchedModel(); ProcResourceMasks.resize(SM.getNumProcResourceKinds()); @@ -510,8 +509,7 @@ Error InstrBuilder::verifyInstrDesc(const InstrDesc &ID, } Expected<const InstrDesc &> -InstrBuilder::createInstrDescImpl(const MCInst &MCI, - const SmallVector<SharedInstrument> &IVec) { +InstrBuilder::createInstrDescImpl(const MCInst &MCI) { assert(STI.getSchedModel().hasInstrSchedModel() && "Itineraries are not yet supported!"); @@ -521,8 +519,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI, const MCSchedModel &SM = STI.getSchedModel(); // Then obtain the scheduling class information from the instruction. - // Allow InstrumentManager to override and use a different SchedClassID - unsigned SchedClassID = IM.getSchedClassID(MCII, MCI, IVec); + unsigned SchedClassID = MCDesc.getSchedClass(); bool IsVariant = SM.getSchedClassDesc(SchedClassID)->isVariant(); // Try to solve variant scheduling classes. @@ -589,41 +586,30 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI, // Now add the new descriptor. bool IsVariadic = MCDesc.isVariadic(); if ((ID->IsRecyclable = !IsVariadic && !IsVariant)) { - auto DKey = std::make_pair(MCI.getOpcode(), SchedClassID); - Descriptors[DKey] = std::move(ID); - return *Descriptors[DKey]; + Descriptors[MCI.getOpcode()] = std::move(ID); + return *Descriptors[MCI.getOpcode()]; } - auto VDKey = std::make_pair(&MCI, SchedClassID); - VariantDescriptors[VDKey] = std::move(ID); - return *VariantDescriptors[VDKey]; + VariantDescriptors[&MCI] = std::move(ID); + return *VariantDescriptors[&MCI]; } Expected<const InstrDesc &> -InstrBuilder::getOrCreateInstrDesc(const MCInst &MCI, - const SmallVector<SharedInstrument> &IVec) { - // Cache lookup using SchedClassID from Instrumentation - unsigned SchedClassID = IM.getSchedClassID(MCII, MCI, IVec); - - auto DKey = std::make_pair(MCI.getOpcode(), SchedClassID); - if (Descriptors.find_as(DKey) != Descriptors.end()) - return *Descriptors[DKey]; - - unsigned CPUID = STI.getSchedModel().getProcessorID(); - SchedClassID = STI.resolveVariantSchedClass(SchedClassID, &MCI, &MCII, CPUID); - auto VDKey = std::make_pair(&MCI, SchedClassID); - if (VariantDescriptors.find(VDKey) != VariantDescriptors.end()) - return *VariantDescriptors[VDKey]; - - return createInstrDescImpl(MCI, IVec); +InstrBuilder::getOrCreateInstrDesc(const MCInst &MCI) { + if (Descriptors.find_as(MCI.getOpcode()) != Descriptors.end()) + return *Descriptors[MCI.getOpcode()]; + + if (VariantDescriptors.find(&MCI) != VariantDescriptors.end()) + return *VariantDescriptors[&MCI]; + + return createInstrDescImpl(MCI); } STATISTIC(NumVariantInst, "Number of MCInsts that doesn't have static Desc"); Expected<std::unique_ptr<Instruction>> -InstrBuilder::createInstruction(const MCInst &MCI, - const SmallVector<SharedInstrument> &IVec) { - Expected<const InstrDesc &> DescOrErr = getOrCreateInstrDesc(MCI, IVec); +InstrBuilder::createInstruction(const MCInst &MCI) { + Expected<const InstrDesc &> DescOrErr = getOrCreateInstrDesc(MCI); if (!DescOrErr) return DescOrErr.takeError(); const InstrDesc &D = *DescOrErr; |