59 #define DEBUG_TYPE "machine-sink" 63 cl::desc(
"Split critical edges during machine sinking"),
68 cl::desc(
"Use block frequency info to find successors to sink"),
72 "machine-sink-split-probability-threshold",
74 "Percentage threshold for splitting single-instruction critical edge. " 75 "If the branch threshold is higher than this threshold, we allow " 76 "speculative execution of up to 1 instruction to avoid branching to " 77 "splitted critical edge"),
80 STATISTIC(NumSunk,
"Number of machine instructions sunk");
81 STATISTIC(NumSplit,
"Number of critical edges split");
82 STATISTIC(NumCoalesces,
"Number of copies coalesced");
83 STATISTIC(NumPostRACopySink,
"Number of copies sunk after RA");
108 using AllSuccsCache =
109 std::map<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;
151 void releaseMemory()
override {
152 CEBCandidates.
clear();
179 AllSuccsCache &AllSuccessors);
189 bool &BreakPHIEdge,
bool &LocalUse)
const;
191 bool &BreakPHIEdge, AllSuccsCache &AllSuccessors);
195 AllSuccsCache &AllSuccessors);
202 AllSuccsCache &AllSuccessors)
const;
212 "Machine code sinking",
false,
false)
220 bool MachineSinking::PerformTrivialForwardCoalescing(
MachineInstr &
MI,
225 Register SrcReg = MI.getOperand(1).getReg();
226 Register DstReg = MI.getOperand(0).getReg();
242 MI.eraseFromParent();
261 bool &LocalUse)
const {
286 unsigned OpNo = &MO - &UseInst->
getOperand(0);
288 if (!(UseBlock == MBB && UseInst->
isPHI() &&
290 BreakPHIEdge =
false;
300 unsigned OpNo = &MO - &UseInst->
getOperand(0);
302 if (UseInst->
isPHI()) {
306 }
else if (UseBlock == DefMBB) {
328 DT = &getAnalysis<MachineDominatorTree>();
329 PDT = &getAnalysis<MachinePostDominatorTree>();
330 LI = &getAnalysis<MachineLoopInfo>();
331 MBFI =
UseBlockFreqInfo ? &getAnalysis<MachineBlockFrequencyInfo>() :
nullptr;
332 MBPI = &getAnalysis<MachineBranchProbabilityInfo>();
333 AA = &getAnalysis<AAResultsWrapperPass>().getAAResults();
335 bool EverMadeChange =
false;
338 bool MadeChange =
false;
341 CEBCandidates.
clear();
347 for (
auto &Pair : ToSplit) {
348 auto NewSucc = Pair.first->SplitCriticalEdge(Pair.second, *
this);
349 if (NewSucc !=
nullptr) {
360 if (!MadeChange)
break;
361 EverMadeChange =
true;
365 for (
auto I : RegsToClearKillFlags)
367 RegsToClearKillFlags.clear();
369 return EverMadeChange;
381 bool MadeChange =
false;
384 AllSuccsCache AllSuccessors;
389 bool ProcessedBegin, SawStore =
false;
395 ProcessedBegin = I == MBB.
begin();
405 bool Joined = PerformTrivialForwardCoalescing(MI, &MBB);
417 }
while (!ProcessedBegin);
419 SeenDbgUsers.
clear();
432 bool SeenBefore = SeenDbgVars.
count(Var) != 0;
436 SeenDbgUsers[MO.
getReg()].push_back(SeenDbgUser(&MI, SeenBefore));
442 bool MachineSinking::isWorthBreakingCriticalEdge(
MachineInstr &MI,
450 if (!CEBCandidates.
insert(std::make_pair(From, To)).second)
493 bool MachineSinking::PostponeSplitCriticalEdge(
MachineInstr &MI,
497 if (!isWorthBreakingCriticalEdge(MI, FromBB, ToBB))
558 ToSplit.
insert(std::make_pair(FromBB, ToBB));
564 bool MachineSinking::isProfitableToSinkTo(
unsigned Reg,
MachineInstr &MI,
567 AllSuccsCache &AllSuccessors) {
568 assert (SuccToSinkTo &&
"Invalid SinkTo Candidate BB");
570 if (MBB == SuccToSinkTo)
583 bool NonPHIUse =
false;
586 if (UseBlock == SuccToSinkTo && !UseInst.isPHI())
594 bool BreakPHIEdge =
false;
597 FindSuccToSinkTo(MI, SuccToSinkTo, BreakPHIEdge, AllSuccessors))
598 return isProfitableToSinkTo(Reg, MI, SuccToSinkTo, MBB2, AllSuccessors);
609 AllSuccsCache &AllSuccessors)
const {
611 auto Succs = AllSuccessors.find(MBB);
612 if (Succs != AllSuccessors.end())
613 return Succs->second;
625 const std::vector<MachineDomTreeNode *> &Children =
627 for (
const auto &DTChild : Children)
629 if (DTChild->getIDom()->getBlock() == MI.
getParent() &&
632 AllSuccs.push_back(DTChild->getBlock());
639 bool HasBlockFreq = LHSFreq != 0 && RHSFreq != 0;
640 return HasBlockFreq ? LHSFreq < RHSFreq
644 auto it = AllSuccessors.insert(std::make_pair(MBB, AllSuccs));
646 return it.first->second;
653 AllSuccsCache &AllSuccessors) {
654 assert (MBB &&
"Invalid MachineBasicBlock!");
664 if (!MO.
isReg())
continue;
667 if (Reg == 0)
continue;
676 }
else if (!MO.
isDead()) {
682 if (MO.
isUse())
continue;
693 bool LocalUse =
false;
695 BreakPHIEdge, LocalUse))
706 GetAllSortedSuccessors(MI, MBB, AllSuccessors)) {
707 bool LocalUse =
false;
709 BreakPHIEdge, LocalUse)) {
710 SuccToSinkTo = SuccBlock;
721 if (!isProfitableToSinkTo(Reg, MI, MBB, SuccToSinkTo, AllSuccessors))
728 if (MBB == SuccToSinkTo)
733 if (SuccToSinkTo && SuccToSinkTo->
isEHPad())
756 auto *PredBB = PredMBB->getBasicBlock();
762 !PredBB->getTerminator()->getMetadata(LLVMContext::MD_make_implicit))
770 if (!BaseOp->
isReg())
776 MachineBranchPredicate MBP;
780 return MBP.LHS.isReg() && MBP.RHS.isImm() && MBP.RHS.getImm() == 0 &&
783 MBP.LHS.getReg() == BaseOp->
getReg();
803 SrcMO = CopyOperands->Source;
804 DstMO = CopyOperands->Destination;
816 if (arePhysRegs != PostRA)
822 DbgMO.
getSubReg() != DstMO->getSubReg()))
828 if (PostRA && DbgMO.
getReg() != DstMO->getReg())
844 if (!SuccToSinkTo.
empty() && InsertPos != SuccToSinkTo.
end())
846 InsertPos->getDebugLoc()));
852 SuccToSinkTo.
splice(InsertPos, ParentBlock, MI,
860 DBE = DbgValuesToSink.
end();
864 SuccToSinkTo.
insert(InsertPos, NewDbgMI);
874 AllSuccsCache &AllSuccessors) {
901 bool BreakPHIEdge =
false;
904 FindSuccToSinkTo(MI, ParentBlock, BreakPHIEdge, AllSuccessors);
915 if (!MO.
isReg())
continue;
923 LLVM_DEBUG(
dbgs() <<
"Sink instr " << MI <<
"\tinto block " << *SuccToSinkTo);
930 bool TryBreak =
false;
933 LLVM_DEBUG(
dbgs() <<
" *** NOTE: Won't sink load along critical edge.\n");
939 if (!TryBreak && !DT->
dominates(ParentBlock, SuccToSinkTo)) {
958 PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge);
961 "break critical edge\n");
971 bool Status = PostponeSplitCriticalEdge(MI, ParentBlock,
972 SuccToSinkTo, BreakPHIEdge);
975 "break critical edge\n");
982 while (InsertPos != SuccToSinkTo->
end() && InsertPos->isPHI())
988 if (!MO.isReg() || !MO.isDef() || !MO.getReg().isVirtual())
990 if (!SeenDbgUsers.
count(MO.getReg()))
994 auto &
Users = SeenDbgUsers[MO.getReg()];
1012 SalvageUnsunkDebugUsersOfCopy(MI, SuccToSinkTo);
1014 performSink(MI, *SuccToSinkTo, InsertPos, DbgUsersToSink);
1022 if (MO.isReg() && MO.isUse())
1023 RegsToClearKillFlags.
set(MO.getReg());
1029 void MachineSinking::SalvageUnsunkDebugUsersOfCopy(
1040 if (!MO.isReg() || !MO.isDef() || !MO.getReg().isVirtual())
1051 "DBG_VALUE user of vreg, but non reg operand?");
1052 DbgDefUsers.push_back(&
User);
1058 for (
auto *
User : DbgDefUsers) {
1106 StringRef getPassName()
const override {
return "PostRA Machine Sink"; }
1137 "PostRA Machine Sink",
false,
false)
1152 for (
auto *
SI : SinkableBBs) {
1153 if (aliasWithRegsInLiveIn(*
SI, Reg, TRI)) {
1167 if (!SinkableBBs.count(
SI) && aliasWithRegsInLiveIn(*
SI, Reg, TRI))
1179 for (
auto DefReg : DefedRegsInCopy) {
1182 if (!BB || (SingleBB && SingleBB != BB))
1193 for (
auto U : UsedOpsInCopy) {
1199 if (UI.killsRegister(SrcReg, TRI)) {
1200 UI.clearRegisterKills(SrcReg, TRI);
1214 for (
unsigned DefReg : DefedRegsInCopy)
1217 for (
auto U : UsedOpsInCopy) {
1221 Mask |= (*S).second;
1233 bool HasRegDependency =
false;
1243 HasRegDependency =
true;
1252 }
else if (MO.
isUse()) {
1254 HasRegDependency =
true;
1260 return HasRegDependency;
1280 if (!
SI->livein_empty() &&
SI->pred_size() == 1)
1283 if (SinkableBBs.
empty())
1286 bool Changed =
false;
1290 ModifiedRegUnits.clear();
1291 UsedRegUnits.clear();
1292 SeenDbgInstrs.clear();
1311 ModifiedRegUnits, UsedRegUnits))
1316 for (
unsigned Reg : Units)
1317 SeenDbgInstrs[
Reg].push_back(MI);
1337 ModifiedRegUnits, UsedRegUnits)) {
1343 "Unexpect SrcReg or DefReg");
1354 "Unexpected predecessor");
1362 if (!MO.isReg() || !MO.isDef())
1366 for (
unsigned Reg : Units)
1367 for (
auto *MI : SeenDbgInstrs.lookup(Reg))
1368 DbgValsToSinkSet.
insert(MI);
1371 DbgValsToSinkSet.
end());
1377 performSink(*MI, *SuccBB, InsertPos, DbgValsToSink);
1378 updateLiveIn(MI, SuccBB, UsedOpsInCopy, DefedRegsInCopy);
1381 ++NumPostRACopySink;
1386 bool PostRAMachineSinking::runOnMachineFunction(
MachineFunction &MF) {
1390 bool Changed =
false;
1394 ModifiedRegUnits.init(*TRI);
1395 UsedRegUnits.init(*TRI);
1397 Changed |= tryToSinkCopy(BB, MF, TRI, TII);
INITIALIZE_PASS_BEGIN(MachineSinking, DEBUG_TYPE, "Machine code sinking", false, false) INITIALIZE_PASS_END(MachineSinking
Optional< DestSourcePair > isCopyInstr(const MachineInstr &MI) const
If the specific machine instruction is a instruction that moves/copies value from one register to ano...
static void clearKillFlags(MachineInstr *MI, MachineBasicBlock &CurBB, SmallVectorImpl< unsigned > &UsedOpsInCopy, LiveRegUnits &UsedRegUnits, const TargetRegisterInfo *TRI)
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
bool use_nodbg_empty(unsigned RegNo) const
use_nodbg_empty - Return true if there are no non-Debug instructions using the specified register...
static bool AllUsesDominatedByBlock(Instruction *Inst, BasicBlock *BB, DominatorTree &DT)
AllUsesDominatedByBlock - Return true if all uses of the specified value occur in blocks dominated by...
bool isCall(QueryType Type=AnyInBundle) const
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
MachineDomTreeNode * getNode(MachineBasicBlock *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
MachineBasicBlock * getMBB() const
virtual bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const
Return true if it's safe to move a machine instruction that defines the specified register class...
const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
This class represents lattice values for constants.
static const DILocation * getMergedLocation(const DILocation *LocA, const DILocation *LocB)
When two instructions are combined into a single instruction we also need to combine the original loc...
static void accumulateUsedDefed(const MachineInstr &MI, LiveRegUnits &ModifiedRegUnits, LiveRegUnits &UsedRegUnits, const TargetRegisterInfo *TRI)
For a machine instruction MI, adds all register units used in UsedRegUnits and defined or clobbered i...
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
Implements a dense probed hash-table based set.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
iterator_range< use_nodbg_iterator > use_nodbg_operands(unsigned Reg) const
unsigned getSubReg() const
bool isPredicable(QueryType Type=AllInBundle) const
Return true if this instruction has a predicate operand that controls execution.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
unsigned getLoopDepth(const MachineBasicBlock *BB) const
Return the loop nesting level of the specified block.
STATISTIC(NumFunctions, "Total number of functions")
unsigned const TargetRegisterInfo * TRI
iv Induction Variable Users
iterator_range< mop_iterator > operands()
bool isCopyLike() const
Return true if the instruction behaves like a copy.
iterator end()
Get an iterator to the end of the SetVector.
void removeLiveIn(MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll())
Remove the specified register from the live in set.
Represents a predicate at the MachineFunction level.
const TargetRegisterClass * getRegClass(Register Reg) const
Return the register class of the specified virtual register.
iterator_range< succ_iterator > successors()
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Identifies a unique instance of a variable.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
bool isValid() const
Returns true if this iterator is not yet at the end.
MCRegUnitMaskIterator enumerates a list of register units and their associated lane masks for Reg...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
unsigned getNumOperands() const
Retuns the total number of operands.
static constexpr LaneBitmask getAll()
MachineInstr * getVRegDef(unsigned Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
void addLiveIns(const MachineBasicBlock &MBB)
Adds registers living into block MBB.
bool insert(const value_type &X)
Insert a new element into the SetVector.
void clearKillFlags(unsigned Reg) const
clearKillFlags - Iterate over all the uses of the given register and clear the kill flag from the Mac...
bool available(MCPhysReg Reg) const
Returns true if no part of physical register Reg is live.
iterator begin()
Get an iterator to the beginning of the SetVector.
const std::vector< DomTreeNodeBase * > & getChildren() const
bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
COFF::MachineTypes Machine
void setReg(Register Reg)
Change the register this operand corresponds to.
virtual const TargetInstrInfo * getInstrInfo() const
static bool ProcessBlock(BasicBlock &BB, DominatorTree &DT, LoopInfo &LI, AAResults &AA)
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
reverse_iterator rbegin()
Value * getOperand(unsigned i) const
TargetInstrInfo - Interface to description of machine instruction set.
void addLiveIn(MCRegister PhysReg, LaneBitmask LaneMask=LaneBitmask::getAll())
Adds the specified register as a live in.
initializer< Ty > init(const Ty &Val)
unsigned const MachineRegisterInfo * MRI
INITIALIZE_PASS(PostRAMachineSinking, "postra-machine-sink", "PostRA Machine Sink", false, false) static bool aliasWithRegsInLiveIn(MachineBasicBlock &MBB
PointerIntPair - This class implements a pair of a pointer and small integer.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
DISubprogram * getSubprogram() const
Get the attached subprogram.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
LLVM_NODISCARD bool empty() const
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
char & PostRAMachineSinkingID
This pass perform post-ra machine sink for COPY instructions.
std::pair< iterator, bool > insert(const ValueT &V)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
Represent the analysis usage information of a pass.
static bool SinkInstruction(Instruction *Inst, SmallPtrSetImpl< Instruction *> &Stores, DominatorTree &DT, LoopInfo &LI, AAResults &AA)
SinkInstruction - Determine whether it is safe to sink the specified machine instruction out of its c...
self_iterator getIterator()
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
static cl::opt< unsigned > SplitEdgeProbabilityThreshold("machine-sink-split-probability-threshold", cl::desc("Percentage threshold for splitting single-instruction critical edge. " "If the branch threshold is higher than this threshold, we allow " "speculative execution of up to 1 instruction to avoid branching to " "splitted critical edge"), cl::init(40), cl::Hidden)
virtual bool shouldSink(const MachineInstr &MI) const
Return true if the instruction should be sunk by MachineSink.
std::vector< MachineBasicBlock * >::iterator pred_iterator
unsigned getNumVirtRegs() const
getNumVirtRegs - Return the number of virtual registers created.
succ_iterator succ_begin()
bool isConvergent(QueryType Type=AnyInBundle) const
Return true if this instruction is convergent.
static bool SinkingPreventsImplicitNullCheck(MachineInstr &MI, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI)
Return true if MI is likely to be usable as a memory operation by the implicit null check optimizatio...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
MCSubRegIterator enumerates all sub-registers of Reg.
pred_iterator pred_begin()
bool isDebugInstr() const
static void performSink(MachineInstr &MI, MachineBasicBlock &SuccToSinkTo, MachineBasicBlock::iterator InsertPos, SmallVectorImpl< MachineInstr *> &DbgValuesToSink)
Sink an instruction and its associated debug instructions.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
bool isConstantPhysReg(unsigned PhysReg) const
Returns true if PhysReg is unallocatable and constant throughout the function.
const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
void setIsKill(bool Val=true)
virtual bool isAsCheapAsAMove(const MachineInstr &MI) const
Return true if the instruction is as cheap as a move instruction.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
virtual bool getMemOperandWithOffset(const MachineInstr &MI, const MachineOperand *&BaseOp, int64_t &Offset, const TargetRegisterInfo *TRI) const
Get the base operand and byte offset of an instruction that reads/writes memory.
static cl::opt< bool > UseBlockFreqInfo("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
BlockVerifier::State From
MachineInstr * CloneMachineInstr(const MachineInstr *Orig)
Create a new MachineInstr which is a copy of Orig, identical in all ways except the instruction has n...
bool isDebugValue() const
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
char & MachineSinkingID
MachineSinking - This pass performs sinking on machine instructions.
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
MachineInstrBuilder MachineInstrBuilder & DefMI
static SmallSet< unsigned, 4 > getRegUnits(unsigned Reg, const TargetRegisterInfo *TRI)
void setPreservesCFG()
This function should be called by the pass, iff they do not:
void sortUniqueLiveIns()
Sorts and uniques the LiveIns vector.
unsigned pred_size() const
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isLiveIn(MCPhysReg Reg, LaneBitmask LaneMask=LaneBitmask::getAll()) const
Return true if the specified register is in the live in set.
void clear()
Completely clear the SetVector.
void setDebugLoc(DebugLoc dl)
Replace current source information with new such.
bool isValid() const
isValid - returns true if this iterator is not yet at the end.
static bool attemptDebugCopyProp(MachineInstr &SinkInst, MachineInstr &DbgMI)
If the sunk instruction is a copy, try to forward the copy instead of leaving an 'undef' DBG_VALUE in...
bool isRenamable() const
isRenamable - Returns true if this register may be renamed, i.e.
iterator insert(iterator I, T &&Elt)
void replaceRegWith(unsigned FromReg, unsigned ToReg)
replaceRegWith - Replace all instances of FromReg with ToReg in the machine function.
unsigned succ_size() const
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
MachineFunctionProperties & set(Property P)
static MachineBasicBlock * getSingleLiveInSuccBB(MachineBasicBlock &CurBB, const SmallPtrSetImpl< MachineBasicBlock *> &SinkableBBs, unsigned Reg, const TargetRegisterInfo *TRI)
BranchProbability getEdgeProbability(const MachineBasicBlock *Src, const MachineBasicBlock *Dst) const
Representation of each machine instruction.
static void updateLiveIn(MachineInstr *MI, MachineBasicBlock *SuccBB, SmallVectorImpl< unsigned > &UsedOpsInCopy, SmallVectorImpl< unsigned > &DefedRegsInCopy)
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
virtual bool analyzeBranchPredicate(MachineBasicBlock &MBB, MachineBranchPredicate &MBP, bool AllowModify=false) const
Analyze the branching code at the end of MBB and parse it into the MachineBranchPredicate structure i...
bool isEHPad() const
Returns true if the block is a landing pad.
LLVM_NODISCARD bool empty() const
constexpr bool any() const
void initializeMachineSinkingPass(PassRegistry &)
void setSubReg(unsigned subReg)
iterator getFirstNonPHI()
Returns a pointer to the first instruction in this block that is not a PHINode instruction.
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
bool hasOneNonDBGUse(unsigned RegNo) const
hasOneNonDBGUse - Return true if there is exactly one non-Debug use of the specified register...
A set of register units used to track register liveness.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
iterator_range< use_instr_iterator > use_instructions(unsigned Reg) const
bool isReachableFromEntry(const MachineBasicBlock *A)
isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it...
static bool hasRegisterDependency(MachineInstr *MI, SmallVectorImpl< unsigned > &UsedOpsInCopy, SmallVectorImpl< unsigned > &DefedRegsInCopy, LiveRegUnits &ModifiedRegUnits, LiveRegUnits &UsedRegUnits)
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static cl::opt< bool > SplitEdges("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden)
bool isSafeToMove(AAResults *AA, bool &SawStore) const
Return true if it is safe to move this instruction.
void stable_sort(R &&Range)
MachinePostDominatorTree - an analysis pass wrapper for DominatorTree used to compute the post-domina...
bool isLoopHeader(const MachineBasicBlock *BB) const
True if the block is a loop header node.
A vector that has set insertion semantics.
MachineLoop * getLoopFor(const MachineBasicBlock *BB) const
Return the innermost loop that BB lives in.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
std::underlying_type< E >::type Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
StringRef - Represent a constant reference to a string, i.e.
Register getReg() const
getReg - Returns the register number.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
const MachineOperand & getOperand(unsigned i) const
iterator_range< use_instr_nodbg_iterator > use_nodbg_instructions(unsigned Reg) const
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Properties which a MachineFunction may have at a given point in time.
Wrapper class representing virtual and physical registers.