47#define DEBUG_TYPE "tailduplication"
50STATISTIC(NumTailDups,
"Number of tail duplicated blocks");
52 "Number of instructions added due to tail duplication");
54 "Number of instructions removed due to tail duplication");
55STATISTIC(NumDeadBlocks,
"Number of dead blocks removed");
65 "tail-dup-indirect-size",
66 cl::desc(
"Maximum instructions to consider tail duplicating blocks that "
67 "end with indirect branches."),
cl::init(20),
72 cl::desc(
"Maximum predecessors (maximum successors at the "
73 "same time) to consider tail duplicating blocks."),
78 cl::desc(
"Maximum successors (maximum predecessors at the "
79 "same time) to consider tail duplicating blocks."),
84 cl::desc(
"Verify sanity of PHI instructions during taildup"),
94 bool LayoutModeIn,
unsigned TailDupSizeIn) {
98 MRI = &MF->getRegInfo();
102 TailDupSize = TailDupSizeIn;
104 assert(MBPI !=
nullptr &&
"Machine Branch Probability Info required");
106 LayoutMode = LayoutModeIn;
107 this->PreRegAlloc = PreRegAlloc;
115 while (
MI !=
MBB.end()) {
120 for (
unsigned i = 1, e =
MI->getNumOperands(); i != e; i += 2) {
122 if (PHIBB == PredBB) {
130 dbgs() <<
" missing input from predecessor "
136 for (
unsigned i = 1, e =
MI->getNumOperands(); i != e; i += 2) {
138 if (CheckExtra && !Preds.count(PHIBB)) {
141 dbgs() <<
" extra input from predecessor "
177 if (!tailDuplicate(IsSimple,
MBB, ForcedLayoutPred,
178 TDBBs,
Copies, CandidatePtr))
189 bool isDead =
MBB->pred_empty() && !
MBB->hasAddressTaken();
191 updateSuccessorsPHIs(
MBB,
isDead, TDBBs, Succs);
195 NumTailDupRemoved +=
MBB->size();
196 removeDeadBlock(
MBB, RemovalCallback);
201 if (!SSAUpdateVRs.empty()) {
202 for (
Register VReg : SSAUpdateVRs) {
210 DefBB =
DefMI->getParent();
215 auto LI = SSAUpdateVals.find(VReg);
216 for (std::pair<MachineBasicBlock *, Register> &J : LI->second) {
231 if (
UseMI->isDebugValue()) {
235 if (
UseMI->getParent() == DefBB && !
UseMI->isPHI())
239 for (
auto *UseMO : DebugUses) {
246 SSAUpdateVRs.clear();
247 SSAUpdateVals.clear();
255 Register Dst = Copy->getOperand(0).getReg();
256 Register Src = Copy->getOperand(1).getReg();
257 if (MRI->hasOneNonDBGUse(Src) &&
258 MRI->constrainRegClass(Src, MRI->getRegClass(Dst))) {
260 MRI->replaceRegWith(Dst, Src);
261 Copy->eraseFromParent();
266 NumAddedPHIs += NewPHIs.
size();
269 *DuplicatedPreds = std::move(TDBBs);
278 bool MadeChange =
false;
307 if (
UseMI.isDebugValue())
309 if (
UseMI.getParent() != BB)
316 for (
unsigned i = 1, e =
MI->getNumOperands(); i != e; i += 2)
317 if (
MI->getOperand(i + 1).getMBB() == SrcBB)
327 for (
const auto &
MI : BB) {
330 for (
unsigned i = 1, e =
MI.getNumOperands(); i != e; i += 2) {
332 UsedByPhi->
insert(SrcReg);
340 auto LI = SSAUpdateVals.find(OrigReg);
341 if (LI != SSAUpdateVals.end())
342 LI->second.push_back(std::make_pair(BB, NewReg));
344 AvailableValsTy Vals;
345 Vals.push_back(std::make_pair(BB, NewReg));
346 SSAUpdateVals.
insert(std::make_pair(OrigReg, Vals));
347 SSAUpdateVRs.push_back(OrigReg);
353void TailDuplicator::processPHI(
360 assert(SrcOpIdx &&
"Unable to find matching PHI source?");
361 Register SrcReg =
MI->getOperand(SrcOpIdx).getReg();
362 unsigned SrcSubReg =
MI->getOperand(SrcOpIdx).getSubReg();
363 const TargetRegisterClass *RC = MRI->getRegClass(DefReg);
368 Register NewDef = MRI->createVirtualRegister(RC);
374 MI->getOperand(SrcOpIdx).setReg(NewDef);
375 MI->getOperand(SrcOpIdx).setSubReg(0);
379 addSSAUpdateEntry(DefReg, NewDef, PredBB);
381 MI->removePHIIncomingValueFor(*PredBB);
384 MI->eraseFromParent();
385 else if (
MI->getNumOperands() == 1)
386 MI->setDesc(TII->get(TargetOpcode::IMPLICIT_DEF));
391void TailDuplicator::duplicateInstruction(
396 if (
MI->isCFIInstruction()) {
398 TII->
get(TargetOpcode::CFI_INSTRUCTION))
403 MachineInstr &NewMI = TII->duplicate(*PredBB, PredBB->
end(), *
MI);
414 const TargetRegisterClass *RC = MRI->getRegClass(
Reg);
415 Register NewReg = MRI->createVirtualRegister(RC);
419 addSSAUpdateEntry(
Reg, NewReg, PredBB);
423 if (VI == LocalVRMap.
end())
428 auto *OrigRC = MRI->getRegClass(
Reg);
429 auto *MappedRC = MRI->getRegClass(
VI->second.Reg);
430 const TargetRegisterClass *ConstrRC;
431 if (
VI->second.SubReg != 0) {
433 TRI->getMatchingSuperRegClass(MappedRC, OrigRC,
VI->second.SubReg);
438 MRI->setRegClass(
VI->second.Reg, ConstrRC);
449 : MRI->constrainRegClass(
VI->second.Reg, OrigRC);
459 TRI->composeSubRegIndices(
VI->second.SubReg, MO.
getSubReg()));
464 Register NewReg = MRI->createVirtualRegister(OrigRC);
467 .
addReg(
VI->second.Reg, {},
VI->second.SubReg);
468 LocalVRMap.
erase(VI);
485void TailDuplicator::updateSuccessorsPHIs(
489 for (MachineBasicBlock *SuccBB : Succs) {
490 for (MachineInstr &
MI : *SuccBB) {
495 for (
unsigned i = 1, e =
MI.getNumOperands(); i != e; i += 2) {
496 MachineOperand &MO =
MI.getOperand(i + 1);
497 if (MO.
getMBB() == FromBB) {
504 MachineOperand &MO0 =
MI.getOperand(Idx);
510 for (
unsigned i =
MI.getNumOperands() - 2; i != Idx; i -= 2) {
511 MachineOperand &MO =
MI.getOperand(i + 1);
512 if (MO.
getMBB() == FromBB) {
513 MI.removeOperand(i + 1);
523 auto LI = SSAUpdateVals.find(
Reg);
524 if (LI != SSAUpdateVals.end()) {
526 for (
const std::pair<MachineBasicBlock *, Register> &J : LI->second) {
527 MachineBasicBlock *SrcBB = J.first;
537 MI.getOperand(Idx).setReg(SrcReg);
538 MI.getOperand(Idx + 1).setMBB(SrcBB);
541 MIB.addReg(SrcReg).addMBB(SrcBB);
546 for (MachineBasicBlock *SrcBB : TDBBs) {
548 MI.getOperand(Idx).setReg(
Reg);
549 MI.getOperand(Idx + 1).setMBB(SrcBB);
552 MIB.addReg(
Reg).addMBB(SrcBB);
557 MI.removeOperand(Idx + 1);
558 MI.removeOperand(Idx);
580 unsigned MaxDuplicateCount;
581 if (TailDupSize == 0)
584 MaxDuplicateCount = TailDupSize;
586 MaxDuplicateCount = 1;
594 if (TII->analyzeBranch(TailBB, PredTBB, PredFBB, PredCond) &&
604 bool HasIndirectbr =
false;
605 bool HasComputedGoto =
false;
606 if (!TailBB.
empty()) {
611 if (HasIndirectbr && PreRegAlloc)
620 if (HasComputedGoto && !PreRegAlloc)
621 MaxDuplicateCount = std::max(MaxDuplicateCount, 10u);
626 unsigned NumPhis = 0;
633 if (
MI.isNotDuplicable() &&
635 !
MI.isCFIInstruction()))
640 if (
MI.isConvergent())
646 if (PreRegAlloc &&
MI.isReturn())
652 if (PreRegAlloc &&
MI.isCall())
660 if (
MI.getOpcode() == TargetOpcode::INLINEASM_BR)
665 else if (!
MI.isPHI() && !
MI.isMetaInstruction())
670 NumPhis +=
MI.isPHI();
681 return any_of(*MBB, [](MachineInstr &MI) { return MI.isPHI(); });
696 for (
auto &
I : *SB) {
707 if (HasIndirectbr && PreRegAlloc)
716 return canCompletelyDuplicateBB(TailBB);
726 if (
I == TailBB->
end())
728 return I->isUnconditionalBranch();
745 MachineBasicBlock *PredTBB =
nullptr, *PredFBB =
nullptr;
747 if (TII->analyzeBranch(*PredBB, PredTBB, PredFBB, PredCond))
750 if (!PredCond.
empty())
756bool TailDuplicator::duplicateSimpleBB(
763 for (MachineBasicBlock *PredBB : Preds) {
770 MachineBasicBlock *PredTBB =
nullptr, *PredFBB =
nullptr;
772 if (TII->analyzeBranch(*PredBB, PredTBB, PredFBB, PredCond))
776 LLVM_DEBUG(
dbgs() <<
"\nTail-duplicating into PredBB: " << *PredBB
777 <<
"From simple Succ: " << *TailBB);
779 MachineBasicBlock *NewTarget = *TailBB->
succ_begin();
783 if (PredCond.
empty())
793 if (PredFBB == TailBB)
795 if (PredTBB == TailBB)
799 if (PredTBB == PredFBB) {
805 if (PredFBB == NextBB)
807 if (PredTBB == NextBB && PredFBB ==
nullptr)
811 TII->removeBranch(*PredBB);
821 TII->insertBranch(*PredBB, PredTBB, PredFBB, PredCond,
DL);
836 if (TII->analyzeBranch(*PredBB, PredTBB, PredFBB, PredCond))
838 if (!PredCond.
empty())
876 return duplicateSimpleBB(TailBB, TDBBs, UsedByPhi);
889 assert(TailBB != PredBB &&
890 "Single-block loop should have been rejected earlier!");
899 bool IsLayoutSuccessor =
false;
900 if (ForcedLayoutPred)
901 IsLayoutSuccessor = (ForcedLayoutPred == PredBB);
903 IsLayoutSuccessor =
true;
904 if (IsLayoutSuccessor)
908 LLVM_DEBUG(
dbgs() <<
"\nTail-duplicating into PredBB: " << *PredBB
909 <<
"From Succ: " << *TailBB);
914 TII->removeBranch(*PredBB);
923 processPHI(&
MI, TailBB, PredBB, LocalVRMap, CopyInfos, UsedByPhi,
true);
927 duplicateInstruction(&
MI, TailBB, PredBB, LocalVRMap, UsedByPhi);
930 appendCopies(PredBB, CopyInfos,
Copies);
932 NumTailDupAdded += TailBB->
size() - 1;
937 "TailDuplicate called on block with multiple successors!");
938 for (MachineBasicBlock *Succ : TailBB->
successors())
939 PredBB->
addSuccessor(Succ, MBPI->getEdgeProbability(TailBB, Succ));
942 if (ShouldUpdateTerminators)
952 MachineBasicBlock *PrevBB = ForcedLayoutPred;
955 MachineBasicBlock *PriorTBB =
nullptr, *PriorFBB =
nullptr;
962 !TII->analyzeBranch(*PrevBB, PriorTBB, PriorFBB, PriorCond) &&
964 (!PriorTBB || PriorTBB == TailBB) &&
968 <<
"From MBB: " << *TailBB);
972 bool RemovedBranches = TII->removeBranch(*PrevBB) != 0;
977 DenseMap<Register, RegSubRegPair> LocalVRMap;
981 while (
I != TailBB->
end() &&
I->isPHI()) {
984 MachineInstr *
MI = &*
I++;
985 processPHI(
MI, TailBB, PrevBB, LocalVRMap, CopyInfos, UsedByPhi,
990 while (
I != TailBB->
end()) {
993 MachineInstr *
MI = &*
I++;
994 assert(!
MI->isBundle() &&
"Not expecting bundles before regalloc!");
995 duplicateInstruction(
MI, TailBB, PrevBB, LocalVRMap, UsedByPhi);
996 MI->eraseFromParent();
998 appendCopies(PrevBB, CopyInfos,
Copies);
1000 TII->removeBranch(*PrevBB);
1009 if (ShouldUpdateTerminators)
1015 LLVM_DEBUG(
dbgs() <<
"Abort merging blocks, the predecessor still "
1016 "contains terminator instructions");
1019 return RemovedBranches;
1046 for (MachineBasicBlock *PredBB : Preds) {
1054 DenseMap<Register, RegSubRegPair> LocalVRMap;
1060 processPHI(&
MI, TailBB, PredBB, LocalVRMap, CopyInfos, UsedByPhi,
false);
1062 appendCopies(PredBB, CopyInfos,
Copies);
1074 const MCInstrDesc &CopyD = TII->get(TargetOpcode::COPY);
1075 for (
auto &CI : CopyInfos) {
1077 .
addReg(CI.second.Reg, {}, CI.second.SubReg);
1084void TailDuplicator::removeDeadBlock(
1092 for (
const MachineInstr &
MI : *
MBB)
1093 if (
MI.shouldUpdateAdditionalCallInfo())
1096 if (RemovalCallback)
1097 (*RemovalCallback)(
MBB);
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static unsigned InstrCount
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
const HexagonInstrInfo * TII
TargetInstrInfo::RegSubRegPair RegSubRegPair
Promote Memory to Register
bool isDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
This file implements a set that has insertion order iteration characteristics.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
static cl::opt< unsigned > TailDuplicateSize("tail-dup-size", cl::desc("Maximum instructions to consider tail duplicating"), cl::init(2), cl::Hidden)
static cl::opt< unsigned > TailDupLimit("tail-dup-limit", cl::init(~0U), cl::Hidden)
static cl::opt< unsigned > TailDupPredSize("tail-dup-pred-size", cl::desc("Maximum predecessors (maximum successors at the " "same time) to consider tail duplicating blocks."), cl::init(16), cl::Hidden)
static cl::opt< unsigned > TailDupSuccSize("tail-dup-succ-size", cl::desc("Maximum successors (maximum predecessors at the " "same time) to consider tail duplicating blocks."), cl::init(16), cl::Hidden)
static cl::opt< bool > TailDupVerify("tail-dup-verify", cl::desc("Verify sanity of PHI instructions during taildup"), cl::init(false), cl::Hidden)
static void VerifyPHIs(MachineFunction &MF, bool CheckExtra)
static bool bothUsedInPHI(const MachineBasicBlock &A, const SmallPtrSet< MachineBasicBlock *, 8 > &SuccsB)
static unsigned getPHISrcRegOpIdx(MachineInstr *MI, MachineBasicBlock *SrcBB)
static void getRegsUsedByPHIs(const MachineBasicBlock &BB, DenseSet< Register > *UsedByPhi)
static cl::opt< unsigned > TailDupIndirectBranchSize("tail-dup-indirect-size", cl::desc("Maximum instructions to consider tail duplicating blocks that " "end with indirect branches."), cl::init(20), cl::Hidden)
static bool isDefLiveOut(Register Reg, MachineBasicBlock *BB, const MachineRegisterInfo *MRI)
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
bool erase(const KeyT &Val)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
Implements a dense probed hash-table based set.
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
bool isInlineAsmBrIndirectTarget() const
Returns true if this is the indirect dest of an INLINEASM_BR.
unsigned pred_size() const
LLVM_ABI bool hasEHPadSuccessor() const
LLVM_ABI void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New)
Replace successor OLD with NEW and update probability info.
LLVM_ABI void transferSuccessors(MachineBasicBlock *FromMBB)
Transfers all the successors from MBB to this machine basic block (i.e., copies all the successors Fr...
iterator_range< iterator > phis()
Returns a range that iterates over the phis in the basic block.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
LLVM_ABI void updateTerminator(MachineBasicBlock *PreviousLayoutSuccessor)
Update the terminator instructions in block to account for changes to block layout which may have bee...
LLVM_ABI bool canFallThrough()
Return true if the block can implicitly transfer control to the block after it by falling off the end...
LLVM_ABI iterator getFirstNonDebugInstr(bool SkipPseudoOp=true)
Returns an iterator to the first non-debug instruction in the basic block, or end().
succ_iterator succ_begin()
bool terminatorIsComputedGotoWithSuccessors() const
Returns true if the original IR terminator is an indirectbr with successor blocks.
LLVM_ABI iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
unsigned succ_size() const
bool hasAddressTaken() const
Test whether this block is used as something other than the target of a terminator,...
LLVM_ABI void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
LLVM_ABI void removeSuccessor(MachineBasicBlock *Succ, bool NormalizeSuccProbs=false)
Remove successor from the successors list of this MachineBasicBlock.
LLVM_ABI DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any debug instructions.
LLVM_ABI bool isLayoutSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB will be emitted immediately after this block, such that if this bloc...
LLVM_ABI void eraseFromParent()
This method unlinks 'this' from the containing function and deletes it.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
LLVM_ABI DebugLoc findBranchDebugLoc()
Find and return the merged DebugLoc of the branch instructions of the block.
iterator_range< succ_iterator > successors()
LLVM_ABI bool isSuccessor(const MachineBasicBlock *MBB) const
Return true if the specified MBB is a successor of this block.
iterator_range< pred_iterator > predecessors()
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 '...
MachineInstrBundleIterator< MachineInstr > iterator
LLVM_ABI bool mayHaveInlineAsmBr() const
Returns true if this block may have an INLINEASM_BR (overestimate, by checking if any of the successo...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
void eraseAdditionalCallInfo(const MachineInstr *MI)
Following functions update call site info.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & addCFIIndex(unsigned CFIIndex) const
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & setMIFlags(unsigned Flags) const
Representation of each machine instruction.
bool isDebugInstr() const
unsigned getNumOperands() const
Retuns the total number of operands.
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
const MachineOperand & getOperand(unsigned i) const
bool isIndirectBranch(QueryType Type=AnyInBundle) const
Return true if this is an indirect branch, such as a branch through a register.
MachineOperand class - Representation of each machine instruction operand.
void setSubReg(unsigned subReg)
unsigned getSubReg() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
MachineBasicBlock * getMBB() const
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
void setIsKill(bool Val=true)
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
iterator_range< use_instr_iterator > use_instructions(Register Reg) const
MachineSSAUpdater - This class updates SSA form for a set of virtual registers defined in multiple bl...
void Initialize(Register V)
Initialize - Reset this object to get ready for a new set of SSA updates.
Register GetValueInMiddleOfBlock(MachineBasicBlock *BB, bool ExistingValueOnly=false)
GetValueInMiddleOfBlock - Construct SSA form, materializing a value that is live in the middle of the...
void RewriteUse(MachineOperand &U)
RewriteUse - Rewrite a use of the symbolic value.
void AddAvailableValue(MachineBasicBlock *BB, Register V)
AddAvailableValue - Indicate that a rewritten value is available at the end of the specified block wi...
Analysis providing profile information.
Wrapper class representing virtual and physical registers.
constexpr bool isVirtual() const
Return true if the specified register number is in the virtual register namespace.
void insert_range(Range &&R)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
A SetVector that performs no allocations if smaller than a certain size.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
void initMF(MachineFunction &MF, bool PreRegAlloc, const MachineBranchProbabilityInfo *MBPI, MBFIWrapper *MBFI, ProfileSummaryInfo *PSI, bool LayoutMode, unsigned TailDupSize=0)
Prepare to run on a specific machine function.
bool tailDuplicateBlocks()
Look for small blocks that are unconditionally branched to and do not fall through.
bool tailDuplicateAndUpdate(bool IsSimple, MachineBasicBlock *MBB, MachineBasicBlock *ForcedLayoutPred, SmallVectorImpl< MachineBasicBlock * > *DuplicatedPreds=nullptr, function_ref< void(MachineBasicBlock *)> *RemovalCallback=nullptr, SmallVectorImpl< MachineBasicBlock * > *CandidatePtr=nullptr)
Tail duplicate a single basic block into its predecessors, and then clean up.
static bool isSimpleBB(MachineBasicBlock *TailBB)
True if this BB has only one unconditional jump.
bool canTailDuplicate(MachineBasicBlock *TailBB, MachineBasicBlock *PredBB)
Returns true if TailBB can successfully be duplicated into PredBB.
bool shouldTailDuplicate(bool IsSimple, MachineBasicBlock &TailBB)
Determine if it is profitable to duplicate this block.
const TargetRegisterInfo & getRegisterInfo() const
const Triple & getTargetTriple() const
virtual const TargetInstrInfo * getInstrInfo() const
bool isOSDarwin() const
Is this a "Darwin" OS (macOS, iOS, tvOS, watchOS, DriverKit, XROS, or bridgeOS).
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
An efficient, type-erasing, non-owning reference to a callable.
self_iterator getIterator()
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
auto successors(const MachineBasicBlock *BB)
constexpr from_range_t from_range
LLVM_ABI bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI, const MachineBlockFrequencyInfo *BFI, PGSOQueryType QueryType=PGSOQueryType::Other)
Returns true if machine function MF is suggested to be size-optimized based on the profile.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.