From: Andrea Di Biagio Date: Fri, 4 May 2018 13:10:10 +0000 (+0000) Subject: [llvm-mca] remove unused argument from method InstrBuilder::createInstrDescImpl. X-Git-Tag: android-x86-7.1-r4~1491 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f501530ff63a98c9c4d8738dd03c757e25a6e7d5;p=android-x86%2Fexternal-llvm.git [llvm-mca] remove unused argument from method InstrBuilder::createInstrDescImpl. We don't need to pass the instruction index to the method that constructs new instruction descriptors. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331516 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/llvm-mca/Backend.cpp b/tools/llvm-mca/Backend.cpp index dbe20125102..f000837be59 100644 --- a/tools/llvm-mca/Backend.cpp +++ b/tools/llvm-mca/Backend.cpp @@ -33,8 +33,7 @@ void Backend::runCycle(unsigned Cycle) { while (SM.hasNext()) { InstRef IR = SM.peekNext(); - std::unique_ptr NewIS = - IB.createInstruction(IR.first, *IR.second); + std::unique_ptr NewIS = IB.createInstruction(*IR.second); const InstrDesc &Desc = NewIS->getDesc(); if (!DU->isAvailable(Desc.NumMicroOps) || !DU->canDispatch(IR.first, *NewIS)) diff --git a/tools/llvm-mca/InstrBuilder.cpp b/tools/llvm-mca/InstrBuilder.cpp index c45ec7d2866..193daf48c24 100644 --- a/tools/llvm-mca/InstrBuilder.cpp +++ b/tools/llvm-mca/InstrBuilder.cpp @@ -366,7 +366,7 @@ static void populateReads(InstrDesc &ID, const MCInst &MCI, } } -void InstrBuilder::createInstrDescImpl(const MCInst &MCI) { +const InstrDesc &InstrBuilder::createInstrDescImpl(const MCInst &MCI) { assert(STI.getSchedModel().hasInstrSchedModel() && "Itineraries are not yet supported!"); @@ -376,8 +376,8 @@ void InstrBuilder::createInstrDescImpl(const MCInst &MCI) { const MCSchedModel &SM = STI.getSchedModel(); // Then obtain the scheduling class information from the instruction. - const MCSchedClassDesc &SCDesc = - *SM.getSchedClassDesc(MCDesc.getSchedClass()); + unsigned SchedClassID = MCDesc.getSchedClass(); + const MCSchedClassDesc &SCDesc = *SM.getSchedClassDesc(SchedClassID); // Create a new empty descriptor. std::unique_ptr ID = llvm::make_unique(); @@ -417,16 +417,17 @@ void InstrBuilder::createInstrDescImpl(const MCInst &MCI) { // Now add the new descriptor. Descriptors[Opcode] = std::move(ID); + return *Descriptors[Opcode]; } const InstrDesc &InstrBuilder::getOrCreateInstrDesc(const MCInst &MCI) { if (Descriptors.find_as(MCI.getOpcode()) == Descriptors.end()) - createInstrDescImpl(MCI); + return createInstrDescImpl(MCI); return *Descriptors[MCI.getOpcode()]; } std::unique_ptr -InstrBuilder::createInstruction(unsigned Idx, const MCInst &MCI) { +InstrBuilder::createInstruction(const MCInst &MCI) { const InstrDesc &D = getOrCreateInstrDesc(MCI); std::unique_ptr NewIS = llvm::make_unique(D); diff --git a/tools/llvm-mca/InstrBuilder.h b/tools/llvm-mca/InstrBuilder.h index 30af1bf33ab..c22b7dcdbc6 100644 --- a/tools/llvm-mca/InstrBuilder.h +++ b/tools/llvm-mca/InstrBuilder.h @@ -41,7 +41,10 @@ class InstrBuilder { llvm::DenseMap> Descriptors; - void createInstrDescImpl(const llvm::MCInst &MCI); + const InstrDesc &createInstrDescImpl(const llvm::MCInst &MCI); + + InstrBuilder(const InstrBuilder &) = delete; + InstrBuilder &operator=(const InstrBuilder &) = delete; public: InstrBuilder(const llvm::MCSubtargetInfo &sti, const llvm::MCInstrInfo &mcii) @@ -59,8 +62,7 @@ public: return ProcResourceMasks; } - std::unique_ptr createInstruction(unsigned Idx, - const llvm::MCInst &MCI); + std::unique_ptr createInstruction(const llvm::MCInst &MCI); }; } // namespace mca diff --git a/tools/llvm-mca/InstructionTables.cpp b/tools/llvm-mca/InstructionTables.cpp index 18691adfed1..ae96568f166 100644 --- a/tools/llvm-mca/InstructionTables.cpp +++ b/tools/llvm-mca/InstructionTables.cpp @@ -31,7 +31,7 @@ void InstructionTables::run() { while (S.hasNext()) { UsedResources.clear(); InstRef IR = S.peekNext(); - std::unique_ptr Inst = IB.createInstruction(IR.first, *IR.second); + std::unique_ptr Inst = IB.createInstruction(*IR.second); const InstrDesc &Desc = Inst->getDesc(); // Now identify the resources consumed by this instruction. for (const std::pair Resource : Desc.Resources) {