LLVM: include/llvm/Transforms/Coroutines/CoroShape.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12#ifndef LLVM_TRANSFORMS_COROUTINES_COROSHAPE_H
13#define LLVM_TRANSFORMS_COROUTINES_COROSHAPE_H
14
19
20namespace llvm {
21
23
24namespace coro {
25
27
28
29
30
32
33
34
35
37
38
39
40
41
42
44
45
46
47
49};
50
51
52
62
63
65
82
83
88
92
94
98
99
101 enum {
104
105
106
107
108
109
110
111 };
112 };
113
115
121
132
140
153
154 union {
158 };
159
164
169
174
188
194
196 switch (ABI) {
200 false);
203 return RetconLowering.ResumePrototype->getFunctionType();
205
206 return nullptr;
207 }
208
210 }
211
214 auto FTy = CoroBegin->getFunction()->getFunctionType();
215
216
218 return STy->elements().slice(1);
219 } else {
221 }
222 }
223
226
227
228 auto FTy = RetconLowering.ResumePrototype->getFunctionType();
229 return FTy->params().slice(1);
230 }
231
233 switch (ABI) {
236
239 return RetconLowering.ResumePrototype->getCallingConv();
242 }
244 }
245
249 return nullptr;
250 }
251
255 It.setHeadBit(true);
256 return It;
257 }
259 }
260
261
262
263
266
267
268
269
272
278
279 analyze(F, CoroFrames, UnusedCoroSaves, CoroPromise);
282 return;
283 }
284 cleanCoroutine(CoroFrames, UnusedCoroSaves, CoroPromise);
285 }
286};
287
288}
289
290}
291
292#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This header defines various interfaces for pass management in LLVM.
an instruction to allocate memory on the stack
This represents either the llvm.coro.id.retcon or llvm.coro.id.retcon.once instruction.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
InstListType::iterator iterator
Instruction iterators...
The basic data container for the call graph of a Module of IR.
This is the shared class of boolean and integer constants.
This class represents the llvm.coro.begin or llvm.coro.begin.custom.abi instructions.
This represents the llvm.coro.id.async instruction.
This represents the llvm.coro.id instruction.
This represents the llvm.coro.promise instruction.
Class to represent function types.
static LLVM_ABI FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
Class to represent integer types.
Class to represent pointers.
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Class to represent struct types.
static LLVM_ABI Type * getVoidTy(LLVMContext &C)
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ Fast
Attempts to make calls as fast as possible (e.g.
ABI
Definition CoroShape.h:26
@ Async
The "async continuation" lowering, where each suspend point creates a single continuation function.
Definition CoroShape.h:48
@ RetconOnce
The "unique returned-continuation" lowering, where each suspend point creates a single continuation f...
Definition CoroShape.h:43
@ Retcon
The "returned-continuation" lowering, where each suspend point creates a single continuation function...
Definition CoroShape.h:36
@ Switch
The "resume-switch" lowering, where there are separate resume and destroy functions that are shared b...
Definition CoroShape.h:31
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition CoroShape.h:141
GlobalVariable * AsyncFuncPointer
Definition CoroShape.h:149
Align getContextAlignment() const
Definition CoroShape.h:151
uint64_t FrameOffset
Definition CoroShape.h:147
uint64_t ContextHeaderSize
Definition CoroShape.h:145
unsigned ContextArgNo
Definition CoroShape.h:144
CallingConv::ID AsyncCC
Definition CoroShape.h:143
uint64_t ContextAlignment
Definition CoroShape.h:146
uint64_t ContextSize
Definition CoroShape.h:148
Value * Context
Definition CoroShape.h:142
Definition CoroShape.h:133
bool IsFrameInlineInStorage
Definition CoroShape.h:138
Function * Alloc
Definition CoroShape.h:135
Function * Dealloc
Definition CoroShape.h:136
BasicBlock * ReturnBlock
Definition CoroShape.h:137
Function * ResumePrototype
Definition CoroShape.h:134
Definition CoroShape.h:100
@ Resume
Definition CoroShape.h:102
@ Destroy
Definition CoroShape.h:103
Definition CoroShape.h:122
unsigned IndexField
Definition CoroShape.h:126
unsigned IndexOffset
Definition CoroShape.h:128
bool HasFinalSuspend
Definition CoroShape.h:129
bool HasUnwindCoroEnd
Definition CoroShape.h:130
AllocaInst * PromiseAlloca
Definition CoroShape.h:124
unsigned IndexAlign
Definition CoroShape.h:127
SwitchInst * ResumeSwitch
Definition CoroShape.h:123
BasicBlock * ResumeEntryBlock
Definition CoroShape.h:125
SmallVector< CallInst *, 2 > SymmetricTransfers
Definition CoroShape.h:61
Align FrameAlign
Definition CoroShape.h:117
SmallVector< CoroAwaitSuspendInst *, 4 > CoroAwaitSuspends
Definition CoroShape.h:60
AsyncLoweringStorage AsyncLowering
Definition CoroShape.h:157
FunctionType * getResumeFunctionType() const
Definition CoroShape.h:195
IntegerType * getIndexType() const
Definition CoroShape.h:180
StructType * FrameTy
Definition CoroShape.h:116
LLVM_ABI void cleanCoroutine(SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves, CoroPromiseInst *CoroPromise)
AnyCoroIdRetconInst * getRetconCoroId() const
Definition CoroShape.h:165
PointerType * getSwitchResumePointerType() const
Definition CoroShape.h:189
CoroIdInst * getSwitchCoroId() const
Definition CoroShape.h:160
SmallVector< CoroSizeInst *, 2 > CoroSizes
Definition CoroShape.h:57
LLVM_ABI void analyze(Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames, SmallVectorImpl< CoroSaveInst * > &UnusedCoroSaves, CoroPromiseInst *&CoroPromise)
CallingConv::ID getResumeFunctionCC() const
Definition CoroShape.h:232
coro::ABI ABI
Definition CoroShape.h:114
Shape(Function &F)
Definition CoroShape.h:274
ArrayRef< Type * > getRetconResumeTypes() const
Definition CoroShape.h:224
Value * FramePtr
Definition CoroShape.h:119
SmallVector< AnyCoroSuspendInst *, 4 > CoroSuspends
Definition CoroShape.h:59
uint64_t FrameSize
Definition CoroShape.h:118
LLVM_ABI Value * emitAlloc(IRBuilder<> &Builder, Value *Size, CallGraph *CG) const
Allocate memory according to the rules of the active lowering.
ConstantInt * getIndex(uint64_t Value) const
Definition CoroShape.h:185
AllocaInst * getPromiseAlloca() const
Definition CoroShape.h:246
void clear()
Definition CoroShape.h:66
SwitchLoweringStorage SwitchLowering
Definition CoroShape.h:155
CoroBeginInst * CoroBegin
Definition CoroShape.h:54
BasicBlock::iterator getInsertPtAfterFramePtr() const
Definition CoroShape.h:252
ArrayRef< Type * > getRetconResultTypes() const
Definition CoroShape.h:212
SmallVector< CoroIsInRampInst *, 2 > CoroIsInRampInsts
Definition CoroShape.h:56
LLVM_ABI void emitDealloc(IRBuilder<> &Builder, Value *Ptr, CallGraph *CG) const
Deallocate memory according to the rules of the active lowering.
RetconLoweringStorage RetconLowering
Definition CoroShape.h:156
SmallVector< CoroAlignInst *, 2 > CoroAligns
Definition CoroShape.h:58
CoroIdAsyncInst * getAsyncCoroId() const
Definition CoroShape.h:170
SmallVector< AnyCoroEndInst *, 4 > CoroEnds
Definition CoroShape.h:55
SmallVector< CallInst *, 2 > SwiftErrorOps
Definition CoroShape.h:64
LLVM_ABI void invalidateCoroutine(Function &F, SmallVectorImpl< CoroFrameInst * > &CoroFrames)
BasicBlock * AllocaSpillBlock
Definition CoroShape.h:120
unsigned getSwitchIndexField() const
Definition CoroShape.h:175