Skip to content

Commit 3138e2d

Browse files
committed
Remove DataDepGraph's latency precision member
This member was only used in a particular subclass, so it should belong to that subclass.
1 parent f8cd35a commit 3138e2d

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

include/opt-sched/Scheduler/data_dep.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class DataDepGraph : public llvm::opt_sched::OptSchedDDGWrapperBase,
173173
public DirAcycGraph,
174174
public DataDepStruct {
175175
public:
176-
DataDepGraph(MachineModel *machMdl, LATENCY_PRECISION ltncyPcsn);
176+
DataDepGraph(MachineModel *machMdl);
177177
virtual ~DataDepGraph();
178178

179179
// Reads the data dependence graph from a text file.
@@ -367,7 +367,6 @@ class DataDepGraph : public llvm::opt_sched::OptSchedDDGWrapperBase,
367367
int entryInstCnt_;
368368
int exitInstCnt_;
369369

370-
LATENCY_PRECISION ltncyPrcsn_;
371370
int edgeCntPerLtncy_[MAX_LATENCY_VALUE + 1];
372371

373372
// Tracks all registers in the scheduling region. Each RegisterFile

lib/Scheduler/data_dep.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ InstCount DataDepStruct::CmputAbslutUprBound_() {
144144
return schedUprBound_;
145145
}
146146

147-
DataDepGraph::DataDepGraph(MachineModel *machMdl, LATENCY_PRECISION ltncyPrcsn)
148-
: DataDepStruct(machMdl) {
147+
DataDepGraph::DataDepGraph(MachineModel *machMdl) : DataDepStruct(machMdl) {
149148
int i;
150149

151150
type_ = DGT_FULL;
@@ -154,7 +153,6 @@ DataDepGraph::DataDepGraph(MachineModel *machMdl, LATENCY_PRECISION ltncyPrcsn)
154153
weight_ = 1.0;
155154
outptDags_ = ODG_ALL;
156155
maxOutptDagSize_ = 1000;
157-
ltncyPrcsn_ = ltncyPrcsn;
158156
includesCall_ = false;
159157
includesUnpipelined_ = false;
160158

lib/Wrapper/OptSchedDDGWrapperBasic.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ OptSchedDDGWrapperBasic::OptSchedDDGWrapperBasic(
5252
MachineSchedContext *Context, ScheduleDAGOptSched *DAG,
5353
OptSchedMachineModel *MM, LATENCY_PRECISION LatencyPrecision,
5454
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) {
5757
dagFileFormat_ = DFF_BB;
5858
isTraceFormat_ = false;
5959
TreatOrderDepsAsDataDeps =
@@ -447,11 +447,14 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU,
447447
}
448448

449449
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
451452
const auto &InstName = DAG->TII->getName(instr->getOpcode());
452453
const auto &InstType = MM->GetInstTypeByName(InstName);
453454
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
455458
Latency = I->getLatency();
456459
// If latency is above a specified target then reduce the latency
457460
// by the specified divisor
@@ -468,12 +471,16 @@ void OptSchedDDGWrapperBasic::convertEdges(const SUnit &SU,
468471
Logger::Event("ReduceLatency", "FromInstruction", InstFromName.c_str(),
469472
"ToInstruction", InstToName.c_str(), "OriginalLatency",
470473
OldLatency, "NewLatency", Latency);
474+
break;
471475
}
472-
} else
476+
}
477+
case LTP_UNITY:
473478
Latency = 1; // unit latency = ignore ilp
474479

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+
}
477484
}
478485
}
479486

0 commit comments

Comments
 (0)