57#define DEBUG_TYPE "statepoint-lowering"
60 "Number of stack slots allocated for statepoints");
61STATISTIC(NumOfStatepoints,
"Number of statepoint nodes encountered");
63 "Maximum number of stack slots required for a singe statepoint");
67 cl::desc(
"Allow using registers for non pointer deopt args"));
71 cl::desc(
"Allow using registers for gc pointer in landing pad"));
75 cl::desc(
"Max number of VRegs allowed to pass GC pointer meta args in"));
89 assert(PendingGCRelocateCalls.empty() &&
90 "Trying to visit statepoint before finished processing previous one");
92 NextSlotToAllocate = 0;
96 AllocatedStackSlots.
clear();
97 AllocatedStackSlots.
resize(
Builder.FuncInfo.StatepointStackSlots.size());
102 AllocatedStackSlots.
clear();
103 assert(PendingGCRelocateCalls.empty() &&
104 "cleared before statepoint sequence completed");
110 NumSlotsAllocatedForStatepoints++;
113 unsigned SpillSize =
ValueType.getStoreSize();
115 (-8u & (7 +
ValueType.getSizeInBits())) &&
116 "Size not in bytes?");
122 const size_t NumSlots = AllocatedStackSlots.
size();
123 assert(NextSlotToAllocate <= NumSlots &&
"Broken invariant");
126 Builder.FuncInfo.StatepointStackSlots.size() &&
129 for (; NextSlotToAllocate < NumSlots; NextSlotToAllocate++) {
130 if (!AllocatedStackSlots.
test(NextSlotToAllocate)) {
131 const int FI =
Builder.FuncInfo.StatepointStackSlots[NextSlotToAllocate];
133 AllocatedStackSlots.
set(NextSlotToAllocate);
143 const unsigned FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
146 Builder.FuncInfo.StatepointStackSlots.push_back(FI);
147 AllocatedStackSlots.
resize(AllocatedStackSlots.
size()+1,
true);
149 Builder.FuncInfo.StatepointStackSlots.size() &&
152 StatepointMaxSlotsRequired.updateMax(
153 Builder.FuncInfo.StatepointStackSlots.size());
165 if (LookUpDepth <= 0)
169 if (
const auto *Relocate = dyn_cast<GCRelocateInst>(Val)) {
170 const Value *Statepoint = Relocate->getStatepoint();
171 assert((isa<GCStatepointInst>(Statepoint) || isa<UndefValue>(Statepoint)) &&
172 "GetStatepoint must return one of two types");
173 if (isa<UndefValue>(Statepoint))
176 const auto &RelocationMap =
Builder.FuncInfo.StatepointRelocationMaps
177 [cast<GCStatepointInst>(Statepoint)];
179 auto It = RelocationMap.find(Relocate);
180 if (It == RelocationMap.end())
183 auto &
Record = It->second;
191 if (
const BitCastInst *Cast = dyn_cast<BitCastInst>(Val))
197 if (
const PHINode *Phi = dyn_cast<PHINode>(Val)) {
198 std::optional<int> MergedResult;
200 for (
const auto &IncomingValue : Phi->incoming_values()) {
201 std::optional<int> SpillSlot =
206 if (MergedResult && *MergedResult != *SpillSlot)
209 MergedResult = SpillSlot;
251 if (isa<FrameIndexSDNode>(Incoming))
278 SDValue OldLocation =
Builder.StatepointLowering.getLocation(Incoming);
283 const int LookUpDepth = 6;
284 std::optional<int>
Index =
289 const auto &StatepointSlots =
Builder.FuncInfo.StatepointStackSlots;
291 auto SlotIt =
find(StatepointSlots, *
Index);
292 assert(SlotIt != StatepointSlots.end() &&
293 "Value spilled to the unknown stack slot");
296 const int Offset = std::distance(StatepointSlots.begin(), SlotIt);
297 if (
Builder.StatepointLowering.isStackSlotAllocated(
Offset)) {
313 Builder.StatepointLowering.setLocation(Incoming, Loc);
322 SDValue ReturnValue, CallEndVal;
323 std::tie(ReturnValue, CallEndVal) =
324 Builder.lowerInvokable(SI.CLI, SI.EHPadBB);
343 bool HasDef = !SI.CLI.RetTy->isVoidTy();
373static std::tuple<SDValue, SDValue, MachineMemOperand*>
383 int Index = cast<FrameIndexSDNode>(Loc)->getIndex();
396 "Bad spill: stack slot does not match!");
401 auto &MF =
Builder.DAG.getMachineFunction();
403 auto *StoreMMO = MF.getMachineMemOperand(
406 Chain =
Builder.DAG.getStore(Chain,
Builder.getCurSDLoc(), Incoming, Loc,
411 Builder.StatepointLowering.setLocation(Incoming, Loc);
415 return std::make_tuple(Loc, Chain, MMO);
433 "Incoming value is a frame index!");
437 auto &MF =
Builder.DAG.getMachineFunction();
463 C->getValueAPF().bitcastToAPInt().getZExtValue());
472 if (!RequireSpillSlot) {
490 if (
auto *MMO = std::get<2>(Res))
492 Chain = std::get<1>(Res);
501 auto *Ty = V->getType();
502 if (!Ty->isPtrOrPtrVectorTy())
505 if (
auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
537 const bool LiveInDeopt =
547 if (
const auto *StInvoke =
548 dyn_cast_or_null<InvokeInst>(SI.StatepointInstr)) {
550 for (
const auto *Relocate : SI.GCRelocates)
551 if (Relocate->getOperand(0) == LPI) {
552 LPadPointers.
insert(
Builder.getValue(Relocate->getBasePtr()));
553 LPadPointers.
insert(
Builder.getValue(Relocate->getDerivedPtr()));
564 unsigned CurNumVRegs = 0;
566 auto canPassGCPtrOnVReg = [&](
SDValue SD) {
567 if (SD.getValueType().isVector())
569 if (LPadPointers.
count(SD))
574 auto processGCPtr = [&](
const Value *V) {
576 if (!LoweredGCPtrs.
insert(PtrSD))
578 GCPtrIndexMap[PtrSD] = LoweredGCPtrs.
size() - 1;
580 assert(!LowerAsVReg.
count(PtrSD) &&
"must not have been seen");
581 if (LowerAsVReg.
size() == MaxVRegPtrs)
584 "IR and SD types disagree");
585 if (!canPassGCPtrOnVReg(PtrSD)) {
590 LowerAsVReg[PtrSD] = CurNumVRegs++;
594 for (
const Value *V : SI.Ptrs)
596 for (
const Value *V : SI.Bases)
601 auto requireSpillSlot = [&](
const Value *V) {
602 if (!
Builder.DAG.getTargetLoweringInfo().isTypeLegal(
603 Builder.getValue(V).getValueType()))
615 for (
const Value *V : SI.DeoptState) {
616 if (requireSpillSlot(V))
620 for (
const Value *V : SI.Ptrs) {
622 if (!LowerAsVReg.
count(SDV))
626 for (
const Value *V : SI.Bases) {
628 if (!LowerAsVReg.
count(SDV))
635 const int NumVMSArgs = SI.DeoptState.size();
641 for (
const Value *V : SI.DeoptState) {
645 if (
const Argument *Arg = dyn_cast<Argument>(V)) {
646 int FI =
Builder.FuncInfo.getArgumentFrameIndex(Arg);
648 Incoming =
Builder.DAG.getFrameIndex(FI,
Builder.getFrameIndexTy());
651 Incoming =
Builder.getValue(V);
653 <<
" requireSpillSlot = " << requireSpillSlot(V) <<
"\n");
660 for (
SDValue SDV : LoweredGCPtrs)
673 for (
Value *V : SI.GCArgs) {
678 "Incoming value is a frame index!");
680 FI->getIndex(),
Builder.getFrameIndexTy()));
682 auto &MF =
Builder.DAG.getMachineFunction();
693 for (
unsigned i = 0; i < SI.Ptrs.size(); ++i) {
697 Builder.DAG.getTargetConstant(GCPtrIndexMap[
Base], L, MVT::i64));
699 assert(GCPtrIndexMap.
count(Derived) &&
"derived not found in index map");
701 Builder.DAG.getTargetConstant(GCPtrIndexMap[Derived], L, MVT::i64));
714 assert(SI.Bases.size() == SI.Ptrs.size() &&
"Pointer without base!");
716 "No gc specified, so cannot relocate pointers!");
719 <<
"Lowering statepoint " << *SI.StatepointInstr <<
"\n");
721 for (
const auto *Reloc : SI.GCRelocates)
722 if (Reloc->getParent() == SI.StatepointInstr->getParent())
755 if (CallHasIncomingGlue) {
767 const bool IsGCTransition =
770 if (IsGCTransition) {
777 for (
const Value *V : SI.GCTransitionArgs) {
779 if (V->getType()->isPointerTy())
784 if (CallHasIncomingGlue)
792 Chain = GCTransitionStart.
getValue(0);
793 Glue = GCTransitionStart.
getValue(1);
808 unsigned NumCallRegArgs =
819 if (CallHasIncomingGlue)
820 RegMaskIt = CallNode->
op_end() - 2;
822 RegMaskIt = CallNode->
op_end() - 1;
829 uint64_t Flags = SI.StatepointFlags;
831 "Unknown flag used");
850 for (
auto SD : LoweredGCArgs) {
851 if (!LowerAsVReg.
count(SD))
856 assert(NodeTys.
size() == LowerAsVReg.
size() &&
"Inconsistent GC Ptr lowering");
860 unsigned NumResults = NodeTys.
size();
869 for (
const auto *Relocate : SI.GCRelocates) {
870 Value *Derived = Relocate->getDerivedPtr();
872 if (!LowerAsVReg.
count(SD))
879 if (SI.StatepointInstr->getParent() == Relocate->getParent()) {
889 if (VirtRegs.
count(SD))
892 auto *
RetTy = Relocate->getType();
898 PendingExports.push_back(Chain);
905 const Instruction *StatepointInstr = SI.StatepointInstr;
915 if (IsLocal && LowerAsVReg.
count(SDV)) {
918 }
else if (LowerAsVReg.
count(SDV)) {
921 Record.payload.Reg = VirtRegs[SDV];
924 Record.payload.FI = cast<FrameIndexSDNode>(Loc)->getIndex();
934 RelocationMap[Relocate] =
Record;
939 SDNode *SinkNode = StatepointMCNode;
945 if (IsGCTransition) {
952 for (
const Value *V : SI.GCTransitionArgs) {
954 if (V->getType()->isPointerTy())
966 SinkNode = GCTransitionStart.
getNode();
973 SDValue StatepointValues[2] = {
SDValue(SinkNode, NumSinkValues - 2),
974 SDValue(SinkNode, NumSinkValues - 1)};
995static std::pair<const GCResultInst*, const GCResultInst*>
997 std::pair<const GCResultInst *, const GCResultInst*> Res(
nullptr,
nullptr);
998 for (
const auto *U : S.
users()) {
999 auto *GRI = dyn_cast<GCResultInst>(U);
1014 "anyregcc is not supported on statepoints!");
1019 "GCStrategy does not expect to encounter statepoints");
1025 if (
I.getNumPatchBytes() > 0) {
1031 ActualCallee =
DAG.
getUNDEF(Callee.getValueType());
1033 ActualCallee = Callee;
1038 I.getNumCallArgs(), ActualCallee,
1039 I.getActualReturnType(),
false );
1056 SI.GCRelocates.push_back(Relocate);
1059 if (Seen.
insert(DerivedSD).second) {
1060 SI.Bases.push_back(Relocate->getBasePtr());
1061 SI.Ptrs.push_back(Relocate->getDerivedPtr());
1071 for (
Value *V :
I.deopt_operands()) {
1075 SI.Bases.push_back(V);
1076 SI.Ptrs.push_back(V);
1081 SI.StatepointInstr = &
I;
1086 I.gc_transition_args_end());
1088 SI.StatepointFlags =
I.getFlags();
1089 SI.NumPatchBytes =
I.getNumPatchBytes();
1090 SI.EHPadBB = EHPadBB;
1097 if (!GCResultLocality.first && !GCResultLocality.second) {
1104 if (GCResultLocality.first) {
1111 if (!GCResultLocality.second)
1121 Type *
RetTy = GCResultLocality.second->getType();
1125 I.getCallingConv());
1129 PendingExports.push_back(Chain);
1135 bool VarArgDisallowed,
bool ForceVoidReturnTy) {
1137 unsigned ArgBeginIndex = Call->arg_begin() - Call->op_begin();
1139 SI.CLI, Call, ArgBeginIndex, Call->arg_size(), Callee,
1142 if (!VarArgDisallowed)
1143 SI.CLI.IsVarArg = Call->getFunctionType()->isVarArg();
1150 SI.ID = SD.StatepointID.value_or(DefaultID);
1151 SI.NumPatchBytes = SD.NumPatchBytes.value_or(0);
1156 SI.EHPadBB = EHPadBB;
1160 LLVM_DEBUG(
dbgs() <<
"Lowering call with deopt bundle " << *Call <<
"\n");
1174void SelectionDAGBuilder::visitGCResult(
const GCResultInst &CI) {
1178 assert((isa<GCStatepointInst>(SI) || isa<UndefValue>(SI)) &&
1179 "GetStatepoint must return one of two types");
1180 if (isa<UndefValue>(SI))
1196 assert(CopyFromReg.getNode());
1200void SelectionDAGBuilder::visitGCRelocate(
const GCRelocateInst &Relocate) {
1207 assert((isa<GCStatepointInst>(Statepoint) || isa<UndefValue>(Statepoint)) &&
1208 "GetStatepoint must return one of two types");
1209 if (isa<UndefValue>(Statepoint))
1217 auto &RelocationMap =
1219 auto SlotIt = RelocationMap.find(&Relocate);
1220 assert(SlotIt != RelocationMap.end() &&
"Relocating not lowered gc value");
1227 "Nonlocal gc.relocate mapped via SDValue");
1243 Chain,
nullptr,
nullptr);
1265 MFI.getObjectSize(
Index),
1266 MFI.getObjectAlign(
Index));
static const Function * getParent(const Value *V)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
This file implements the SmallBitVector class.
This file defines the SmallSet class.
This file defines the SmallVector class.
cl::opt< bool > UseRegistersForGCPointersInLandingPad("use-registers-for-gc-values-in-landing-pad", cl::Hidden, cl::init(false), cl::desc("Allow using registers for gc pointer in landing pad"))
static void lowerIncomingStatepointValue(SDValue Incoming, bool RequireSpillSlot, SmallVectorImpl< SDValue > &Ops, SmallVectorImpl< MachineMemOperand * > &MemRefs, SelectionDAGBuilder &Builder)
Lower a single value incoming to a statepoint node.
static std::optional< int > findPreviousSpillSlot(const Value *Val, SelectionDAGBuilder &Builder, int LookUpDepth)
Utility function for reservePreviousStackSlotForValue.
static void pushStackMapConstant(SmallVectorImpl< SDValue > &Ops, SelectionDAGBuilder &Builder, uint64_t Value)
static bool isGCValue(const Value *V, SelectionDAGBuilder &Builder)
Return true if value V represents the GC value.
static bool willLowerDirectly(SDValue Incoming)
Return true if-and-only-if the given SDValue can be lowered as either a constant argument or a stack ...
static void lowerStatepointMetaArgs(SmallVectorImpl< SDValue > &Ops, SmallVectorImpl< MachineMemOperand * > &MemRefs, SmallVectorImpl< SDValue > &GCPtrs, DenseMap< SDValue, int > &LowerAsVReg, SelectionDAGBuilder::StatepointLoweringInfo &SI, SelectionDAGBuilder &Builder)
Lower deopt state and gc pointer arguments of the statepoint.
static std::pair< const GCResultInst *, const GCResultInst * > getGCResultLocality(const GCStatepointInst &S)
Return two gc.results if present.
cl::opt< bool > UseRegistersForDeoptValues("use-registers-for-deopt-values", cl::Hidden, cl::init(false), cl::desc("Allow using registers for non pointer deopt args"))
cl::opt< unsigned > MaxRegistersForGCPointers("max-registers-for-gc-values", cl::Hidden, cl::init(0), cl::desc("Max number of VRegs allowed to pass GC pointer meta args in"))
static void reservePreviousStackSlotForValue(const Value *IncomingValue, SelectionDAGBuilder &Builder)
Try to find existing copies of the incoming values in stack slots used for statepoint spilling.
FunctionLoweringInfo::StatepointRelocationRecord RecordType
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
static std::pair< SDValue, SDNode * > lowerCallFromStatepointLoweringInfo(SelectionDAGBuilder::StatepointLoweringInfo &SI, SelectionDAGBuilder &Builder)
Extract call from statepoint, lower it and return pointer to the call node.
static std::tuple< SDValue, SDValue, MachineMemOperand * > spillIncomingStatepointValue(SDValue Incoming, SDValue Chain, SelectionDAGBuilder &Builder)
Spill a value incoming to the statepoint.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
This file describes how to lower LLVM code to machine code.
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
This class represents a no-op cast from one type to another.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
This class represents a function call, abstracting a target machine's calling convention.
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
Register CreateRegs(const Value *V)
DenseMap< const Instruction *, StatepointSpillMapTy > StatepointRelocationMaps
DenseMap< const Value *, Register > ValueMap
ValueMap - Since we emit code for the function a basic block at a time, we must remember which virtua...
GCStrategy & getStrategy()
getStrategy - Return the GC strategy for the function.
const Value * getStatepoint() const
The statepoint with which this gc.relocate is associated.
Represents calls to the gc.relocate intrinsic.
Value * getDerivedPtr() const
Represents calls to the gc.result intrinsic.
Represents a gc.statepoint intrinsic call.
bool useStatepoints() const
Returns true if this strategy is expecting the use of gc.statepoints, and false otherwise.
const BasicBlock * getParent() const
The landingpad instruction holds all of the information necessary to generate correct exception handl...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
void markAsStatepointSpillSlotObjectIndex(int ObjectIdx)
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.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags f, uint64_t s, Align base_alignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
A description of a memory reference used in the backend.
@ MOVolatile
The memory access is volatile.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
An SDNode that represents everything that will be needed to construct a MachineInstr.
Wrapper class representing virtual and physical registers.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
unsigned getNumValues() const
Return the number of values defined/returned by this operator.
unsigned getNumOperands() const
Return the number of values used by this operation.
const SDValue & getOperand(unsigned Num) const
SDNode * getGluedNode() const
If this node has a glue operand, return the node to which the glue operand points.
op_iterator op_end() const
op_iterator op_begin() const
Represents a use of a SDNode.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
TypeSize getValueSizeInBits() const
Returns the size of the value in bits.
SelectionDAGBuilder - This is the common target-independent lowering implementation that is parameter...
SDValue getValue(const Value *V)
getValue - Return an SDValue for the given Value.
MVT getFrameIndexTy()
Returns the type of FrameIndex and TargetFrameIndex nodes.
void LowerStatepoint(const GCStatepointInst &I, const BasicBlock *EHPadBB=nullptr)
SDValue lowerRangeToAssertZExt(SelectionDAG &DAG, const Instruction &I, SDValue Op)
void LowerDeoptimizeCall(const CallInst *CI)
void LowerCallSiteWithDeoptBundle(const CallBase *Call, SDValue Callee, const BasicBlock *EHPadBB)
void LowerCallSiteWithDeoptBundleImpl(const CallBase *Call, SDValue Callee, const BasicBlock *EHPadBB, bool VarArgDisallowed, bool ForceVoidReturnTy)
StatepointLoweringState StatepointLowering
State used while lowering a statepoint sequence (gc_statepoint, gc_relocate, and gc_result).
SmallVector< SDValue, 8 > PendingLoads
Loads are not emitted to the program immediately.
GCFunctionInfo * GFI
Garbage collection metadata for the function.
SDValue getRoot()
Similar to getMemoryRoot, but also flushes PendingConstrainedFP(Strict) items.
void ExportFromCurrentBlock(const Value *V)
ExportFromCurrentBlock - If this condition isn't known to be exported from the current basic block,...
SDLoc getCurSDLoc() const
SDValue getCopyFromRegs(const Value *V, Type *Ty)
If there was virtual register allocated for the value V emit CopyFromReg of the specified type Ty.
void populateCallLoweringInfo(TargetLowering::CallLoweringInfo &CLI, const CallBase *Call, unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy, bool IsPatchPoint)
Populate a CallLowerinInfo (into CLI) based on the properties of the call being lowered.
void LowerDeoptimizingReturn()
FunctionLoweringInfo & FuncInfo
Information about the function as a whole.
void setValue(const Value *V, SDValue NewN)
SDValue getControlRoot()
Similar to getRoot, but instead of flushing all the PendingLoad items, flush all the PendingExports (...
SDValue LowerAsSTATEPOINT(StatepointLoweringInfo &SI)
Lower SLI into a STATEPOINT instruction.
const SDValue & getRoot() const
Return the root tag of the SelectionDAG.
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
MachineSDNode * getMachineNode(unsigned Opcode, const SDLoc &dl, EVT VT)
These are used for target selectors to create a new node with specified return type(s),...
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
const TargetLowering & getTargetLoweringInfo() const
SDValue getUNDEF(EVT VT)
Return an UNDEF node. UNDEF does not have a useful SDLoc.
void DeleteNode(SDNode *N)
Remove the specified node from the system.
void setNodeMemRefs(MachineSDNode *N, ArrayRef< MachineMemOperand * > NewMemRefs)
Mutate the specified machine node's memory references to the provided list.
const DataLayout & getDataLayout() const
SDValue getTargetFrameIndex(int FI, EVT VT)
void ReplaceAllUsesWith(SDValue From, SDValue To)
Modify anything using 'From' to use 'To' instead.
SDValue getSrcValue(const Value *v)
Construct a node to track a Value* through the backend.
SDValue getExternalSymbol(const char *Sym, EVT VT)
const TargetMachine & getTarget() const
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
SDValue getTargetConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isOpaque=false)
MachineFunction & getMachineFunction() const
LLVMContext * getContext() const
const SDValue & setRoot(SDValue N)
Set the current root tag of the SelectionDAG.
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
size_type size() const
Determine the number of elements in the SetVector.
Vector takeVector()
Clear the SetVector and return the underlying vector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
bool test(unsigned Idx) const
void clear()
Clear all bits.
size_type size() const
Returns the number of bits in this bitvector.
void resize(unsigned N, bool t=false)
Grow or shrink the bitvector.
A SetVector that performs no allocations if smaller than a certain size.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
iterator insert(iterator I, T &&Elt)
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 clear()
Clear the memory usage of this object.
SDValue getLocation(SDValue Val)
Returns the spill location of a value incoming to the current statepoint.
SDValue allocateStackSlot(EVT ValueType, SelectionDAGBuilder &Builder)
Get a stack slot we can use to store an value of type ValueType.
void scheduleRelocCall(const GCRelocateInst &RelocCall)
Record the fact that we expect to encounter a given gc_relocate before the next statepoint.
void setLocation(SDValue Val, SDValue Location)
void relocCallVisited(const GCRelocateInst &RelocCall)
Remove this gc_relocate from the list we're expecting to see before the next statepoint.
void startNewStatepoint(SelectionDAGBuilder &Builder)
Reset all state tracking for a newly encountered safepoint.
EVT getValueType(const DataLayout &DL, Type *Ty, bool AllowUnknown=false) const
Return the EVT corresponding to this LLVM type.
unsigned TrapUnreachable
Emit target-specific trap instruction for 'unreachable' IR instructions.
The instances of the Type class are immutable: once they are created, they are never changed.
static Type * getVoidTy(LLVMContext &C)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
iterator_range< user_iterator > users()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ AnyReg
Used for dynamic register based calls (e.g.
@ C
The default llvm calling convention, compatible with C.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ GC_TRANSITION_START
GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the beginning and end of GC transition s...
@ CopyFromReg
CopyFromReg - This node indicates that the input value is a virtual or physical register that is defi...
@ TRAP
TRAP - Trapping instruction.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
bool isIntOrFPConstant(SDValue V)
Return true if V is either a integer or FP constant.
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
StatepointDirectives parseStatepointDirectivesFromAttrs(AttributeList AS)
Parse out statepoint directives from the function attributes present in AS.
@ MaskAll
A bitmask that includes all valid flags.
@ DeoptLiveIn
Mark the deopt arguments associated with the statepoint as only being "live-in".
@ GCTransition
Indicates that this statepoint is a transition from GC-aware code to code that is not GC-aware.
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
bool isVector() const
Return true if this is a vector value type.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
This struct represents the registers (physical or virtual) that a particular set of values is assigne...
void getCopyToRegs(SDValue Val, SelectionDAG &DAG, const SDLoc &dl, SDValue &Chain, SDValue *Glue, const Value *V=nullptr, ISD::NodeType PreferredExtendType=ISD::ANY_EXTEND) const
Emit a series of CopyToReg nodes that copies the specified value into the registers specified by this...
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
Describes a gc.statepoint or a gc.statepoint like thing for the purposes of lowering into a STATEPOIN...
static const uint64_t DeoptBundleStatepointID