11 #ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H 12 #define LLVM_LIB_TRANSFORMS_COROUTINES_COROINTERNAL_H 38 #define CORO_PRESPLIT_ATTR "coroutine.presplit" 39 #define UNPREPARED_FOR_SPLIT "0" 40 #define PREPARED_FOR_SPLIT "1" 42 #define CORO_DEVIRT_TRIGGER_FN "coro.devirt.trigger" 47 const std::initializer_list<StringRef>);
135 return cast<CoroIdInst>(CoroBegin->
getId());
141 return cast<AnyCoroIdRetconInst>(CoroBegin->
getId());
146 assert(FrameTy &&
"frame type not assigned");
155 assert(FrameTy &&
"frame type not assigned");
156 return cast<PointerType>(FrameTy->
getElementType(SwitchFieldIndex::Resume));
162 auto *FnPtrTy = getSwitchResumePointerType();
163 return cast<FunctionType>(FnPtrTy->getPointerElementType());
167 return RetconLowering.ResumePrototype->getFunctionType();
178 if (
auto STy = dyn_cast<StructType>(FTy->getReturnType())) {
179 return STy->elements().slice(1);
190 auto FTy = RetconLowering.ResumePrototype->getFunctionType();
191 return FTy->params().slice(1);
201 return RetconLowering.ResumePrototype->getCallingConv();
209 return SwitchFieldIndex::FirstSpill;
220 return SwitchLowering.PromiseAlloca;
The "returned-continuation" lowering, where each suspend point creates a single continuation function...
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
SmallVector< CallInst *, 2 > SwiftErrorOps
RetconLoweringStorage RetconLowering
AllocaInst * PromiseAlloca
FunctionType * getResumeFunctionType() const
PointerType *const Int8Ptr
Class to represent struct types.
SwitchInst * ResumeSwitch
Function * ResumePrototype
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.
void replaceAllCoroFrees(CoroBeginInst *CB, Value *Replacement)
bool IsFrameInlineInStorage
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
void initializeCoroEarlyLegacyPass(PassRegistry &)
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
#define LLVM_LIBRARY_VISIBILITY
LLVM_LIBRARY_VISIBILITY - If a class marked with this attribute is linked into a shared library...
unsigned getFirstSpillFieldIndex() const
Class to represent integer types.
const Function * getFunction() const
Return the function this instruction belongs to.
AllocaInst * getPromiseAlloca() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
SwitchLoweringStorage SwitchLowering
AnyCoroIdInst * getId() const
bool declaresIntrinsics(const Module &M, const std::initializer_list< StringRef >)
void replaceAllCoroAllocs(CoroBeginInst *CB, bool Replacement)
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())
SmallVector< CoroEndInst *, 4 > CoroEnds
LLVM Value Representation.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
CallGraphSCC - This is a single SCC that a CallGraphSCCPass is run on.
BasicBlock * AllocaSpillBlock
void initializeCoroSplitLegacyPass(PassRegistry &)
void updateCallGraph(Function &Caller, ArrayRef< Function *> Funcs, CallGraph &CG, CallGraphSCC &SCC)
an instruction to allocate memory on the stack
ArrayRef< Type * > getRetconResultTypes() const