[MachineCombine] add a hook for resource length limit

This commit is contained in:
Chen Zheng 2020-05-26 22:39:37 -04:00
parent 3101601b54
commit 2a24d350db
2 changed files with 7 additions and 2 deletions

View File

@ -1093,6 +1093,9 @@ public:
SmallVectorImpl<MachineInstr *> &DelInstrs,
DenseMap<unsigned, unsigned> &InstrIdxForVirtReg) const;
/// The limit on resource length extension we accept in MachineCombiner Pass.
virtual int getExtendResourceLenLimit() const { return 0; }
/// This is an architecture-specific helper function of reassociateOps.
/// Set special operand attributes for new instructions after reassociation.
virtual void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2,

View File

@ -406,12 +406,14 @@ bool MachineCombiner::preservesResourceLen(
<< ResLenBeforeCombine
<< " and after: " << ResLenAfterCombine << "\n";);
LLVM_DEBUG(
ResLenAfterCombine <= ResLenBeforeCombine
ResLenAfterCombine <=
ResLenBeforeCombine + TII->getExtendResourceLenLimit()
? dbgs() << "\t\t As result it IMPROVES/PRESERVES Resource Length\n"
: dbgs() << "\t\t As result it DOES NOT improve/preserve Resource "
"Length\n");
return ResLenAfterCombine <= ResLenBeforeCombine;
return ResLenAfterCombine <=
ResLenBeforeCombine + TII->getExtendResourceLenLimit();
}
/// \returns true when new instruction sequence should be generated