LLVM: include/llvm/Transforms/Coroutines/SuspendCrossingInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H
16#define LLVM_TRANSFORMS_COROUTINES_SUSPENDCROSSINGINFO_H
17
26
27namespace llvm {
28
30
31
34
35public:
36 size_t size() const { return V.size(); }
37
40 V.push_back(&BB);
42 }
43
46 assert(I != V.end() && *I == BB && "BasicBlockNumberng: Unknown block");
47 return I - V.begin();
48 }
49
51};
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
70
71 struct BlockData {
74 bool Suspend = false;
75 bool End = false;
76 bool KillLoop = false;
78 };
80
82 BasicBlock *BB = Mapping.indexToBlock(&BD - &Block[0]);
84 }
85
86 BlockData &getBlockData(BasicBlock *BB) {
87 return Block[Mapping.blockToIndex(BB)];
88 }
89
90
91
92
93
94 template
96
97public:
98#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
99
100 void dump() const;
104#endif
105
110
111
112
115
116
117
118
121
124
125
126
128 if (PN->getNumIncomingValues() > 1)
129 return false;
130
132
133
134
135
138 assert(UseBB && "should have split coro.suspend into its own block");
139 }
140
142 }
143
147
149 auto *DefBB = I.getParent();
150
151
152
153
155 DefBB = DefBB->getSingleSuccessor();
156 assert(DefBB && "should have split coro.suspend into its own block");
157 }
158
160 }
161
167
169 "Coroutine could only collect Argument and Instruction now.");
170 }
171
176 return true;
180 return true;
181 }
182
184 "Coroutine could only collect Argument and Instruction now.");
185 }
186};
187
188}
189
190#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file builds on the ADT/GraphTraits.h file to build a generic graph post order iterator.
This file defines the SmallVector class.
This class represents an incoming formal argument to a Function.
LLVM Basic Block Representation.
LLVM_ABI const BasicBlock * getSinglePredecessor() const
Return the predecessor of this block if it has a single predecessor block.
size_t blockToIndex(BasicBlock const *BB) const
Definition SuspendCrossingInfo.h:44
size_t size() const
Definition SuspendCrossingInfo.h:36
BasicBlock * indexToBlock(unsigned Index) const
Definition SuspendCrossingInfo.h:50
BlockToIndexMapping(Function &F)
Definition SuspendCrossingInfo.h:38
Manage lifetime of a slot tracker for printing IR.
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.
StringRef - Represent a constant reference to a string, i.e.
bool isDefinitionAcrossSuspend(Value &V) const
Definition SuspendCrossingInfo.h:172
bool isDefinitionAcrossSuspend(Value &V, User *U) const
Definition SuspendCrossingInfo.h:162
bool isDefinitionAcrossSuspend(BasicBlock *DefBB, User *U) const
Definition SuspendCrossingInfo.h:122
LLVM_ABI bool hasPathCrossingSuspendPoint(BasicBlock *From, BasicBlock *To) const
Returns true if there is a path from From to To crossing a suspend point without crossing From a 2nd ...
LLVM_ABI SuspendCrossingInfo(Function &F, const SmallVectorImpl< AnyCoroSuspendInst * > &CoroSuspends, const SmallVectorImpl< AnyCoroEndInst * > &CoroEnds)
bool isDefinitionAcrossSuspend(Instruction &I, User *U) const
Definition SuspendCrossingInfo.h:148
LLVM_ABI bool hasPathOrLoopCrossingSuspendPoint(BasicBlock *From, BasicBlock *To) const
Returns true if there is a path from From to To crossing a suspend point without crossing From a 2nd ...
bool isDefinitionAcrossSuspend(Argument &A, User *U) const
Definition SuspendCrossingInfo.h:144
LLVM Value Representation.
iterator_range< user_iterator > users()
A range adaptor for a pair of iterators.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
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.
void sort(IteratorTy Start, IteratorTy End)
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
auto predecessors(const MachineBasicBlock *BB)