llvm.org GIT mirror llvm / 2ccdbc6
Allow MachineTraceMetrics to be used when the model has no resources. It it still possible to extract information from itineraries, for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178582 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 7 years ago
2 changed file(s) with 11 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
676676 if (Stress)
677677 return true;
678678
679 // Without a scheduling model, we can't make decisions.
680 if (!SchedModel->hasInstrSchedModel())
681 return false;
682
683679 if (!MinInstr)
684680 MinInstr = Traces->getEnsemble(MachineTraceMetrics::TS_MinInstrCount);
685681
104104 FBI->HasCalls = true;
105105
106106 // Count processor resources used.
107 if (!SchedModel.hasInstrSchedModel())
108 continue;
107109 const MCSchedClassDesc *SC = SchedModel.resolveSchedClass(MI);
108110 if (!SC->isValid())
109111 continue;
131133 assert(BlockInfo[MBBNum].hasResources() &&
132134 "getResources() must be called before getProcResourceCycles()");
133135 unsigned PRKinds = SchedModel.getNumProcResourceKinds();
134 return ArrayRef(&ProcResourceCycles[MBBNum * PRKinds], PRKinds);
136 assert((MBBNum+1) * PRKinds <= ProcResourceCycles.size());
137 return ArrayRef(ProcResourceCycles.data() + MBBNum * PRKinds,
138 PRKinds);
135139 }
136140
137141
250254 MachineTraceMetrics::Ensemble::
251255 getProcResourceDepths(unsigned MBBNum) const {
252256 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
253 return ArrayRef(&ProcResourceDepths[MBBNum * PRKinds], PRKinds);
257 assert((MBBNum+1) * PRKinds <= ProcResourceDepths.size());
258 return ArrayRef(ProcResourceDepths.data() + MBBNum * PRKinds,
259 PRKinds);
254260 }
255261
256262 /// Get an array of processor resource heights for MBB. Indexed by processor
262268 MachineTraceMetrics::Ensemble::
263269 getProcResourceHeights(unsigned MBBNum) const {
264270 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
265 return ArrayRef(&ProcResourceHeights[MBBNum * PRKinds], PRKinds);
271 assert((MBBNum+1) * PRKinds <= ProcResourceHeights.size());
272 return ArrayRef(ProcResourceHeights.data() + MBBNum * PRKinds,
273 PRKinds);
266274 }
267275
268276 //===----------------------------------------------------------------------===//