46#include "llvm/Config/llvm-config.h"
67#define DEBUG_TYPE "stack-coloring"
69STATISTIC(NumMarkerSeen,
"Number of lifetime markers found.");
70STATISTIC(StackSpaceSaved,
"Number of bytes saved due to merging slots.");
71STATISTIC(StackSlotMerged,
"Number of stack slot merged.");
72STATISTIC(EscapedAllocas,
"Number of allocas that escaped the lifetime region");
356 const CodeGenOptions &Opts;
363 struct BlockLifetimeInfo {
378 using LivenessMap = DenseMap<const MachineBasicBlock *, BlockLifetimeInfo>;
379 LivenessMap BlockLiveness;
395 SlotIndexes *Indexes =
nullptr;
399 SmallVector<MachineInstr*, 8> Markers;
403 BitVector InterestingSlots;
407 BitVector ConservativeSlots;
410 unsigned NumIterations;
413 StackColoring(
const CodeGenOptions &Opts, SlotIndexes *Indexes)
414 : Opts(Opts), Indexes(Indexes) {}
419 using BlockBitVecMap = DenseMap<const MachineBasicBlock *, BitVector>;
423 void dumpIntervals()
const;
424 void dumpBB(MachineBasicBlock *
MBB)
const;
425 void dumpBV(
const char *tag,
const BitVector &BV)
const;
429 bool removeAllMarkers();
434 unsigned collectMarkers(
unsigned NumSlot);
440 void calculateLocalLiveness();
444 bool applyFirstUse(
int Slot) {
445 if (!Opts.stackcoloring_lifetime_start_on_first_use ||
446 Opts.stackcoloring_protect_from_escaped_allocas)
448 if (ConservativeSlots.test(Slot))
458 bool isLifetimeStartOrEnd(
const MachineInstr &
MI,
459 SmallVector<int, 4> &
slots,
463 void calculateLiveIntervals(
unsigned NumSlots);
467 void remapInstructions(DenseMap<int, int> &SlotRemap);
475 void removeInvalidSlotRanges();
479 void expungeSlotMap(DenseMap<int, int> &SlotRemap,
unsigned NumSlots);
486 StackColoringLegacy() : MachineFunctionPass(ID) {}
488 void getAnalysisUsage(AnalysisUsage &AU)
const override;
494char StackColoringLegacy::ID = 0;
499 "Merge disjoint stack slots",
false,
false)
504void StackColoringLegacy::getAnalysisUsage(
AnalysisUsage &AU)
const {
510#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
513 dbgs() << tag <<
" : { ";
514 for (
unsigned I = 0,
E = BV.
size();
I !=
E; ++
I)
520 LivenessMap::const_iterator BI = BlockLiveness.find(
MBB);
521 assert(BI != BlockLiveness.end() &&
"Block not found");
522 const BlockLifetimeInfo &BlockInfo = BI->second;
524 dumpBV(
"BEGIN", BlockInfo.Begin);
525 dumpBV(
"END", BlockInfo.End);
526 dumpBV(
"LIVE_IN", BlockInfo.LiveIn);
527 dumpBV(
"LIVE_OUT", BlockInfo.LiveOut);
539 for (
unsigned I = 0,
E = Intervals.
size();
I !=
E; ++
I) {
540 dbgs() <<
"Interval[" <<
I <<
"]:\n";
541 Intervals[
I]->dump();
548 assert((
MI.getOpcode() == TargetOpcode::LIFETIME_START ||
549 MI.getOpcode() == TargetOpcode::LIFETIME_END) &&
550 "Expected LIFETIME_START or LIFETIME_END op");
562bool StackColoring::isLifetimeStartOrEnd(
const MachineInstr &
MI,
563 SmallVector<int, 4> &
slots,
565 if (
MI.getOpcode() == TargetOpcode::LIFETIME_START ||
566 MI.getOpcode() == TargetOpcode::LIFETIME_END) {
570 if (!InterestingSlots.
test(Slot))
572 slots.push_back(Slot);
573 if (
MI.getOpcode() == TargetOpcode::LIFETIME_END) {
577 if (!applyFirstUse(Slot)) {
581 }
else if (Opts.stackcoloring_lifetime_start_on_first_use &&
582 !Opts.stackcoloring_protect_from_escaped_allocas) {
583 if (!
MI.isDebugInstr()) {
585 for (
const MachineOperand &MO :
MI.operands()) {
588 int Slot = MO.getIndex();
591 if (InterestingSlots.
test(Slot) && applyFirstUse(Slot)) {
592 slots.push_back(Slot);
605unsigned StackColoring::collectMarkers(
unsigned NumSlot) {
606 unsigned MarkersFound = 0;
607 BlockBitVecMap SeenStartMap;
608 InterestingSlots.
clear();
609 InterestingSlots.
resize(NumSlot);
610 ConservativeSlots.
clear();
611 ConservativeSlots.
resize(NumSlot);
614 SmallVector<int, 8> NumStartLifetimes(NumSlot, 0);
615 SmallVector<int, 8> NumEndLifetimes(NumSlot, 0);
625 BitVector BetweenStartEnd;
626 BetweenStartEnd.
resize(NumSlot);
628 BlockBitVecMap::const_iterator
I = SeenStartMap.find(
Pred);
629 if (
I != SeenStartMap.end()) {
630 BetweenStartEnd |=
I->second;
635 for (MachineInstr &
MI : *
MBB) {
636 if (
MI.isDebugInstr())
638 if (
MI.getOpcode() == TargetOpcode::LIFETIME_START ||
639 MI.getOpcode() == TargetOpcode::LIFETIME_END) {
643 InterestingSlots.
set(Slot);
644 if (
MI.getOpcode() == TargetOpcode::LIFETIME_START) {
645 BetweenStartEnd.
set(Slot);
646 NumStartLifetimes[
Slot] += 1;
648 BetweenStartEnd.
reset(Slot);
649 NumEndLifetimes[
Slot] += 1;
659 <<
" with allocation: " << Allocation->
getName() <<
"\n");
664 for (
const MachineOperand &MO :
MI.operands()) {
667 int Slot = MO.getIndex();
670 if (! BetweenStartEnd.
test(Slot)) {
671 ConservativeSlots.
set(Slot);
676 BitVector &SeenStart = SeenStartMap[
MBB];
677 SeenStart |= BetweenStartEnd;
685 for (
unsigned slot = 0; slot < NumSlot; ++slot) {
686 if (NumStartLifetimes[slot] > 1 || NumEndLifetimes[slot] > 1)
687 ConservativeSlots.
set(slot);
695 for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap)
697 if (
H.CatchObj.FrameIndex != std::numeric_limits<int>::max() &&
698 H.CatchObj.FrameIndex >= 0)
699 ConservativeSlots.
set(
H.CatchObj.FrameIndex);
704 ConservativeSlots.
set();
706 LLVM_DEBUG(dumpBV(
"Conservative slots", ConservativeSlots));
709 for (
const MachineBasicBlock *
MBB : BasicBlockOrdering) {
711 BlockLifetimeInfo &BlockInfo = BlockLiveness[
MBB];
713 BlockInfo.Begin.resize(NumSlot);
714 BlockInfo.End.resize(NumSlot);
716 SmallVector<int, 4>
slots;
717 for (
const MachineInstr &
MI : *
MBB) {
718 bool isStart =
false;
720 if (isLifetimeStartOrEnd(
MI,
slots, isStart)) {
722 assert(
slots.size() == 1 &&
"unexpected: MI ends multiple slots");
724 if (BlockInfo.Begin.test(Slot)) {
725 BlockInfo.Begin.reset(Slot);
727 BlockInfo.End.set(Slot);
729 for (
auto Slot :
slots) {
737 <<
" with allocation: " << Allocation->
getName());
740 if (BlockInfo.End.test(Slot)) {
741 BlockInfo.End.reset(Slot);
743 BlockInfo.Begin.set(Slot);
751 NumMarkerSeen += MarkersFound;
755void StackColoring::calculateLocalLiveness() {
756 unsigned NumIters = 0;
760 BitVector LocalLiveIn;
761 BitVector LocalLiveOut;
766 for (
const MachineBasicBlock *BB : BasicBlockOrdering) {
768 LivenessMap::iterator BI = BlockLiveness.find(BB);
769 assert(BI != BlockLiveness.end() &&
"Block not found");
770 BlockLifetimeInfo &BlockInfo = BI->second;
774 for (MachineBasicBlock *
Pred : BB->predecessors()) {
775 LivenessMap::const_iterator
I = BlockLiveness.find(
Pred);
779 if (
I != BlockLiveness.end())
780 LocalLiveIn |=
I->second.LiveOut;
790 LocalLiveOut = LocalLiveIn;
791 LocalLiveOut.
reset(BlockInfo.End);
792 LocalLiveOut |= BlockInfo.Begin;
795 if (!LocalLiveIn.
subsetOf(BlockInfo.LiveIn)) {
797 BlockInfo.LiveIn |= LocalLiveIn;
801 if (!LocalLiveOut.
subsetOf(BlockInfo.LiveOut)) {
803 BlockInfo.LiveOut |= LocalLiveOut;
808 NumIterations = NumIters;
811void StackColoring::calculateLiveIntervals(
unsigned NumSlots) {
817 for (
const MachineBasicBlock &
MBB : *MF) {
820 DefinitelyInUse.
clear();
821 DefinitelyInUse.
resize(NumSlots);
824 BlockLifetimeInfo &MBBLiveness = BlockLiveness[&
MBB];
825 for (
int pos = MBBLiveness.LiveIn.find_first(); pos != -1;
826 pos = MBBLiveness.LiveIn.find_next(pos)) {
831 for (
const MachineInstr &
MI :
MBB) {
832 SmallVector<int, 4>
slots;
833 bool IsStart =
false;
834 if (!isLifetimeStartOrEnd(
MI,
slots, IsStart))
837 for (
auto Slot :
slots) {
842 if (!DefinitelyInUse[Slot]) {
844 DefinitelyInUse[
Slot] =
true;
847 Starts[
Slot] = ThisIndex;
850 VNInfo *VNI = Intervals[
Slot]->getValNumInfo(0);
851 Intervals[
Slot]->addSegment(
852 LiveInterval::Segment(Starts[Slot], ThisIndex, VNI));
853 Starts[
Slot] = SlotIndex();
854 DefinitelyInUse[
Slot] =
false;
861 for (
unsigned i = 0; i < NumSlots; ++i) {
866 VNInfo *VNI = Intervals[i]->getValNumInfo(0);
867 Intervals[i]->addSegment(LiveInterval::Segment(Starts[i], EndIdx, VNI));
872bool StackColoring::removeAllMarkers() {
875 MI->eraseFromParent();
884void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
885 unsigned FixedInstr = 0;
886 unsigned FixedMemOp = 0;
887 unsigned FixedDbg = 0;
890 for (
auto &VI : MF->getVariableDbgInfo()) {
891 if (!
VI.Var || !
VI.inStackSlot())
893 int Slot =
VI.getStackSlot();
894 if (
auto It = SlotRemap.
find(Slot); It != SlotRemap.
end()) {
897 VI.updateStackSlot(It->second);
903 DenseMap<const AllocaInst*, const AllocaInst*>
Allocas;
906 SmallPtrSet<const AllocaInst*, 32> MergedAllocas;
908 for (
const auto &[FromIdx, ToIdx] : SlotRemap) {
912 assert(To && From &&
"Invalid allocation object");
932 MergedAllocas.
insert(From);
958 std::vector<std::vector<MachineMemOperand *>> SSRefs(
960 for (MachineBasicBlock &BB : *MF)
961 for (MachineInstr &
I : BB) {
963 if (
I.getOpcode() == TargetOpcode::LIFETIME_START ||
964 I.getOpcode() == TargetOpcode::LIFETIME_END)
968 for (MachineMemOperand *MMO :
I.memoperands()) {
979 MMO->setValue(It->second);
984 for (MachineOperand &MO :
I.operands()) {
987 int FromSlot = MO.getIndex();
994 if (!SlotRemap.count(FromSlot))
1005 bool TouchesMemory =
I.mayLoadOrStore();
1008 if (!
I.isDebugInstr() && TouchesMemory &&
1009 Opts.stackcoloring_protect_from_escaped_allocas) {
1011 const LiveInterval *
Interval = &*Intervals[FromSlot];
1013 "Found instruction usage outside of live range.");
1018 int ToSlot = SlotRemap[FromSlot];
1019 MO.setIndex(ToSlot);
1025 bool ReplaceMemOps =
false;
1026 for (MachineMemOperand *MMO :
I.memoperands()) {
1030 MMO->getPseudoValue())) {
1031 int FI = FSV->getFrameIndex();
1032 auto To = SlotRemap.find(FI);
1033 if (To != SlotRemap.end())
1034 SSRefs[FI].push_back(MMO);
1039 bool MayHaveConflictingAAMD =
false;
1040 if (MMO->getAAInfo()) {
1041 if (
const Value *MMOV = MMO->getValue()) {
1042 SmallVector<Value *, 4> Objs;
1045 MayHaveConflictingAAMD =
true;
1052 if (AI && MergedAllocas.
count(AI)) {
1053 MayHaveConflictingAAMD =
true;
1059 if (MayHaveConflictingAAMD) {
1060 NewMMOs.
push_back(MF->getMachineMemOperand(MMO, AAMDNodes()));
1061 ReplaceMemOps =
true;
1070 I.setMemRefs(*MF, NewMMOs);
1075 if (!
E.value().empty()) {
1076 const PseudoSourceValue *NewSV =
1077 MF->getPSVManager().getFixedStack(SlotRemap.find(
E.index())->second);
1078 for (MachineMemOperand *
Ref :
E.value())
1079 Ref->setValue(NewSV);
1083 if (WinEHFuncInfo *EHInfo = MF->getWinEHFuncInfo())
1084 for (WinEHTryBlockMapEntry &TBME : EHInfo->TryBlockMap)
1086 if (
H.CatchObj.FrameIndex != std::numeric_limits<int>::max())
1087 if (
auto It = SlotRemap.find(
H.CatchObj.FrameIndex);
1088 It != SlotRemap.end())
1089 H.CatchObj.FrameIndex = It->second;
1091 LLVM_DEBUG(
dbgs() <<
"Fixed " << FixedMemOp <<
" machine memory operands.\n");
1092 LLVM_DEBUG(
dbgs() <<
"Fixed " << FixedDbg <<
" debug locations.\n");
1093 LLVM_DEBUG(
dbgs() <<
"Fixed " << FixedInstr <<
" machine instructions.\n");
1099void StackColoring::removeInvalidSlotRanges() {
1100 for (MachineBasicBlock &BB : *MF)
1101 for (MachineInstr &
I : BB) {
1102 if (
I.getOpcode() == TargetOpcode::LIFETIME_START ||
1103 I.getOpcode() == TargetOpcode::LIFETIME_END ||
I.isDebugInstr())
1112 if (!
I.mayLoad() && !
I.mayStore())
1116 for (
const MachineOperand &MO :
I.operands()) {
1120 int Slot = MO.getIndex();
1125 if (Intervals[Slot]->
empty())
1141void StackColoring::expungeSlotMap(DenseMap<int, int> &SlotRemap,
1142 unsigned NumSlots) {
1144 for (
unsigned i=0; i < NumSlots; ++i) {
1146 if (
auto It = SlotRemap.
find(i); It != SlotRemap.
end()) {
1150 auto It = SlotRemap.
find(Target);
1151 if (It == SlotRemap.
end())
1162 &getAnalysis<SlotIndexesWrapperPass>().getSI());
1163 return SC.run(MF, skipFunction(MF.
getFunction()));
1172 if (SC.run(MF, OnlyRemoveMarkers)) {
1180bool StackColoring::run(
MachineFunction &Func,
bool OnlyRemoveMarkers) {
1182 <<
"********** Function: " << Func.getName() <<
'\n');
1185 BlockLiveness.clear();
1186 BasicBlockOrdering.clear();
1190 VNInfoAllocator.Reset();
1199 SortedSlots.
reserve(NumSlots);
1201 LiveStarts.
resize(NumSlots);
1203 unsigned NumMarkers = collectMarkers(NumSlots);
1205 int64_t TotalSize = 0;
1206 LLVM_DEBUG(
dbgs() <<
"Found " << NumMarkers <<
" markers and " << NumSlots
1216 LLVM_DEBUG(
dbgs() <<
"Total Stack size: " << TotalSize <<
" bytes\n\n");
1221 if (NumMarkers < 2 || TotalSize < 16 || !Opts.stack_coloring ||
1222 OnlyRemoveMarkers) {
1224 return removeAllMarkers();
1227 for (
unsigned i=0; i < NumSlots; ++i) {
1228 std::unique_ptr<LiveInterval> LI(
new LiveInterval(i, 0));
1229 LI->getNextValue(Indexes->
getZeroIndex(), VNInfoAllocator);
1235 calculateLocalLiveness();
1236 LLVM_DEBUG(
dbgs() <<
"Dataflow iterations: " << NumIterations <<
"\n");
1240 calculateLiveIntervals(NumSlots);
1245 if (Opts.stackcoloring_protect_from_escaped_allocas)
1246 removeInvalidSlotRanges();
1249 DenseMap<int, int> SlotRemap;
1250 unsigned RemovedSlots = 0;
1251 int64_t ReducedSize = 0;
1254 for (
unsigned I = 0;
I < NumSlots; ++
I) {
1255 if (Intervals[SortedSlots[
I]]->
empty())
1256 SortedSlots[
I] = -1;
1277 for (
auto &s : LiveStarts)
1283 for (
unsigned I = 0;
I < NumSlots; ++
I) {
1284 if (SortedSlots[
I] == -1)
1287 for (
unsigned J=
I+1; J < NumSlots; ++J) {
1288 if (SortedSlots[J] == -1)
1291 int FirstSlot = SortedSlots[
I];
1292 int SecondSlot = SortedSlots[J];
1298 LiveInterval *
First = &*Intervals[FirstSlot];
1299 LiveInterval *Second = &*Intervals[SecondSlot];
1300 auto &FirstS = LiveStarts[FirstSlot];
1301 auto &SecondS = LiveStarts[SecondSlot];
1306 if (!
First->isLiveAtIndexes(SecondS) &&
1309 First->MergeSegmentsInAsValue(*Second,
First->getValNumInfo(0));
1311 int OldSize = FirstS.size();
1312 FirstS.append(SecondS.begin(), SecondS.end());
1313 auto Mid = FirstS.begin() + OldSize;
1314 std::inplace_merge(FirstS.begin(), Mid, FirstS.end());
1316 SlotRemap[SecondSlot] = FirstSlot;
1317 SortedSlots[J] = -1;
1319 << SecondSlot <<
" together.\n");
1325 "Merging a small object into a larger one");
1337 StackSpaceSaved += ReducedSize;
1338 StackSlotMerged += RemovedSlots;
1339 LLVM_DEBUG(
dbgs() <<
"Merge " << RemovedSlots <<
" slots. Saved "
1340 << ReducedSize <<
" bytes\n");
1344 if (!SlotRemap.
empty()) {
1345 expungeSlotMap(SlotRemap, NumSlots);
1346 remapInstructions(SlotRemap);
1349 return removeAllMarkers();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
This file defines the DenseMap class.
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
Hexagon Lower HLX Pair Allocas
This defines the Use class.
std::pair< uint64_t, uint64_t > Interval
#define INITIALIZE_PASS_DEPENDENCY(depName)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
static bool isValid(const char C)
Returns true if C is a valid mangled character: <0-9a-zA-Z_>.
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
static int getStartOrEndSlot(const MachineInstr &MI)
Merge disjoint stack slots
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
PointerType * getType() const
Overload to return most specific pointer type.
void setAlignment(Align Align)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Represent the analysis usage information of a pass.
bool test(unsigned Idx) const
Returns true if bit Idx is set.
BitVector & reset()
Reset all bits in the bitvector.
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
void clear()
Removes all bits from the bitvector.
BitVector & set()
Set all bits in the bitvector.
size_type size() const
Returns the number of bits in this bitvector.
bool subsetOf(const BitVector &RHS) const
Check if This is a subset of RHS.
iterator find(const_arg_type_t< KeyT > Val)
bool hasOptNone() const
Do not optimize this function (-O0).
LLVM_ABI void moveBefore(InstListType::iterator InsertPos)
Unlink this instruction from its current basic block and insert it into the basic block that MovePos ...
LLVM_ABI bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
LLVM_ABI bool isLiveAtIndexes(ArrayRef< SlotIndex > Slots) const
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
iterator_range< pred_iterator > predecessors()
LLVM_ABI StringRef getName() const
Return the name of the corresponding LLVM basic block, or an empty string.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
SSPLayoutKind getObjectSSPLayout(int ObjectIdx) const
const AllocaInst * getObjectAllocation(int ObjectIdx) const
Return the underlying Alloca of the specified stack object if it exists.
SSPLayoutKind
Stack Smashing Protection (SSP) rules require that vulnerable stack allocations are located close the...
@ SSPLK_LargeArray
Array or nested array >= SSP-buffer-size.
@ SSPLK_AddrOf
The address of this allocation is exposed and triggered protection.
@ SSPLK_None
Did not trigger a stack protector.
void setObjectSSPLayout(int ObjectIdx, SSPLayoutKind Kind)
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
void RemoveStackObject(int ObjectIdx)
Remove or mark dead a statically sized stack object.
int getObjectIndexEnd() const
Return one past the maximum frame object index.
uint8_t getStackID(int ObjectIdx) const
void setObjectAlignment(int ObjectIdx, Align Alignment)
setObjectAlignment - Change the alignment of the specified stack object.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
LLVM_ABI void print(raw_ostream &os) const
Print this index to the given raw_ostream.
SlotIndex getInstructionIndex(const MachineInstr &MI, bool IgnoreBundle=false) const
Returns the base index for the given instruction.
SlotIndex getZeroIndex()
Returns the zero index for this analysis.
SlotIndex getMBBEndIdx(const MachineBasicBlock *mbb) const
Returns the index past the last valid index in the given basic block.
SlotIndex getMBBStartIdx(const MachineBasicBlock *mbb) const
Returns the first index in the given basic block.
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.
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
BumpPtrAllocator Allocator
LLVM_ABI void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
bool isUsedByMetadata() const
Return true if there is metadata referencing this value.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
self_iterator getIterator()
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
PointerTypeMap run(const Module &M)
Compute the PointerTypeMap for the module M.
constexpr size_t MaxAlignment
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
void stable_sort(R &&Range)
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
LLVM_ABI bool getUnderlyingObjectsForCodeGen(const Value *V, SmallVectorImpl< Value * > &Objects)
This is a wrapper around getUnderlyingObjects and adds support for basic ptrtoint+arithmetic+inttoptr...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
auto dyn_cast_or_null(const Y &Val)
void sort(IteratorTy Start, IteratorTy End)
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...
@ Ref
The access may reference the value stored in memory.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
LLVM_ABI char & StackColoringLegacyID
StackSlotColoring - This pass performs stack coloring and merging.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
iterator_range< df_iterator< T > > depth_first(const T &G)
@ End
Run the machine verifier once, at the end of the pipeline.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
const CodeGenOptions & getCodeGenOptions(const LLVMContext &C)
bool shouldSkipOptimizationForOptBisect(IRUnitRef IR)
SmallVector< WinEHHandlerType, 1 > HandlerArray