LLVM: lib/Transforms/Coroutines/CoroCloner.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_LIB_TRANSFORMS_COROUTINES_COROCLONER_H
14#define LLVM_LIB_TRANSFORMS_COROUTINES_COROCLONER_H
15
22
24
26
28
29
31
32
34
35
37
38
40};
41
43protected:
50
54
55
56
58
59
70 assert(NewF && "need existing function for continuation");
72 }
73
74public:
79
81
82
95
97 assert(NewF != nullptr && "declaration not yet set");
99 }
100
101 virtual void create();
102
103protected:
109 return false;
112 return true;
113 }
115 }
116
126};
127
129protected:
130
134
135 void create() override;
136
137public:
138
149};
150
151}
152
153#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
The TimeTraceScope is a helper class to call the begin and end functions of the time trace profiler.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
void replaceSwiftErrorOps()
AnyCoroSuspendInst * ActiveSuspend
The active suspend instruction; meaningful only for continuation and async ABIs.
Definition CoroCloner.h:57
Value * deriveNewFramePointer()
Derive the value of the new frame pointer.
void replaceCoroSuspends()
Value * NewFramePtr
Definition CoroCloner.h:53
Function & OrigF
Definition CoroCloner.h:44
void handleFinalSuspend()
TargetTransformInfo & TTI
Definition CoroCloner.h:49
virtual ~BaseCloner()=default
BaseCloner(Function &OrigF, const Twine &Suffix, coro::Shape &Shape, Function *NewF, AnyCoroSuspendInst *ActiveSuspend, TargetTransformInfo &TTI)
Create a cloner for a continuation lowering.
Definition CoroCloner.h:60
coro::Shape & Shape
Definition CoroCloner.h:46
static Function * createClone(Function &OrigF, const Twine &Suffix, coro::Shape &Shape, Function *NewF, AnyCoroSuspendInst *ActiveSuspend, TargetTransformInfo &TTI)
Create a clone for a continuation lowering.
Definition CoroCloner.h:83
void replaceCoroIsInRamp()
BaseCloner(Function &OrigF, const Twine &Suffix, coro::Shape &Shape, CloneKind FKind, TargetTransformInfo &TTI)
Definition CoroCloner.h:75
ValueToValueMapTy VMap
Definition CoroCloner.h:51
Function * NewF
Definition CoroCloner.h:52
bool isSwitchDestroyFunction()
Definition CoroCloner.h:104
const Twine & Suffix
Definition CoroCloner.h:45
CloneKind FKind
Definition CoroCloner.h:47
IRBuilder Builder
Definition CoroCloner.h:48
Function * getFunction() const
Definition CoroCloner.h:96
void replaceRetconOrAsyncSuspendUses()
Replace uses of the active llvm.coro.suspend.retcon/async call with the arguments to the continuation...
virtual void create()
Clone the body of the original function into a resume function of some sort.
static Function * createClone(Function &OrigF, const Twine &Suffix, coro::Shape &Shape, CloneKind FKind, TargetTransformInfo &TTI)
Create a clone for a switch lowering.
Definition CoroCloner.h:139
void create() override
Clone the body of the original function into a resume function of some sort.
SwitchCloner(Function &OrigF, const Twine &Suffix, coro::Shape &Shape, CloneKind FKind, TargetTransformInfo &TTI)
Create a cloner for a switch lowering.
Definition CoroCloner.h:131
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ Async
The "async continuation" lowering, where each suspend point creates a single continuation function.
@ RetconOnce
The "unique returned-continuation" lowering, where each suspend point creates a single continuation f...
@ Retcon
The "returned-continuation" lowering, where each suspend point creates a single continuation function...
@ Switch
The "resume-switch" lowering, where there are separate resume and destroy functions that are shared b...
CloneKind
Definition CoroCloner.h:25
@ Async
An async resume function.
Definition CoroCloner.h:39
@ SwitchCleanup
The shared cleanup function for a switch lowering.
Definition CoroCloner.h:33
@ SwitchResume
The shared resume function for a switch lowering.
Definition CoroCloner.h:27
@ SwitchUnwind
The shared unwind function for a switch lowering.
Definition CoroCloner.h:30
@ Continuation
An individual continuation function.
Definition CoroCloner.h:36
ValueMap< const Value *, WeakTrackingVH > ValueToValueMapTy