@@ -33,7 +33,7 @@ InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo &sti,
33
33
const llvm::MCInstrAnalysis *mcia,
34
34
const mca::InstrumentManager &im)
35
35
: STI(sti), MCII(mcii), MRI(mri), MCIA(mcia), IM(im), FirstCallInst(true ),
36
- FirstReturnInst (true ) {
36
+ FirstReturnInst (true ), CallLatency( 100U ) {
37
37
const MCSchedModel &SM = STI.getSchedModel ();
38
38
ProcResourceMasks.resize (SM.getNumProcResourceKinds ());
39
39
computeProcResourceMasks (STI.getSchedModel (), ProcResourceMasks);
@@ -220,17 +220,18 @@ static void initializeUsedResources(InstrDesc &ID,
220
220
221
221
static void computeMaxLatency (InstrDesc &ID, const MCInstrDesc &MCDesc,
222
222
const MCSchedClassDesc &SCDesc,
223
- const MCSubtargetInfo &STI) {
223
+ const MCSubtargetInfo &STI,
224
+ unsigned CallLatency) {
224
225
if (MCDesc.isCall ()) {
225
226
// We cannot estimate how long this call will take.
226
- // Artificially set an arbitrarily high latency (100cy).
227
- ID.MaxLatency = 100U ;
227
+ // Artificially set an arbitrarily high latency (default: 100cy).
228
+ ID.MaxLatency = CallLatency ;
228
229
return ;
229
230
}
230
231
231
232
int Latency = MCSchedModel::computeInstrLatency (STI, SCDesc);
232
- // If latency is unknown, then conservatively assume a MaxLatency of 100cy.
233
- ID.MaxLatency = Latency < 0 ? 100U : static_cast <unsigned >(Latency);
233
+ // If latency is unknown, then conservatively assume a MaxLatency set for calls (default: 100cy) .
234
+ ID.MaxLatency = Latency < 0 ? CallLatency : static_cast <unsigned >(Latency);
234
235
}
235
236
236
237
static Error verifyOperands (const MCInstrDesc &MCDesc, const MCInst &MCI) {
@@ -568,7 +569,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
568
569
// We don't correctly model calls.
569
570
WithColor::warning () << " found a call in the input assembly sequence.\n " ;
570
571
WithColor::note () << " call instructions are not correctly modeled. "
571
- << " Assume a latency of 100cy .\n " ;
572
+ << " Assume a latency of " << CallLatency << " cy .\n " ;
572
573
FirstCallInst = false ;
573
574
}
574
575
@@ -580,7 +581,7 @@ InstrBuilder::createInstrDescImpl(const MCInst &MCI,
580
581
}
581
582
582
583
initializeUsedResources (*ID, SCDesc, STI, ProcResourceMasks);
583
- computeMaxLatency (*ID, MCDesc, SCDesc, STI);
584
+ computeMaxLatency (*ID, MCDesc, SCDesc, STI, CallLatency );
584
585
585
586
if (Error Err = verifyOperands (MCDesc, MCI))
586
587
return std::move (Err);
0 commit comments