@@ -52,8 +52,8 @@ OptSchedDDGWrapperBasic::OptSchedDDGWrapperBasic(
52
52
MachineSchedContext *Context, ScheduleDAGOptSched *DAG,
53
53
OptSchedMachineModel *MM, LATENCY_PRECISION LatencyPrecision,
54
54
const std::string &RegionID)
55
- : DataDepGraph(MM, LatencyPrecision ), MM(MM), Contex(Context), DAG(DAG),
56
- RTFilter(nullptr ) {
55
+ : DataDepGraph(MM), MM(MM), Contex(Context), DAG(DAG),
56
+ LatencyPrecision(LatencyPrecision), RTFilter(nullptr ) {
57
57
dagFileFormat_ = DFF_BB;
58
58
isTraceFormat_ = false ;
59
59
TreatOrderDepsAsDataDeps =
@@ -447,11 +447,14 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU,
447
447
}
448
448
449
449
int16_t Latency;
450
- if (ltncyPrcsn_ == LTP_PRECISE) { // get latency from the machine model
450
+ switch (LatencyPrecision) {
451
+ case LTP_PRECISE: { // get latency from the machine model
451
452
const auto &InstName = DAG->TII ->getName (instr->getOpcode ());
452
453
const auto &InstType = MM->GetInstTypeByName (InstName);
453
454
Latency = MM->GetLatency (InstType, DepType);
454
- } else if (ltncyPrcsn_ == LTP_ROUGH) { // rough latency = llvm latency
455
+ break ;
456
+ }
457
+ case LTP_ROUGH: { // rough latency = llvm latency
455
458
Latency = I->getLatency ();
456
459
// If latency is above a specified target then reduce the latency
457
460
// by the specified divisor
@@ -468,12 +471,16 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU,
468
471
Logger::Event (" ReduceLatency" , " FromInstruction" , InstFromName.c_str (),
469
472
" ToInstruction" , InstToName.c_str (), " OriginalLatency" ,
470
473
OldLatency, " NewLatency" , Latency);
474
+ break ;
471
475
}
472
- } else
476
+ }
477
+ case LTP_UNITY:
473
478
Latency = 1 ; // unit latency = ignore ilp
474
479
475
- CreateEdge_ (SU.NodeNum , I->getSUnit ()->NodeNum , Latency, DepType,
476
- IsArtificial);
480
+ CreateEdge_ (SU.NodeNum , I->getSUnit ()->NodeNum , Latency, DepType,
481
+ IsArtificial);
482
+ break ;
483
+ }
477
484
}
478
485
}
479
486
0 commit comments