diff options
author | Andrew Trick <atrick@apple.com> | 2013-04-27 03:54:20 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2013-04-27 03:54:20 +0000 |
commit | 3aa5394e5bbf267824e9d789ec8b1c27b85a8671 (patch) | |
tree | 7b59c4c4dcaa1431d5331be121d311a794a3b5d9 /lib/CodeGen/MachineTraceMetrics.cpp | |
parent | 29f198c9bfa4a122259f5e92853fbf4b5b2ab2bc (diff) | |
download | llvm-3aa5394e5bbf267824e9d789ec8b1c27b85a8671.tar.gz llvm-3aa5394e5bbf267824e9d789ec8b1c27b85a8671.tar.bz2 llvm-3aa5394e5bbf267824e9d789ec8b1c27b85a8671.tar.xz |
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
Diffstat (limited to 'lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r-- | lib/CodeGen/MachineTraceMetrics.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineTraceMetrics.cpp b/lib/CodeGen/MachineTraceMetrics.cpp index 49d8c4e947..00f702c846 100644 --- a/lib/CodeGen/MachineTraceMetrics.cpp +++ b/lib/CodeGen/MachineTraceMetrics.cpp @@ -1200,8 +1200,10 @@ unsigned MachineTraceMetrics::Trace::getResourceDepth(bool Bottom) const { return std::max(Instrs, PRMax); } + unsigned MachineTraceMetrics::Trace:: -getResourceLength(ArrayRef<const MachineBasicBlock*> Extrablocks) const { +getResourceLength(ArrayRef<const MachineBasicBlock*> Extrablocks, + ArrayRef<const MCSchedClassDesc*> ExtraInstrs) const { // Add up resources above and below the center block. ArrayRef<unsigned> PRDepths = TE.getProcResourceDepths(getBlockNum()); ArrayRef<unsigned> PRHeights = TE.getProcResourceHeights(getBlockNum()); @@ -1210,6 +1212,18 @@ getResourceLength(ArrayRef<const MachineBasicBlock*> Extrablocks) const { unsigned PRCycles = PRDepths[K] + PRHeights[K]; for (unsigned I = 0; I != Extrablocks.size(); ++I) PRCycles += TE.MTM.getProcResourceCycles(Extrablocks[I]->getNumber())[K]; + for (unsigned I = 0; I != ExtraInstrs.size(); ++I) { + const MCSchedClassDesc* SC = ExtraInstrs[I]; + if (!SC->isValid()) + continue; + for (TargetSchedModel::ProcResIter + PI = TE.MTM.SchedModel.getWriteProcResBegin(SC), + PE = TE.MTM.SchedModel.getWriteProcResEnd(SC); PI != PE; ++PI) { + if (PI->ProcResourceIdx != K) + continue; + PRCycles += (PI->Cycles * TE.MTM.SchedModel.getResourceFactor(K)); + } + } PRMax = std::max(PRMax, PRCycles); } // Convert to cycle count. |