clang: lib/CodeGen/CGLoopInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_LIB_CODEGEN_CGLOOPINFO_H
15#define LLVM_CLANG_LIB_CODEGEN_CGLOOPINFO_H
16
17#include "llvm/ADT/ArrayRef.h"
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/IR/DebugLoc.h"
20#include "llvm/IR/Value.h"
21#include "llvm/Support/Compiler.h"
22
23namespace llvm {
24class BasicBlock;
25class Instruction;
26class MDNode;
27}
28
30class Attr;
31class ASTContext;
32class CodeGenOptions;
33namespace CodeGen {
34
35
39
40
42
43
45
46
48
49
51
52
54
55
57
58
60
61
63
64
66
67
69
70
72
73
75
76
78
79
81
82
84
85
87};
88
89
91public:
92
94 const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc,
96
97
98 llvm::MDNode *getLoopID() const { return TempLoopID.get(); }
99
100
101 llvm::BasicBlock *getHeader() const { return Header; }
102
103
105
106
108
109
110
112
113
114
116
117private:
118
119 llvm::TempMDTuple TempLoopID;
120
121 llvm::BasicBlock *Header;
122
124
125 llvm::MDNode *AccGroup = nullptr;
126
127 llvm::DebugLoc StartLoc;
128
129 llvm::DebugLoc EndLoc;
130
132
133
134
135 llvm::MDNode *UnrollAndJamInnerFollowup = nullptr;
136
137
138 llvm::MDNode *
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 llvm::MDNode *
159 createPipeliningMetadata(const LoopAttributes &Attrs,
161 bool &HasUserTransforms);
162 llvm::MDNode *
163 createPartialUnrollMetadata(const LoopAttributes &Attrs,
165 bool &HasUserTransforms);
166 llvm::MDNode *
167 createUnrollAndJamMetadata(const LoopAttributes &Attrs,
169 bool &HasUserTransforms);
170 llvm::MDNode *
171 createLoopVectorizeMetadata(const LoopAttributes &Attrs,
173 bool &HasUserTransforms);
174 llvm::MDNode *
175 createLoopDistributeMetadata(const LoopAttributes &Attrs,
177 bool &HasUserTransforms);
178 llvm::MDNode *
179 createFullUnrollMetadata(const LoopAttributes &Attrs,
181 bool &HasUserTransforms);
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 llvm::MDNode *createMetadata(const LoopAttributes &Attrs,
198 bool &HasUserTransforms);
199};
200
201
202
203
207
208public:
210
211
212
213 void push(llvm::BasicBlock *Header, const llvm::DebugLoc &StartLoc,
214 const llvm::DebugLoc &EndLoc);
215
216
217
221 const llvm::DebugLoc &EndLoc, bool MustProgress = false);
222
223
224 void pop();
225
226
228
229
232 }
233
234
235
236 void InsertHelper(llvm::Instruction *I) const;
237
238
240
241
245 }
246
247
251 }
252
253
256 }
257
258
261 }
262
263
266 }
267
268
270
273 }
274
275
277
278
280
281
283
284
286
287
290 }
291
292
294
295
297
298
299 bool hasInfo() const { return !Active.empty(); }
300
301
303
304private:
305
307
309};
310
311}
312}
313
314#endif
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
A stack of loop information corresponding to loop nesting levels.
void setPipelineDisabled(bool S)
Set the pipeline disabled state.
void setUnrollCount(unsigned C)
Set the unroll count for the next loop pushed.
bool hasInfo() const
Returns true if there is LoopInfo on the stack.
void setVectorizeWidth(unsigned W)
Set the vectorize width for the next loop pushed.
void InsertHelper(llvm::Instruction *I) const
Function called by the CodeGenFunction when an instruction is created.
void setDistributeState(bool Enable=true)
Set the next pushed loop as a distribution candidate.
void setParallel(bool Enable=true)
Set the next pushed loop as parallel.
void push(llvm::BasicBlock *Header, clang::ASTContext &Ctx, const clang::CodeGenOptions &CGOpts, llvm::ArrayRef< const Attr * > Attrs, const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc, bool MustProgress=false)
Begin a new structured loop.
void setInterleaveCount(unsigned C)
Set the interleave count for the next loop pushed.
void setUnrollState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll state.
llvm::MDNode * getCurLoopID() const
Return the top loop id metadata.
void setVectorizeScalable(const LoopAttributes::LVEnableState &State)
void setVectorizePredicateState(const LoopAttributes::LVEnableState &State)
Set the next pushed vectorize predicate state.
void pop()
End the current loop.
void setCodeAlign(unsigned C)
Set value of code align for the next loop pushed.
void push(llvm::BasicBlock *Header, const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc)
Begin a new structured loop.
bool getCurLoopParallel() const
Return true if the top loop is parallel.
void setMustProgress(bool P)
Set no progress for the next loop pushed.
void setUnrollAndJamState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll_and_jam state.
void setUnrollAndJamCount(unsigned C)
Set the unroll count for the next loop pushed.
const LoopInfo & getInfo() const
Return the LoopInfo for the current loop.
void setPipelineInitiationInterval(unsigned C)
Set the pipeline initiation interval.
void setVectorizeEnable(bool Enable=true)
Set the next pushed loop 'vectorize.enable'.
Information used when generating a structured loop.
llvm::BasicBlock * getHeader() const
Get the header block of this loop.
llvm::MDNode * getAccessGroup() const
Return this loop's access group or nullptr if it does not have one.
llvm::MDNode * getLoopID() const
Get the loop id metadata for this loop.
void finish()
Create the loop's metadata.
const LoopInfo * getParent() const
Returns the first outer loop containing this loop if any, nullptr otherwise.
const LoopAttributes & getAttributes() const
Get the set of attributes active for this loop.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Attributes that may be specified on loops.
unsigned UnrollCount
llvm.unroll.
bool MustProgress
Value for whether the loop is required to make progress.
unsigned InterleaveCount
Value for llvm.loop.interleave.count metadata.
bool IsParallel
Generate llvm.loop.parallel metadata for loads and stores.
LVEnableState VectorizeScalable
LVEnableState UnrollAndJamEnable
Value for llvm.loop.unroll_and_jam.* metadata (enable, disable, or full).
unsigned UnrollAndJamCount
llvm.unroll.
LVEnableState
State of loop vectorization or unrolling.
LVEnableState VectorizePredicateEnable
Value for llvm.loop.vectorize.predicate metadata.
LVEnableState DistributeEnable
Value for llvm.loop.distribute.enable metadata.
bool PipelineDisabled
Value for llvm.loop.pipeline.disable metadata.
unsigned CodeAlign
Value for 'llvm.loop.align' metadata.
LVEnableState UnrollEnable
Value for llvm.loop.unroll.* metadata (enable, disable, or full).
unsigned VectorizeWidth
Value for llvm.loop.vectorize.width metadata.
unsigned PipelineInitiationInterval
Value for llvm.loop.pipeline.iicount metadata.
LVEnableState VectorizeEnable
Value for llvm.loop.vectorize.enable metadata.