llvm.org GIT mirror llvm / 3aa5394
Generalize the MachineTraceMetrics public API. Naturally, we should be able to pass in extra instructions, not just extra blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180667 91177308-0d34-0410-b5e6-96231b3b80d8 Andrew Trick 7 years ago
2 changed file(s) with 21 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
259259 /// independent, exposing the maximum instruction-level parallelism.
260260 ///
261261 /// Any blocks in Extrablocks are included as if they were part of the
262 /// trace.
262 /// trace. Likewise, extra resources required by the specified scheduling
263 /// classes are included. For the caller to account for extra machine
264 /// instructions, it must first resolve each instruction's scheduling class.
263265 unsigned getResourceLength(ArrayRef Extrablocks =
264 ArrayRef()) const;
266 ArrayRef(),
267 ArrayRef ExtraInstrs =
268 ArrayRef()) const;
265269
266270 /// Return the length of the (data dependency) critical path through the
267271 /// trace.
11991199 return std::max(Instrs, PRMax);
12001200 }
12011201
1202
12021203 unsigned MachineTraceMetrics::Trace::
1203 getResourceLength(ArrayRef Extrablocks) const {
1204 getResourceLength(ArrayRef Extrablocks,
1205 ArrayRef ExtraInstrs) const {
12041206 // Add up resources above and below the center block.
12051207 ArrayRef PRDepths = TE.getProcResourceDepths(getBlockNum());
12061208 ArrayRef PRHeights = TE.getProcResourceHeights(getBlockNum());
12091211 unsigned PRCycles = PRDepths[K] + PRHeights[K];
12101212 for (unsigned I = 0; I != Extrablocks.size(); ++I)
12111213 PRCycles += TE.MTM.getProcResourceCycles(Extrablocks[I]->getNumber())[K];
1214 for (unsigned I = 0; I != ExtraInstrs.size(); ++I) {
1215 const MCSchedClassDesc* SC = ExtraInstrs[I];
1216 if (!SC->isValid())
1217 continue;
1218 for (TargetSchedModel::ProcResIter
1219 PI = TE.MTM.SchedModel.getWriteProcResBegin(SC),
1220 PE = TE.MTM.SchedModel.getWriteProcResEnd(SC); PI != PE; ++PI) {
1221 if (PI->ProcResourceIdx != K)
1222 continue;
1223 PRCycles += (PI->Cycles * TE.MTM.SchedModel.getResourceFactor(K));
1224 }
1225 }
12121226 PRMax = std::max(PRMax, PRCycles);
12131227 }
12141228 // Convert to cycle count.