11 #ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H 12 #define LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H 39 #define CORO_PRESPLIT_ATTR "coroutine.presplit" 40 #define UNPREPARED_FOR_SPLIT "0" 41 #define PREPARED_FOR_SPLIT "1" 42 #define ASYNC_RESTART_AFTER_SPLIT "2" 44 #define CORO_DEVIRT_TRIGGER_FN "coro.devirt.trigger" 49 const std::initializer_list<StringRef>);
162 return cast<CoroIdInst>(CoroBegin->
getId());
168 return cast<AnyCoroIdRetconInst>(CoroBegin->
getId());
173 return cast<CoroIdAsyncInst>(CoroBegin->
getId());
178 assert(FrameTy &&
"frame type not assigned");
179 return SwitchLowering.IndexField;
183 assert(FrameTy &&
"frame type not assigned");
184 return cast<IntegerType>(FrameTy->
getElementType(getSwitchIndexField()));
192 assert(FrameTy &&
"frame type not assigned");
193 return cast<PointerType>(FrameTy->
getElementType(SwitchFieldIndex::Resume));
199 auto *FnPtrTy = getSwitchResumePointerType();
200 return cast<FunctionType>(FnPtrTy->getPointerElementType());
204 return RetconLowering.ResumePrototype->getFunctionType();
206 return AsyncLowering.AsyncFuncTy;
218 if (
auto STy = dyn_cast<StructType>(FTy->getReturnType())) {
219 return STy->elements().slice(1);
230 auto FTy = RetconLowering.ResumePrototype->getFunctionType();
231 return FTy->params().slice(1);
241 return RetconLowering.ResumePrototype->getCallingConv();
250 return SwitchLowering.PromiseAlloca;
266 : ReuseFrameSlot(ReuseFrameSlot) {
The "returned-continuation" lowering, where each suspend point creates a single continuation function...
This represents the llvm.coro.id.async instruction.
The "resume-switch" lowering, where there are separate resume and destroy functions that are shared b...
The "unique returned-continuation" lowering, where each suspend point creates a single continuation f...
void initializeCoroElideLegacyPass(PassRegistry &)
CoroBeginInst * CoroBegin
This represents the llvm.coro.id instruction.
This class represents lattice values for constants.
Type * getElementType(unsigned N) const
A Module instance is used to store all the information related to an LLVM module.
PointerType * getSwitchResumePointerType() const
IntegerType * getIndexType() const
AsyncLoweringStorage AsyncLowering
This class represents a function call, abstracting a target machine's calling convention.
SmallVector< CallInst *, 2 > SwiftErrorOps
RetconLoweringStorage RetconLowering
AllocaInst * PromiseAlloca
uint64_t ContextHeaderSize
GlobalVariable * AsyncFuncPointer
FunctionType * getResumeFunctionType() const
PointerType *const Int8Ptr
Class to represent struct types.
unsigned getSwitchIndexField() const
SwitchInst * ResumeSwitch
Function * ResumePrototype
void updateCallGraph(Function &Caller, ArrayRef< Function * > Funcs, CallGraph &CG, CallGraphSCC &SCC)
ConstantInt * getIndex(uint64_t Value) const
Class to represent function types.
FunctionType *const ResumeFnType
CoroIdInst * getSwitchCoroId() const
SmallVector< CoroSizeInst *, 2 > CoroSizes
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
AnyCoroIdRetconInst * getRetconCoroId() const
This represents either the llvm.coro.id.retcon or llvm.coro.id.retcon.once instruction.
Class to represent pointers.
bool IsFrameInlineInStorage
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
The "async continuation" lowering, where each suspend point creates a single continuation function.
void initializeCoroEarlyLegacyPass(PassRegistry &)
AMDGPU Lower Kernel Arguments
uint64_t ContextAlignment
FunctionType * AsyncFuncTy
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library,...
Class to represent integer types.
const Function * getFunction() const
Return the function this instruction belongs to.
AllocaInst * getPromiseAlloca() const
CallInst * createMustTailCall(DebugLoc Loc, Function *MustTailCallFn, ArrayRef< Value * > Arguments, IRBuilder<> &)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This struct is a compact representation of a valid (non-zero power of two) alignment.
CoroIdAsyncInst * getAsyncCoroId() const
SwitchLoweringStorage SwitchLowering
AnyCoroIdInst * getId() const
bool declaresIntrinsics(const Module &M, const std::initializer_list< StringRef >)
This is the shared class of boolean and integer constants.
ArrayRef< Type * > getRetconResumeTypes() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A constant pointer value that points to null.
ConstantPointerNull *const NullPtr
void buildCoroutineFrame(Function &F, Shape &Shape)
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
CallingConv::ID getResumeFunctionCC() const
FunctionType * getFunctionType() const
Returns the FunctionType for me.
This class represents the llvm.coro.begin instruction.
Value * makeSubFnCall(Value *Arg, int Index, Instruction *InsertPt)
SmallVector< AnyCoroSuspendInst *, 4 > CoroSuspends
BasicBlock * ResumeEntryBlock
The basic data container for the call graph of a Module of IR.
void replaceCoroFree(CoroIdInst *CoroId, bool Elide)
void initializeCoroCleanupLegacyPass(PassRegistry &)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
SmallVector< AnyCoroEndInst *, 4 > CoroEnds
BasicBlock * AllocaSpillBlock
void initializeCoroSplitLegacyPass(PassRegistry &)
Shape(Function &F, bool ReuseFrameSlot=false)
Align getContextAlignment() const
an instruction to allocate memory on the stack
ArrayRef< Type * > getRetconResultTypes() const