35template <
bool IsPostDom>
68 while (!LiveInBlockWorklist.
empty()) {
73 if (!LiveInBlocks.
insert(BB).second)
94 MRI.createVirtualRegister(RegAttrs));
101 BBValueInfo *BBInfo = &BBInfos[BB];
110 MachineBasicBlock *DomBB = BB, *TopDomBB = BB;
113 while (DT.isReachableFromEntry(DomBB) && !DomBB->
pred_empty() &&
114 (DomBB = DT.getNode(DomBB)->getIDom()->getBlock())) {
115 BBInfo = &BBInfos[DomBB];
129 V = createInst(TargetOpcode::IMPLICIT_DEF, TopDomBB,
130 TopDomBB->getFirstNonPHI())
134 for (BBValueInfo *BBInfo : DomPath) {
150 for (
auto [BB, V] : Defines)
163 BBInfos.reserve(LiveInBlocks.
size() + DefBlocks.
size());
165 for (
auto [BB, V] : Defines)
166 BBInfos[BB].LiveOutValue = V;
170 createInst(TargetOpcode::PHI, FrontierBB, FrontierBB->begin())
172 BBInfos[FrontierBB].LiveInValue = NewVR;
185 return computeValue(BB,
false);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the DenseMap class.
static void computeLiveInBlocks(const SmallPtrSetImpl< MachineBasicBlock * > &UsingBlocks, const SmallPtrSetImpl< MachineBasicBlock * > &DefBlocks, SmallPtrSetImpl< MachineBasicBlock * > &LiveInBlocks)
Given sets of UsingBlocks and DefBlocks, compute the set of LiveInBlocks.
Promote Memory to Register
Core dominator tree base class.
Determine the iterated dominance frontier, given a set of defining blocks, and optionally,...
void calculate(SmallVectorImpl< NodeTy * > &IDFBlocks)
Calculate iterated dominance frontiers.
void setLiveInBlocks(const SmallPtrSetImpl< NodeTy * > &Blocks)
Give the IDF calculator the set of blocks in which the value is live on entry to the block.
void setDefiningBlocks(const SmallPtrSetImpl< NodeTy * > &Blocks)
Give the IDF calculator the set of blocks in which the value is defined.
IDFCalculatorDetail::ChildrenGetterTy< NodeTy, IsPostDom > ChildrenGetterTy
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
iterator_range< pred_iterator > predecessors()
MachineInstrBundleIterator< MachineInstr > iterator
typename llvm::IDFCalculatorBase< MachineBasicBlock, IsPostDom > IDFCalculatorBase
typename IDFCalculatorBase::ChildrenGetterTy ChildrenGetterTy
MachineIDFCalculator(DominatorTreeBase< MachineBasicBlock, IsPostDom > &DT)
Register getValueInMiddleOfBlock(MachineBasicBlock *BB)
See SSAUpdater::GetValueInMiddleOfBlock description.
void calculate()
Calculate and insert necessary PHI nodes for SSA form.
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
Wrapper class representing virtual and physical registers.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
reference emplace_back(ArgTypes &&... Args)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
MachineIDFCalculator< false > MachineForwardIDFCalculator
MachineIDFCalculator< true > MachineReverseIDFCalculator
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...