[llvm] r331516 - [llvm-mca] remove unused argument from method InstrBuilder::createInstrDescImpl.
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Fri May 4 06:10:10 PDT 2018
Author: adibiagio
Date: Fri May 4 06:10:10 2018
New Revision: 331516
URL: http://llvm.org/viewvc/llvm-project?rev=331516&view=rev
Log:
[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.
Modified:
llvm/trunk/tools/llvm-mca/Backend.cpp
llvm/trunk/tools/llvm-mca/InstrBuilder.cpp
llvm/trunk/tools/llvm-mca/InstrBuilder.h
llvm/trunk/tools/llvm-mca/InstructionTables.cpp
Modified: llvm/trunk/tools/llvm-mca/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/Backend.cpp?rev=331516&r1=331515&r2=331516&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/Backend.cpp (original)
+++ llvm/trunk/tools/llvm-mca/Backend.cpp Fri May 4 06:10:10 2018
@@ -33,8 +33,7 @@ void Backend::runCycle(unsigned Cycle) {
while (SM.hasNext()) {
InstRef IR = SM.peekNext();
- std::unique_ptr<Instruction> NewIS =
- IB.createInstruction(IR.first, *IR.second);
+ std::unique_ptr<Instruction> NewIS = IB.createInstruction(*IR.second);
const InstrDesc &Desc = NewIS->getDesc();
if (!DU->isAvailable(Desc.NumMicroOps) ||
!DU->canDispatch(IR.first, *NewIS))
Modified: llvm/trunk/tools/llvm-mca/InstrBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/InstrBuilder.cpp?rev=331516&r1=331515&r2=331516&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/InstrBuilder.cpp (original)
+++ llvm/trunk/tools/llvm-mca/InstrBuilder.cpp Fri May 4 06:10:10 2018
@@ -366,7 +366,7 @@ static void populateReads(InstrDesc &ID,
}
}
-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(c
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<InstrDesc> ID = llvm::make_unique<InstrDesc>();
@@ -417,16 +417,17 @@ void InstrBuilder::createInstrDescImpl(c
// 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<Instruction>
-InstrBuilder::createInstruction(unsigned Idx, const MCInst &MCI) {
+InstrBuilder::createInstruction(const MCInst &MCI) {
const InstrDesc &D = getOrCreateInstrDesc(MCI);
std::unique_ptr<Instruction> NewIS = llvm::make_unique<Instruction>(D);
Modified: llvm/trunk/tools/llvm-mca/InstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/InstrBuilder.h?rev=331516&r1=331515&r2=331516&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/InstrBuilder.h (original)
+++ llvm/trunk/tools/llvm-mca/InstrBuilder.h Fri May 4 06:10:10 2018
@@ -41,7 +41,10 @@ class InstrBuilder {
llvm::DenseMap<unsigned short, std::unique_ptr<const InstrDesc>> 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<Instruction> createInstruction(unsigned Idx,
- const llvm::MCInst &MCI);
+ std::unique_ptr<Instruction> createInstruction(const llvm::MCInst &MCI);
};
} // namespace mca
Modified: llvm/trunk/tools/llvm-mca/InstructionTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/InstructionTables.cpp?rev=331516&r1=331515&r2=331516&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/InstructionTables.cpp (original)
+++ llvm/trunk/tools/llvm-mca/InstructionTables.cpp Fri May 4 06:10:10 2018
@@ -31,7 +31,7 @@ void InstructionTables::run() {
while (S.hasNext()) {
UsedResources.clear();
InstRef IR = S.peekNext();
- std::unique_ptr<Instruction> Inst = IB.createInstruction(IR.first, *IR.second);
+ std::unique_ptr<Instruction> Inst = IB.createInstruction(*IR.second);
const InstrDesc &Desc = Inst->getDesc();
// Now identify the resources consumed by this instruction.
for (const std::pair<uint64_t, ResourceUsage> Resource : Desc.Resources) {
More information about the llvm-commits
mailing list