34template <
bool IsPostDom>
67 while (!LiveInBlockWorklist.
empty()) {
72 if (!LiveInBlocks.
insert(BB).second)
93 MRI.createVirtualRegister(RegAttrs));
100 BBValueInfo *BBInfo = &BBInfos[BB];
109 MachineBasicBlock *DomBB = BB, *TopDomBB = BB;
112 while (DT.isReachableFromEntry(DomBB) && !DomBB->
pred_empty() &&
113 (DomBB = DT.getNode(DomBB)->getIDom()->getBlock())) {
114 BBInfo = &BBInfos[DomBB];
128 V = createInst(TargetOpcode::IMPLICIT_DEF, TopDomBB,
129 TopDomBB->getFirstNonPHI())
133 for (BBValueInfo *BBInfo : DomPath) {
149 for (
auto [BB, V] : Defines)
162 BBInfos.reserve(LiveInBlocks.
size() + DefBlocks.
size());
164 for (
auto [BB, V] : Defines)
165 BBInfos[BB].LiveOutValue = V;
169 createInst(TargetOpcode::PHI, FrontierBB, FrontierBB->begin())
171 BBInfos[FrontierBB].LiveInValue = NewVR;
184 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)
LLVM_ABI Register getValueInMiddleOfBlock(MachineBasicBlock *BB)
See SSAUpdater::GetValueInMiddleOfBlock description.
LLVM_ABI 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...