14 #ifndef LLVM_CLANG_LIB_CODEGEN_CGLOOPINFO_H 15 #define LLVM_CLANG_LIB_CODEGEN_CGLOOPINFO_H 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" 81 const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc,
85 llvm::MDNode *
getLoopID()
const {
return TempLoopID.get(); }
88 llvm::BasicBlock *
getHeader()
const {
return Header; }
102 llvm::TempMDTuple TempLoopID;
104 llvm::BasicBlock *Header;
108 llvm::MDNode *AccGroup =
nullptr;
110 llvm::DebugLoc StartLoc;
112 llvm::DebugLoc EndLoc;
118 llvm::MDNode *UnrollAndJamInnerFollowup =
nullptr;
144 bool &HasUserTransforms);
148 bool &HasUserTransforms);
152 bool &HasUserTransforms);
156 bool &HasUserTransforms);
160 bool &HasUserTransforms);
164 bool &HasUserTransforms);
181 bool &HasUserTransforms);
196 void push(llvm::BasicBlock *Header,
const llvm::DebugLoc &StartLoc,
197 const llvm::DebugLoc &EndLoc);
203 const llvm::DebugLoc &EndLoc);
213 return hasInfo() ?
getInfo().getAttributes().IsParallel :
false;
218 void InsertHelper(llvm::Instruction *I)
const;
221 void setParallel(
bool Enable =
true) { StagedAttrs.IsParallel = Enable; }
225 StagedAttrs.VectorizeEnable =
226 Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
231 StagedAttrs.DistributeEnable =
232 Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
237 StagedAttrs.UnrollEnable =
State;
242 StagedAttrs.UnrollAndJamEnable =
State;
262 StagedAttrs.PipelineInitiationInterval = C;
267 bool hasInfo()
const {
return !Active.empty(); }
void setUnrollCount(unsigned C)
Set the unroll count for the next loop pushed.
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Attributes that may be specified on loops.
unsigned UnrollAndJamCount
llvm.unroll.
Information used when generating a structured loop.
LVEnableState UnrollEnable
Value for llvm.loop.unroll.* metadata (enable, disable, or full).
unsigned PipelineInitiationInterval
Value for llvm.loop.pipeline.iicount metadata.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
unsigned InterleaveCount
Value for llvm.loop.interleave.count metadata.
void setUnrollAndJamCount(unsigned C)
Set the unroll count for the next loop pushed.
LVEnableState VectorizeEnable
Value for llvm.loop.vectorize.enable metadata.
void setVectorizeWidth(unsigned W)
Set the vectorize width for the next loop pushed.
LVEnableState UnrollAndJamEnable
Value for llvm.loop.unroll_and_jam.* metadata (enable, disable, or full).
bool IsParallel
Generate llvm.loop.parallel metadata for loads and stores.
void setInterleaveCount(unsigned C)
Set the interleave count for the next loop pushed.
unsigned UnrollCount
llvm.unroll.
void setParallel(bool Enable=true)
Set the next pushed loop as parallel.
LVEnableState DistributeEnable
Value for llvm.loop.distribute.enable metadata.
llvm::MDNode * getLoopID() const
Get the loop id metadata for this loop.
llvm::MDNode * getCurLoopID() const
Return the top loop id metadata.
void setDistributeState(bool Enable=true)
Set the next pushed loop as a distribution candidate.
llvm::MDNode * getAccessGroup() const
Return this loop's access group or nullptr if it does not have one.
Dataflow Directional Tag Classes.
bool PipelineDisabled
Value for llvm.loop.pipeline.disable metadata.
static const TypeInfo & getInfo(unsigned id)
A stack of loop information corresponding to loop nesting levels.
bool getCurLoopParallel() const
Return true if the top loop is parallel.
LVEnableState
State of loop vectorization or unrolling.
void setUnrollState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll state.
void setUnrollAndJamState(const LoopAttributes::LVEnableState &State)
Set the next pushed loop unroll_and_jam state.
void setVectorizeEnable(bool Enable=true)
Set the next pushed loop 'vectorize.enable'.
void setPipelineDisabled(bool S)
Set the pipeline disabled state.
void setPipelineInitiationInterval(unsigned C)
Set the pipeline initiation interval.
unsigned VectorizeWidth
Value for llvm.loop.vectorize.width metadata.
llvm::BasicBlock * getHeader() const
Get the header block of this loop.
const LoopAttributes & getAttributes() const
Get the set of attributes active for this loop.