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");
73 SDLoc L = Builder.getCurSDLoc();
74 Ops.push_back(Builder.DAG.getTargetConstant(StackMaps::ConstantOp, L,
76 Ops.push_back(Builder.DAG.getTargetConstant(
Value, L, MVT::i64));
81 assert(PendingGCRelocateCalls.empty() &&
82 "Trying to visit statepoint before finished processing previous one");
84 NextSlotToAllocate = 0;
88 AllocatedStackSlots.clear();
89 AllocatedStackSlots.resize(Builder.FuncInfo.StatepointStackSlots.size());
94 AllocatedStackSlots.clear();
95 assert(PendingGCRelocateCalls.empty() &&
96 "cleared before statepoint sequence completed");
102 NumSlotsAllocatedForStatepoints++;
105 unsigned SpillSize =
ValueType.getStoreSize();
107 (-8u & (7 +
ValueType.getSizeInBits())) &&
108 "Size not in bytes?");
114 const size_t NumSlots = AllocatedStackSlots.size();
115 assert(NextSlotToAllocate <= NumSlots &&
"Broken invariant");
117 assert(AllocatedStackSlots.size() ==
118 Builder.FuncInfo.StatepointStackSlots.size() &&
121 for (; NextSlotToAllocate < NumSlots; NextSlotToAllocate++) {
122 if (!AllocatedStackSlots.test(NextSlotToAllocate)) {
123 const int FI = Builder.FuncInfo.StatepointStackSlots[NextSlotToAllocate];
125 AllocatedStackSlots.set(NextSlotToAllocate);
127 return Builder.DAG.getFrameIndex(FI,
ValueType);
138 Builder.FuncInfo.StatepointStackSlots.push_back(FI);
139 AllocatedStackSlots.resize(AllocatedStackSlots.size()+1,
true);
140 assert(AllocatedStackSlots.size() ==
141 Builder.FuncInfo.StatepointStackSlots.size() &&
144 StatepointMaxSlotsRequired.updateMax(
145 Builder.FuncInfo.StatepointStackSlots.size());
157 if (LookUpDepth <= 0)
162 const Value *Statepoint = Relocate->getStatepoint();
164 "GetStatepoint must return one of two types");
168 const auto &RelocationMap = Builder.FuncInfo.StatepointRelocationMaps
171 auto It = RelocationMap.find(Relocate);
172 if (It == RelocationMap.end())
175 auto &
Record = It->second;
190 std::optional<int> MergedResult;
192 for (
const auto &IncomingValue : Phi->incoming_values()) {
193 std::optional<int> SpillSlot =
198 if (MergedResult && *MergedResult != *SpillSlot)
201 MergedResult = SpillSlot;
296 SDValue OldLocation = Builder.StatepointLowering.getLocation(Incoming);
301 const int LookUpDepth = 6;
302 std::optional<int> Index =
307 const auto &StatepointSlots = Builder.FuncInfo.StatepointStackSlots;
309 auto SlotIt =
find(StatepointSlots, *Index);
310 assert(SlotIt != StatepointSlots.end() &&
311 "Value spilled to the unknown stack slot");
314 const int Offset = std::distance(StatepointSlots.begin(), SlotIt);
315 if (Builder.StatepointLowering.isStackSlotAllocated(
Offset)) {
325 Builder.StatepointLowering.reserveStackSlot(
Offset);
330 Builder.DAG.getTargetFrameIndex(*Index, Builder.getFrameIndexTy());
331 Builder.StatepointLowering.setLocation(Incoming,
Loc);
340 SDValue ReturnValue, CallEndVal;
341 std::tie(ReturnValue, CallEndVal) =
342 Builder.lowerInvokable(
SI.CLI,
SI.EHPadBB);
364 bool HasDef = !
SI.CLI.RetTy->isVoidTy();
394static std::tuple<SDValue, SDValue, MachineMemOperand*>
397 SDValue Loc = Builder.StatepointLowering.getLocation(Incoming);
401 if (!
Loc.getNode()) {
402 Loc = Builder.StatepointLowering.allocateStackSlot(Incoming.
getValueType(),
406 Loc = Builder.DAG.getTargetFrameIndex(Index, Builder.getFrameIndexTy());
417 "Bad spill: stack slot does not match!");
422 auto &
MF = Builder.DAG.getMachineFunction();
427 Chain = Builder.DAG.getStore(Chain, Builder.getCurSDLoc(), Incoming,
Loc,
432 Builder.StatepointLowering.setLocation(Incoming,
Loc);
436 return std::make_tuple(
Loc, Chain, MMO);
454 "Incoming value is a frame index!");
455 Ops.push_back(Builder.DAG.getTargetFrameIndex(FI->getIndex(),
456 Builder.getFrameIndexTy()));
458 auto &
MF = Builder.DAG.getMachineFunction();
484 C->getValueAPF().bitcastToAPInt().getZExtValue());
493 if (!RequireSpillSlot) {
501 Ops.push_back(Incoming);
508 SDValue Chain = Builder.getRoot();
510 Ops.push_back(std::get<0>(Res));
511 if (
auto *MMO = std::get<2>(Res))
513 Chain = std::get<1>(Res);
514 Builder.DAG.setRoot(Chain);
522 auto *Ty =
V->getType();
523 if (!Ty->isPtrOrPtrVectorTy())
525 if (
auto *GFI = Builder.GFI)
526 if (
auto IsManaged = GFI->getStrategy().isGCManagedPointer(Ty))
558 const bool LiveInDeopt =
562 unsigned MaxVRegPtrs =
563 Builder.DAG.getSelectionDAGOptions().max_registers_for_gc_values;
568 if (!Builder.DAG.getSelectionDAGOptions()
569 .use_registers_for_gc_values_in_landing_pad) {
570 if (
const auto *StInvoke =
573 for (
const auto *Relocate :
SI.GCRelocates)
574 if (Relocate->getOperand(0) == LPI) {
575 LPadPointers.
insert(Builder.getValue(Relocate->getBasePtr()));
576 LPadPointers.
insert(Builder.getValue(Relocate->getDerivedPtr()));
588 unsigned CurNumVRegs = 0;
590 auto canPassGCPtrOnVReg = [&](
SDValue SD) {
591 if (SD.getValueType().isVector())
593 if (LPadPointers.
count(SD))
598 auto processGCPtr = [&](
const Value *
V) {
600 if (!LoweredGCPtrs.
insert(PtrSD))
602 GCPtrIndexMap[PtrSD] = LoweredGCPtrs.
size() - 1;
604 assert(!LowerAsVReg.
count(PtrSD) &&
"must not have been seen");
605 if (LowerAsVReg.
size() == MaxVRegPtrs)
608 "IR and SD types disagree");
609 if (!canPassGCPtrOnVReg(PtrSD)) {
614 LowerAsVReg[PtrSD] = CurNumVRegs++;
625 auto requireSpillSlot = [&](
const Value *
V) {
626 if (!Builder.DAG.getTargetLoweringInfo().isTypeLegal(
627 Builder.getValue(
V).getValueType()))
630 return !LowerAsVReg.
count(Builder.getValue(
V));
633 Builder.DAG.getSelectionDAGOptions().use_registers_for_deopt_values);
641 for (
const Value *
V :
SI.DeoptState) {
642 if (requireSpillSlot(
V))
648 if (!LowerAsVReg.
count(SDV))
654 if (!LowerAsVReg.
count(SDV))
661 const int NumVMSArgs =
SI.DeoptState.size();
667 for (
const Value *
V :
SI.DeoptState) {
672 int FI = Builder.FuncInfo.getArgumentFrameIndex(Arg);
674 Incoming = Builder.DAG.getFrameIndex(FI, Builder.getFrameIndexTy());
679 <<
" requireSpillSlot = " << requireSpillSlot(
V) <<
"\n");
686 for (
SDValue SDV : LoweredGCPtrs)
704 "Incoming value is a frame index!");
705 Allocas.
push_back(Builder.DAG.getTargetFrameIndex(
706 FI->getIndex(), Builder.getFrameIndexTy()));
708 auto &
MF = Builder.DAG.getMachineFunction();
718 SDLoc L = Builder.getCurSDLoc();
719 for (
unsigned i = 0; i <
SI.Ptrs.size(); ++i) {
723 Builder.DAG.getTargetConstant(GCPtrIndexMap[
Base], L, MVT::i64));
725 assert(GCPtrIndexMap.
count(Derived) &&
"derived not found in index map");
727 Builder.DAG.getTargetConstant(GCPtrIndexMap[Derived], L, MVT::i64));
740 assert(
SI.Bases.size() ==
SI.Ptrs.size() &&
"Pointer without base!");
742 "No gc specified, so cannot relocate pointers!");
745 <<
"Lowering statepoint " << *
SI.StatepointInstr <<
"\n");
747 for (
const auto *
Reloc :
SI.GCRelocates)
748 if (
Reloc->getParent() ==
SI.StatepointInstr->getParent())
781 if (CallHasIncomingGlue) {
793 const bool IsGCTransition =
796 if (IsGCTransition) {
803 for (
const Value *V :
SI.GCTransitionArgs) {
805 if (V->getType()->isPointerTy())
810 if (CallHasIncomingGlue)
813 SDVTList NodeTys =
DAG.getVTList(MVT::Other, MVT::Glue);
818 Chain = GCTransitionStart.
getValue(0);
819 Glue = GCTransitionStart.
getValue(1);
834 unsigned NumCallRegArgs =
840 Ops.push_back(CallTarget);
845 if (CallHasIncomingGlue)
846 RegMaskIt = CallNode->
op_end() - 2;
848 RegMaskIt = CallNode->
op_end() - 1;
855 uint64_t Flags =
SI.StatepointFlags;
857 "Unknown flag used");
864 Ops.push_back(*RegMaskIt);
867 Ops.push_back(Chain);
876 for (
auto SD : LoweredGCArgs) {
877 if (!LowerAsVReg.
count(SD))
882 assert(NodeTys.
size() == LowerAsVReg.
size() &&
"Inconsistent GC Ptr lowering");
886 unsigned NumResults = NodeTys.
size();
889 DAG.setNodeMemRefs(StatepointMCNode, MemRefs);
895 for (
const auto *Relocate :
SI.GCRelocates) {
896 Value *Derived = Relocate->getDerivedPtr();
898 auto It = LowerAsVReg.
find(SD);
899 if (It == LowerAsVReg.
end())
906 if (
SI.StatepointInstr->getParent() == Relocate->getParent()) {
916 auto [VRegIt, Inserted] = VirtRegs.
try_emplace(SD);
920 auto *RetTy = Relocate->getType();
923 DAG.getDataLayout(), Reg, RetTy, std::nullopt);
926 PendingExports.push_back(Chain);
928 VRegIt->second = Reg;
934 auto &RelocationMap =
FuncInfo.StatepointRelocationMaps[StatepointInstr];
943 if (LowerAsVReg.
count(SDV)) {
949 auto It = VirtRegs.
find(SDV);
951 Record.payload.Reg = It->second;
953 }
else if (
Loc.getNode()) {
965 Record.RematLeaf.emplace(SDV);
967 RelocationMap[Relocate] =
Record;
970 SDNode *SinkNode = StatepointMCNode;
976 if (IsGCTransition) {
983 for (
const Value *V :
SI.GCTransitionArgs) {
985 if (V->getType()->isPointerTy())
992 SDVTList NodeTys =
DAG.getVTList(MVT::Other, MVT::Glue);
997 SinkNode = GCTransitionStart.
getNode();
1004 SDValue StatepointValues[2] = {
SDValue(SinkNode, NumSinkValues - 2),
1005 SDValue(SinkNode, NumSinkValues - 1)};
1006 DAG.ReplaceAllUsesWith(CallNode, StatepointValues);
1008 DAG.DeleteNode(CallNode);
1026static std::pair<const GCResultInst*, const GCResultInst*>
1028 std::pair<const GCResultInst *, const GCResultInst*> Res(
nullptr,
nullptr);
1029 for (
const auto *U : S.
users()) {
1045 "anyregcc is not supported on statepoints!");
1049 assert(
GFI->getStrategy().useStatepoints() &&
1050 "GCStrategy does not expect to encounter statepoints");
1056 if (
I.getNumPatchBytes() > 0) {
1062 ActualCallee =
DAG.getUNDEF(Callee.getValueType());
1064 ActualCallee = Callee;
1069 if (GCResultLocality.first)
1070 retAttrs = GCResultLocality.first->getAttributes().getRetAttrs();
1074 I.getNumCallArgs(), ActualCallee,
1075 I.getActualReturnType(), retAttrs,
1093 SI.GCRelocates.push_back(Relocate);
1096 if (Seen.
insert(DerivedSD).second) {
1097 SI.Bases.push_back(Relocate->getBasePtr());
1098 SI.Ptrs.push_back(Relocate->getDerivedPtr());
1108 for (Value *V :
I.deopt_operands()) {
1112 SI.Bases.push_back(V);
1113 SI.Ptrs.push_back(V);
1118 SI.StatepointInstr = &
I;
1123 I.gc_transition_args_end());
1125 SI.StatepointFlags =
I.getFlags();
1126 SI.NumPatchBytes =
I.getNumPatchBytes();
1127 SI.EHPadBB = EHPadBB;
1132 if (!GCResultLocality.first && !GCResultLocality.second) {
1139 if (GCResultLocality.first) {
1146 if (!GCResultLocality.second)
1156 Type *RetTy = GCResultLocality.second->getType();
1159 DAG.getDataLayout(), Reg, RetTy,
1160 I.getCallingConv());
1164 PendingExports.push_back(Chain);
1170 bool VarArgDisallowed,
bool ForceVoidReturnTy) {
1174 unsigned ArgBeginIndex =
Call->arg_begin() -
Call->op_begin();
1176 SI.CLI,
Call, ArgBeginIndex,
Call->arg_size(), Callee,
1178 Call->getAttributes().getRetAttrs(),
false);
1179 if (!VarArgDisallowed)
1180 SI.CLI.IsVarArg =
Call->getFunctionType()->isVarArg();
1187 SI.ID = SD.StatepointID.value_or(DefaultID);
1188 SI.NumPatchBytes = SD.NumPatchBytes.value_or(0);
1193 SI.EHPadBB = EHPadBB;
1211void SelectionDAGBuilder::visitGCResult(
const GCResultInst &CI) {
1216 "GetStatepoint must return one of two types");
1231 SDValue CopyFromReg = getCopyFromRegs(
SI, RetTy);
1233 assert(CopyFromReg.getNode());
1234 setValue(&CI, CopyFromReg);
1237void SelectionDAGBuilder::visitGCRelocate(
const GCRelocateInst &Relocate) {
1245 "GetStatepoint must return one of two types");
1250 StatepointLowering.relocCallVisited(Relocate);
1254 auto &RelocationMap =
1256 auto SlotIt = RelocationMap.find(&Relocate);
1257 assert(SlotIt != RelocationMap.end() &&
"Relocating not lowered gc value");
1264 "Nonlocal gc.relocate mapped via SDValue");
1267 setValue(&Relocate, SDV);
1272 RegsForValue RFV(*DAG.getContext(), DAG.getTargetLoweringInfo(),
1273 DAG.getDataLayout(), InReg, Relocate.
getType(),
1278 SDValue Chain = DAG.getRoot();
1279 SDValue Relocation = RFV.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(),
1280 Chain,
nullptr,
nullptr);
1281 setValue(&Relocate, Relocation);
1287 SDValue SpillSlot = DAG.getFrameIndex(Index, getFrameIndexTy());
1296 const SDValue Chain = DAG.getRoot();
1298 auto &
MF = DAG.getMachineFunction();
1299 auto &MFI =
MF.getFrameInfo();
1302 MFI.getObjectSize(Index),
1303 MFI.getObjectAlign(Index));
1305 auto LoadVT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
1309 DAG.getLoad(LoadVT, getCurSDLoc(), Chain, SpillSlot, LoadMMO);
1310 PendingLoads.push_back(SpillLoad.
getValue(1));
1313 setValue(&Relocate, SpillLoad);
1322 EVT VT = DAG.getTargetLoweringInfo().getValueType(DAG.getDataLayout(),
1325 Record.RematLeaf->rematerialize(DAG, getCurSDLoc(), VT));
1339 setValue(&Relocate, SD);
1343 const auto &
TLI =
DAG.getTargetLoweringInfo();
1345 RTLIB::LibcallImpl DeoptImpl =
1346 DAG.getLibcalls().getLibcallImpl(RTLIB::DEOPTIMIZE);
1347 if (DeoptImpl == RTLIB::Unsupported) {
1348 DAG.getContext()->emitError(
"no deoptimize libcall available");
1353 DAG.getExternalSymbol(DeoptImpl,
TLI.getPointerTy(
DAG.getDataLayout()));
1368 if (
DAG.getTarget().Options.TrapUnreachable)
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static const Function * getParent(const Value *V)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static DeltaTreeNode * getRoot(void *Root)
static constexpr Value * getValue(Ty &ValueOrUse)
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
Promote Memory to Register
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.
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 constexpr uint32_t UndefStackMapValue
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.
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.
This class holds the attributes for a particular argument, parameter, function, or return value.
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.
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
LLVM_ABI const Value * getStatepoint() const
The statepoint with which this gc.relocate is associated.
Represents calls to the gc.relocate intrinsic.
LLVM_ABI Value * getDerivedPtr() const
Represents calls to the gc.result intrinsic.
Represents a gc.statepoint intrinsic call.
iterator_range< user_iterator > users()
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.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
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
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.
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).
void populateCallLoweringInfo(TargetLowering::CallLoweringInfo &CLI, const CallBase *Call, unsigned ArgIdx, unsigned NumArgs, SDValue Callee, Type *ReturnTy, AttributeSet RetAttrs, bool IsPatchPoint)
Populate a CallLowerinInfo (into CLI) based on the properties of the call being lowered.
GCFunctionInfo * GFI
Garbage collection metadata for the function.
SDLoc getCurSDLoc() const
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.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
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.
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 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 allocateStackSlot(EVT ValueType, SelectionDAGBuilder &Builder)
Get a stack slot we can use to store an value of type ValueType.
void startNewStatepoint(SelectionDAGBuilder &Builder)
Reset all state tracking for a newly encountered safepoint.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
const ParentTy * getParent() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ AnyReg
OBSOLETED - Used for stack based JavaScript calls.
@ LOAD
LOAD and STORE have token chains as their first operand, then the same operands as an LLVM load/store...
@ EH_LABEL
EH_LABEL - Represents a label in mid basic block used to track locations needed for debug and excepti...
@ 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.
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.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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 range R to container C.
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Value
auto dyn_cast_or_null(const Y &Val)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
LLVM_ABI StatepointDirectives parseStatepointDirectivesFromAttrs(AttributeList AS)
Parse out statepoint directives from the function attributes present in AS.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
ArrayRef(const T &OneElt) -> ArrayRef< T >
@ 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.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
PointerUnion< const Value *, const PseudoSourceValue * > ValueType
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.
LLVM_ABI SDValue rematerialize(SelectionDAG &DAG, const SDLoc &DL, EVT VT) const
Rebuild the captured leaf as a fresh SDValue of type VT.
LLVM_ABI StatepointDirectLeaf(SDValue V)
Capture the leaf V, which must be a directly-lowered value.
Helper object to track which of three possible relocation mechanisms are used for a particular value ...
static LLVM_ABI 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