10 #define DEBUG_TYPE "machine-trace-metrics"
33 "machine-trace-metrics",
"Machine Trace Metrics",
false,
true)
39 MachineTraceMetrics::MachineTraceMetrics()
56 Loops = &getAnalysis<MachineLoopInfo>();
59 SchedModel.
init(*ST.getSchedModel(), &
ST,
TII);
85 assert(MBB &&
"No basic block");
92 unsigned InstrCount = 0;
117 assert(PI->ProcResourceIdx < PRKinds &&
"Bad processor resource kind");
118 PRCycles[PI->ProcResourceIdx] += PI->Cycles;
124 unsigned PROffset = MBB->
getNumber() * PRKinds;
125 for (
unsigned K = 0; K != PRKinds; ++K)
126 ProcResourceCycles[PROffset + K] =
134 assert(BlockInfo[MBBNum].hasResources() &&
135 "getResources() must be called before getProcResourceCycles()");
137 assert((MBBNum+1) * PRKinds <= ProcResourceCycles.
size());
149 BlockInfo.resize(
MTM.BlockInfo.size());
151 ProcResourceDepths.
resize(
MTM.BlockInfo.size() * PRKinds);
152 ProcResourceHeights.
resize(
MTM.BlockInfo.size() * PRKinds);
160 return MTM.Loops->getLoopFor(MBB);
165 void MachineTraceMetrics::Ensemble::
168 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
169 unsigned PROffset = MBB->
getNumber() * PRKinds;
175 std::fill(ProcResourceDepths.begin() + PROffset,
176 ProcResourceDepths.begin() + PROffset + PRKinds, 0);
183 TraceBlockInfo *PredTBI = &BlockInfo[PredNum];
184 assert(PredTBI->hasValidDepth() &&
"Trace above has not been computed yet");
185 const FixedBlockInfo *PredFBI = MTM.getResources(TBI->
Pred);
186 TBI->
InstrDepth = PredTBI->InstrDepth + PredFBI->InstrCount;
187 TBI->
Head = PredTBI->Head;
192 for (
unsigned K = 0; K != PRKinds; ++K)
193 ProcResourceDepths[PROffset + K] = PredPRDepths[K] + PredPRCycles[K];
198 void MachineTraceMetrics::Ensemble::
200 TraceBlockInfo *TBI = &BlockInfo[MBB->
getNumber()];
201 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
202 unsigned PROffset = MBB->
getNumber() * PRKinds;
205 TBI->InstrHeight = MTM.getResources(MBB)->InstrCount;
211 std::copy(PRCycles.
begin(), PRCycles.
end(),
212 ProcResourceHeights.begin() + PROffset);
218 unsigned SuccNum = TBI->Succ->getNumber();
219 TraceBlockInfo *SuccTBI = &BlockInfo[SuccNum];
220 assert(SuccTBI->hasValidHeight() &&
"Trace below has not been computed yet");
221 TBI->InstrHeight += SuccTBI->InstrHeight;
222 TBI->Tail = SuccTBI->Tail;
226 for (
unsigned K = 0; K != PRKinds; ++K)
227 ProcResourceHeights[PROffset + K] = SuccPRHeights[K] + PRCycles[K];
257 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
258 assert((MBBNum+1) * PRKinds <= ProcResourceDepths.size());
271 unsigned PRKinds = MTM.SchedModel.getNumProcResourceKinds();
272 assert((MBBNum+1) * PRKinds <= ProcResourceHeights.size());
305 const char *
getName()
const {
return "MinInstr"; }
322 if (CurLoop && MBB == CurLoop->
getHeader())
324 unsigned CurCount = MTM.getResources(MBB)->InstrCount;
326 unsigned BestDepth = 0;
331 getDepthResources(Pred);
336 unsigned Depth = PredTBI->
InstrDepth + CurCount;
337 if (!Best || Depth < BestDepth)
338 Best = Pred, BestDepth = Depth;
350 unsigned BestHeight = 0;
355 if (CurLoop && Succ == CurLoop->
getHeader())
361 getHeightResources(Succ);
367 if (!Best || Height < BestHeight)
368 Best = Succ, BestHeight = Height;
390 BlockInfo[MBB->
getNumber()].invalidate();
400 assert(BlockInfo.size() == MF->
getNumBlockIDs() &&
"Outdated BlockInfo size");
423 : Blocks(blocks),
Loops(loops), Downward(
false) {}
444 if (
const MachineLoop *FromLoop = LB.Loops->getLoopFor(From)) {
446 if ((LB.Downward ? To : From) == FromLoop->getHeader())
455 return LB.Visited.insert(To);
465 LoopBounds Bounds(BlockInfo, MTM.Loops);
468 Bounds.Downward =
false;
469 Bounds.Visited.clear();
473 DEBUG(
dbgs() <<
" pred for BB#" <<
I->getNumber() <<
": ");
474 TraceBlockInfo &TBI = BlockInfo[
I->getNumber()];
476 TBI.Pred = pickTracePred(*
I);
479 dbgs() <<
"BB#" << TBI.Pred->getNumber() <<
'\n';
484 computeDepthResources(*
I);
488 Bounds.Downward =
true;
489 Bounds.Visited.clear();
493 DEBUG(
dbgs() <<
" succ for BB#" <<
I->getNumber() <<
": ");
494 TraceBlockInfo &TBI = BlockInfo[
I->getNumber()];
496 TBI.Succ = pickTraceSucc(*
I);
499 dbgs() <<
"BB#" << TBI.Succ->getNumber() <<
'\n';
504 computeHeightResources(*
I);
529 if (TBI.
Succ == MBB) {
537 }
while (!WorkList.
empty());
555 if (TBI.
Pred == MBB) {
563 }
while (!WorkList.
empty());
578 assert(BlockInfo.size() == MTM.MF->getNumBlockIDs() &&
579 "Outdated BlockInfo size");
580 for (
unsigned Num = 0, e = BlockInfo.size(); Num != e; ++Num) {
586 "Trace is broken, depth should have been invalidated.");
588 assert(!(Loop && MBB == Loop->getHeader()) &&
"Trace contains backedge");
594 "Trace is broken, height should have been invalidated.");
597 assert(!(Loop && Loop == SuccLoop && TBI.
Succ == Loop->getHeader()) &&
598 "Trace contains backedge");
621 DataDep(
const MachineInstr *DefMI,
unsigned DefOp,
unsigned UseOp)
622 : DefMI(DefMI), DefOp(DefOp), UseOp(UseOp) {}
629 assert(!DefI.
atEnd() &&
"Register has no defs");
632 assert((++DefI).atEnd() &&
"Register has multiple defs");
642 bool HasPhysRegs =
false;
646 unsigned Reg = MO->getReg();
655 Deps.
push_back(DataDep(MRI, Reg, MO.getOperandNo()));
691 unsigned getSparseSetIndex()
const {
return RegUnit; }
693 LiveRegUnit(
unsigned RU) : RegUnit(RU), Cycle(0),
MI(0), Op(0) {}
709 unsigned Reg = MO->getReg();
718 }
else if (MO->isKill())
725 if (I == RegUnits.
end())
727 Deps.
push_back(DataDep(I->MI, I->Op, MO.getOperandNo()));
734 for (
unsigned i = 0, e = Kills.
size(); i != e; ++i)
736 RegUnits.
erase(*Units);
739 for (
unsigned i = 0, e = LiveDefOps.
size(); i != e; ++i) {
740 unsigned DefOp = LiveDefOps[i];
743 LiveRegUnit &LRU = RegUnits[*Units];
761 unsigned MachineTraceMetrics::Ensemble::
762 computeCrossBlockCriticalPath(
const TraceBlockInfo &TBI) {
763 assert(TBI.HasValidInstrDepths &&
"Missing depth info");
764 assert(TBI.HasValidInstrHeights &&
"Missing height info");
766 for (
unsigned i = 0, e = TBI.LiveIns.size(); i != e; ++i) {
767 const LiveInReg &LIR = TBI.LiveIns[i];
770 const MachineInstr *DefMI = MTM.MRI->getVRegDef(LIR.Reg);
773 if (!DefTBI.isUsefulDominator(TBI))
775 unsigned Len = LIR.Height + Cycles[DefMI].Depth;
776 MaxLen = std::max(MaxLen, Len);
783 void MachineTraceMetrics::Ensemble::
790 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
791 assert(TBI.hasValidDepth() &&
"Incomplete trace");
792 if (TBI.HasValidInstrDepths)
807 while (!Stack.
empty()) {
810 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
811 TBI.HasValidInstrDepths =
true;
812 TBI.CriticalPath = 0;
816 dbgs() <<
format(
"%7u Instructions\n", TBI.InstrDepth);
818 for (
unsigned K = 0; K != PRDepths.
size(); ++K)
820 unsigned Factor = MTM.SchedModel.getResourceFactor(K);
821 dbgs() <<
format(
"%6uc @ ", MTM.getCycles(PRDepths[K]))
822 << MTM.SchedModel.getProcResource(K)->Name <<
" ("
823 << PRDepths[K]/Factor <<
" ops x" << Factor <<
")\n";
828 if (TBI.HasValidInstrHeights)
829 TBI.CriticalPath = computeCrossBlockCriticalPath(TBI);
844 for (
unsigned i = 0, e = Deps.
size(); i != e; ++i) {
845 const DataDep &Dep = Deps[i];
846 const TraceBlockInfo&DepTBI =
847 BlockInfo[Dep.DefMI->getParent()->getNumber()];
849 if (!DepTBI.isUsefulDominator(TBI))
851 assert(DepTBI.HasValidInstrDepths &&
"Inconsistent dependency");
852 unsigned DepCycle = Cycles.lookup(Dep.DefMI).Depth;
854 if (!Dep.DefMI->isTransient())
855 DepCycle += MTM.SchedModel
856 .computeOperandLatency(Dep.DefMI, Dep.DefOp, UseMI, Dep.UseOp);
857 Cycle = std::max(Cycle, DepCycle);
860 InstrCycles &MICycles = Cycles[UseMI];
861 MICycles.Depth = Cycle;
863 if (!TBI.HasValidInstrHeights) {
864 DEBUG(
dbgs() << Cycle <<
'\t' << *UseMI);
868 TBI.CriticalPath = std::max(TBI.CriticalPath, Cycle + MICycles.Height);
869 DEBUG(
dbgs() << TBI.CriticalPath <<
'\t' << Cycle <<
'\t' << *UseMI);
886 unsigned Reg = MO->getReg();
897 if (I == RegUnits.
end())
899 unsigned DepHeight = I->Cycle;
903 DepHeight += SchedModel
906 Height = std::max(Height, DepHeight);
913 for (
unsigned i = 0, e = ReadOps.
size(); i != e; ++i) {
916 LiveRegUnit &LRU = RegUnits[*Units];
918 if (LRU.Cycle <= Height && LRU.MI != MI) {
940 if (!Dep.DefMI->isTransient())
947 tie(I, New) = Heights.
insert(std::make_pair(Dep.DefMI, UseHeight));
952 if (I->second < UseHeight)
953 I->second = UseHeight;
960 void MachineTraceMetrics::Ensemble::
963 assert(!Trace.
empty() &&
"Trace should contain at least one block");
969 for (
unsigned i = Trace.
size(); i; --i) {
973 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
975 TBI.LiveIns.push_back(Reg);
982 void MachineTraceMetrics::Ensemble::
988 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
989 assert(TBI.hasValidHeight() &&
"Incomplete trace");
990 if (TBI.HasValidInstrHeights)
1010 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
1011 for (
unsigned i = 0, e = TBI.LiveIns.size(); i != e; ++i) {
1012 LiveInReg
LI = TBI.LiveIns[i];
1015 unsigned &Height = Heights[MTM.MRI->getVRegDef(LI.Reg)];
1016 if (Height < LI.Height)
1021 RegUnits[LI.Reg].Cycle = LI.Height;
1031 TraceBlockInfo &TBI = BlockInfo[MBB->
getNumber()];
1032 TBI.HasValidInstrHeights =
true;
1033 TBI.CriticalPath = 0;
1036 dbgs() <<
format(
"%7u Instructions\n", TBI.InstrHeight);
1038 for (
unsigned K = 0; K != PRHeights.
size(); ++K)
1040 unsigned Factor = MTM.SchedModel.getResourceFactor(K);
1041 dbgs() <<
format(
"%6uc @ ", MTM.getCycles(PRHeights[K]))
1042 << MTM.SchedModel.getProcResource(K)->Name <<
" ("
1043 << PRHeights[K]/Factor <<
" ops x" << Factor <<
")\n";
1059 I != E &&
I->isPHI(); ++
I) {
1063 if (!Deps.
empty()) {
1065 unsigned Height = TBI.Succ ? Cycles.lookup(PHI).Height : 0;
1066 DEBUG(
dbgs() <<
"pred\t" << Height <<
'\t' << *PHI);
1068 Heights, MTM.SchedModel, MTM.TII))
1069 addLiveIns(Deps.
front().DefMI, Deps.
front().DefOp, Stack);
1083 if (HeightI != Heights.
end()) {
1084 Cycle = HeightI->second;
1086 Heights.
erase(HeightI);
1097 MTM.SchedModel, MTM.TII, MTM.TRI);
1100 for (
unsigned i = 0, e = Deps.
size(); i != e; ++i)
1101 if (
pushDepHeight(Deps[i], MI, Cycle, Heights, MTM.SchedModel, MTM.TII))
1102 addLiveIns(Deps[i].DefMI, Deps[i].DefOp, Stack);
1104 InstrCycles &MICycles = Cycles[
MI];
1105 MICycles.Height = Cycle;
1106 if (!TBI.HasValidInstrDepths) {
1111 TBI.CriticalPath = std::max(TBI.CriticalPath, Cycle + MICycles.Depth);
1112 DEBUG(
dbgs() << TBI.CriticalPath <<
'\t' << Cycle <<
'\t' << *MI);
1118 for (
unsigned i = 0, e = TBI.LiveIns.size(); i != e; ++i) {
1119 LiveInReg &LIR = TBI.LiveIns[i];
1120 const MachineInstr *DefMI = MTM.MRI->getVRegDef(LIR.Reg);
1121 LIR.Height = Heights.
lookup(DefMI);
1127 RI = RegUnits.
begin(), RE = RegUnits.
end(); RI != RE; ++RI) {
1128 TBI.LiveIns.push_back(LiveInReg(RI->RegUnit, RI->Cycle));
1130 <<
'@' << RI->Cycle);
1134 if (!TBI.HasValidInstrDepths)
1137 TBI.CriticalPath = std::max(TBI.CriticalPath,
1138 computeCrossBlockCriticalPath(TBI));
1139 DEBUG(
dbgs() <<
"Critical path: " << TBI.CriticalPath <<
'\n');
1147 computeInstrDepths(MBB);
1148 computeInstrHeights(MBB);
1154 assert(MI &&
"Not an instruction.");
1156 "MI must be in the trace center block");
1158 return getCriticalPath() - (Cyc.
Depth + Cyc.
Height);
1166 assert(Deps.
size() == 1 &&
"PHI doesn't have MBB as a predecessor");
1167 DataDep &Dep = Deps.
front();
1168 unsigned DepCycle = getInstrCycles(Dep.DefMI).Depth;
1170 if (!Dep.DefMI->isTransient())
1171 DepCycle += TE.MTM.SchedModel
1172 .computeOperandLatency(Dep.DefMI, Dep.DefOp, PHI, Dep.UseOp);
1183 for (
unsigned K = 0; K != PRDepths.
size(); ++K)
1184 PRMax = std::max(PRMax, PRDepths[K] + PRCycles[K]);
1186 for (
unsigned K = 0; K != PRDepths.
size(); ++K)
1187 PRMax = std::max(PRMax, PRDepths[K]);
1190 PRMax = TE.MTM.getCycles(PRMax);
1192 unsigned Instrs = TBI.InstrDepth;
1194 Instrs += TE.MTM.BlockInfo[
getBlockNum()].InstrCount;
1195 if (
unsigned IW = TE.MTM.SchedModel.getIssueWidth())
1198 return std::max(Instrs, PRMax);
1209 for (
unsigned K = 0; K != PRDepths.
size(); ++K) {
1210 unsigned PRCycles = PRDepths[K] + PRHeights[K];
1211 for (
unsigned I = 0;
I != Extrablocks.
size(); ++
I)
1212 PRCycles += TE.MTM.getProcResourceCycles(Extrablocks[
I]->getNumber())[K];
1213 for (
unsigned I = 0;
I != ExtraInstrs.
size(); ++
I) {
1218 PI = TE.MTM.SchedModel.getWriteProcResBegin(SC),
1219 PE = TE.MTM.SchedModel.getWriteProcResEnd(SC); PI != PE; ++PI) {
1220 if (PI->ProcResourceIdx != K)
1222 PRCycles += (PI->Cycles * TE.MTM.SchedModel.getResourceFactor(K));
1225 PRMax = std::max(PRMax, PRCycles);
1228 PRMax = TE.MTM.getCycles(PRMax);
1230 unsigned Instrs = TBI.InstrDepth + TBI.InstrHeight;
1231 for (
unsigned i = 0, e = Extrablocks.
size(); i != e; ++i)
1232 Instrs += TE.MTM.getResources(Extrablocks[i])->InstrCount;
1233 if (
unsigned IW = TE.MTM.SchedModel.getIssueWidth())
1236 return std::max(Instrs, PRMax);
1240 OS <<
getName() <<
" ensemble:\n";
1241 for (
unsigned i = 0, e = BlockInfo.size(); i != e; ++i) {
1242 OS <<
" BB#" << i <<
'\t';
1243 BlockInfo[i].print(OS);
1249 if (hasValidDepth()) {
1250 OS <<
"depth=" << InstrDepth;
1255 OS <<
" head=BB#" << Head;
1256 if (HasValidInstrDepths)
1259 OS <<
"depth invalid";
1261 if (hasValidHeight()) {
1262 OS <<
"height=" << InstrHeight;
1264 OS <<
" succ=BB#" << Succ->getNumber();
1267 OS <<
" tail=BB#" << Tail;
1268 if (HasValidInstrHeights)
1271 OS <<
"height invalid";
1272 if (HasValidInstrDepths && HasValidInstrHeights)
1273 OS <<
", crit=" << CriticalPath;
1277 unsigned MBBNum = &TBI - &TE.BlockInfo[0];
1279 OS << TE.getName() <<
" trace BB#" << TBI.Head <<
" --> BB#" << MBBNum
1280 <<
" --> BB#" << TBI.Tail <<
':';
1281 if (TBI.hasValidHeight() && TBI.hasValidDepth())
1282 OS <<
' ' << getInstrCount() <<
" instrs.";
1283 if (TBI.HasValidInstrDepths && TBI.HasValidInstrHeights)
1284 OS <<
' ' << TBI.CriticalPath <<
" cycles.";
1287 OS <<
"\nBB#" << MBBNum;
1290 OS <<
" <- BB#" << Num;
1291 Block = &TE.BlockInfo[Num];
1298 OS <<
" -> BB#" << Num;
1299 Block = &TE.BlockInfo[Num];
void print(raw_ostream &) const
void push_back(const T &Elt)
po_ext_iterator< T, SetType > po_ext_end(T G, SetType &S)
T * array_endof(T(&x)[N])
const MCSchedClassDesc * resolveSchedClass(const MachineInstr *MI) const
Return the MCSchedClassDesc for this instruction.
ArrayRef< unsigned > getProcResourceDepths(unsigned MBBNum) const
void print(raw_ostream &) const
void print(raw_ostream &) const
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
MachineBasicBlock * getMBB() const
const MachineBasicBlock * Pred
static bool isVirtualRegister(unsigned Reg)
bool HasCalls
True when the block contains calls.
void init(const MCSchedModel &sm, const TargetSubtargetInfo *sti, const TargetInstrInfo *tii)
Initialize the machine model for instruction scheduling.
void invalidateHeight()
Invalidate height resources when a block below this one has changed.
static std::string getBlockNum(MachineBasicBlock *BB)
Helper to print the number of a MBB.
unsigned getResourceFactor(unsigned ResIdx) const
Multiply the number of units consumed for a resource by this factor to normalize it relative to other...
machine trace Machine Trace false
po_iterator_storage(LoopBounds &lb)
BlockT * getHeader() const
LoopInfoBase< BlockT, LoopT > * LI
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
unsigned getNumBlockIDs() const
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
#define llvm_unreachable(msg)
const MachineLoop * getLoopFor(const MachineBasicBlock *) const
Strategy
Strategies for selecting traces.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
const_iterator end() const
bool atEnd() const
atEnd - return true if this iterator is equal to reg_end() on the value.
ID
LLVM Calling Convention Representation.
unsigned getNumOperands() const
format_object1< T > format(const char *Fmt, const T &Val)
Select the trace through a block that has the fewest instructions.
const TraceBlockInfo * getHeightResources(const MachineBasicBlock *) const
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
void verifyAnalysis() const
static bool getDataDeps(const MachineInstr *UseMI, SmallVectorImpl< DataDep > &Deps, const MachineRegisterInfo *MRI)
COFF::MachineTypes Machine
void finishPostorder(const MachineBasicBlock *)
size_t size() const
size - Get the array size.
iterator erase(iterator I)
const MachineBasicBlock * getParent() const
static unsigned updatePhysDepsUpwards(const MachineInstr *MI, unsigned Height, SparseSet< LiveRegUnit > &RegUnits, const TargetSchedModel &SchedModel, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
void invalidateDepth()
Invalidate depth resources when some block above this one has changed.
INITIALIZE_PASS_BEGIN(MachineTraceMetrics,"machine-trace-metrics","Machine Trace Metrics", false, true) INITIALIZE_PASS_END(MachineTraceMetrics
void invalidate(const MachineBasicBlock *MBB)
Invalidate traces through BadMBB.
* if(!EatIfPresent(lltok::kw_thread_local)) return false
Ensemble * getEnsemble(Strategy)
static void getPHIDeps(const MachineInstr *UseMI, SmallVectorImpl< DataDep > &Deps, const MachineBasicBlock *Pred, const MachineRegisterInfo *MRI)
bool insertEdge(const MachineBasicBlock *From, const MachineBasicBlock *To)
Ensemble(MachineTraceMetrics *)
MachineTraceMetrics & MTM
const MachineOperand & getOperand(unsigned i) const
const MachineBasicBlock * Succ
bool contains(const LoopT *L) const
Default po_iterator_storage implementation with an internal set object.
const FixedBlockInfo * getResources(const MachineBasicBlock *)
Get the fixed resource information about MBB. Compute it on demand.
void setUniverse(unsigned U)
bool empty() const
empty - Check if the array is empty.
unsigned getNumProcResourceKinds() const
Get the number of kinds of resources for this target.
succ_iterator succ_begin()
const TraceBlockInfo * getDepthResources(const MachineBasicBlock *) const
pred_iterator pred_begin()
const_iterator begin() const
ProcResIter getWriteProcResEnd(const MCSchedClassDesc *SC) const
std::vector< MachineBasicBlock * >::const_iterator const_pred_iterator
static void updatePhysDepsDownwards(const MachineInstr *UseMI, SmallVectorImpl< DataDep > &Deps, SparseSet< LiveRegUnit > &RegUnits, const TargetRegisterInfo *TRI)
ArrayRef< unsigned > getProcResourceHeights(unsigned MBBNum) const
bool hasInstrSchedModel() const
Return true if this machine model includes an instruction-level scheduling model. ...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
virtual const TargetInstrInfo * getInstrInfo() const
machine trace Machine Trace Metrics
const STC & getSubtarget() const
static bool pushDepHeight(const DataDep &Dep, const MachineInstr *UseMI, unsigned UseHeight, MIHeightMap &Heights, const TargetSchedModel &SchedModel, const TargetInstrInfo *TII)
bool hasValidDepth() const
bool erase(const KeyT &Val)
bool isSuccessor(const MachineBasicBlock *MBB) const
unsigned getOperandNo() const
bool runOnMachineFunction(MachineFunction &)
char & MachineTraceMetricsID
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
unsigned getResourceLength(ArrayRef< const MachineBasicBlock * > Extrablocks=None, ArrayRef< const MCSchedClassDesc * > ExtraInstrs=None) const
void invalidate(const MachineBasicBlock *MBB)
ipo_ext_iterator< T, SetType > ipo_ext_begin(T G, SetType &S)
unsigned Head
The block number of the head of the trace. (When hasValidDepth()).
def_iterator def_begin(unsigned RegNo) const
bool hasResources() const
Returns true when resource information for this block has been computed.
bundle_iterator< const MachineInstr, const_instr_iterator > const_iterator
void getAnalysisUsage(AnalysisUsage &) const
static bool isPhysicalRegister(unsigned Reg)
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
std::string getName(ID id, ArrayRef< Type * > Tys=None)
MachineRegisterInfo & getRegInfo()
ipo_ext_iterator< T, SetType > ipo_ext_end(T G, SetType &S)
virtual void getAnalysisUsage(AnalysisUsage &AU) const
iterator find(const KeyT &Key)
bool isCall(QueryType Type=AnyInBundle) const
po_ext_iterator< T, SetType > po_ext_begin(T G, SetType &S)
static bool isExitingLoop(const MachineLoop *From, const MachineLoop *To)
const TargetMachine & getTarget() const
virtual const TargetRegisterInfo * getRegisterInfo() const
bool hasValidHeight() const
unsigned computeOperandLatency(const MachineInstr *DefMI, unsigned DefOperIdx, const MachineInstr *UseMI, unsigned UseOperIdx) const
Compute operand latency based on the available machine model.
unsigned getReg() const
getReg - Returns the register number.
bool isValid() const
isValid - Returns true until all the operands have been visited.
unsigned getPHIDepth(const MachineInstr *PHI) const
std::vector< MachineBasicBlock * >::const_iterator const_succ_iterator
ValueT lookup(const KeyT &Val) const
unsigned getResourceDepth(bool Bottom) const
bool isPredecessor(const MachineBasicBlock *MBB) const
ArrayRef< unsigned > getProcResourceCycles(unsigned MBBNum) const
const MCRegisterInfo & MRI
ProcResIter getWriteProcResBegin(const MCSchedClassDesc *SC) const
iterator find(const KeyT &Val)
tier< T1, T2 > tie(T1 &f, T2 &s)
DenseMap< const MachineInstr *, unsigned > MIHeightMap
Trace getTrace(const MachineBasicBlock *MBB)
unsigned getInstrSlack(const MachineInstr *MI) const