Skip to content

Commit d6fcd4b

Browse files
committed
[llvm-mca] Move CallLatency in constructor
1 parent d25e4a2 commit d6fcd4b

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

llvm/include/llvm/MCA/InstrBuilder.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class InstrBuilder {
9999
public:
100100
InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
101101
const MCRegisterInfo &RI, const MCInstrAnalysis *IA,
102-
const InstrumentManager &IM);
102+
const InstrumentManager &IM, unsigned CallLatency);
103103

104104
void clear() {
105105
Descriptors.clear();
@@ -112,8 +112,6 @@ class InstrBuilder {
112112
/// or null if there isn't any.
113113
void setInstRecycleCallback(InstRecycleCallback CB) { InstRecycleCB = CB; }
114114

115-
void setCallLatency(unsigned CL) { CallLatency = CL; }
116-
117115
Expected<std::unique_ptr<Instruction>>
118116
createInstruction(const MCInst &MCI, const SmallVector<Instrument *> &IVec);
119117
};

llvm/lib/MCA/InstrBuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
3131
const llvm::MCInstrInfo &mcii,
3232
const llvm::MCRegisterInfo &mri,
3333
const llvm::MCInstrAnalysis *mcia,
34-
const mca::InstrumentManager &im)
34+
const mca::InstrumentManager &im,
35+
unsigned cl)
3536
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), IM(im), FirstCallInst(true),
36-
FirstReturnInst(true), CallLatency(100U) {
37+
FirstReturnInst(true), CallLatency(cl) {
3738
const MCSchedModel &SM = STI.getSchedModel();
3839
ProcResourceMasks.resize(SM.getNumProcResourceKinds());
3940
computeProcResourceMasks(STI.getSchedModel(), ProcResourceMasks);

llvm/tools/llvm-mca/llvm-mca.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,7 @@ int main(int argc, char **argv) {
573573
}
574574

575575
// Create an instruction builder.
576-
mca::InstrBuilder IB(*STI, *MCII, *MRI, MCIA.get(), *IM);
577-
IB.setCallLatency(CallLatency);
576+
mca::InstrBuilder IB(*STI, *MCII, *MRI, MCIA.get(), *IM, CallLatency);
578577

579578
// Create a context to control ownership of the pipeline hardware.
580579
mca::Context MCA(*MRI, *STI);

0 commit comments

Comments
 (0)