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" 84 const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc,
88 llvm::MDNode *
getLoopID()
const {
return TempLoopID.get(); }
91 llvm::BasicBlock *
getHeader()
const {
return Header; }
105 llvm::TempMDTuple TempLoopID;
107 llvm::BasicBlock *Header;
111 llvm::MDNode *AccGroup =
nullptr;
113 llvm::DebugLoc StartLoc;
115 llvm::DebugLoc EndLoc;
121 llvm::MDNode *UnrollAndJamInnerFollowup =
nullptr;
147 bool &HasUserTransforms);
151 bool &HasUserTransforms);
155 bool &HasUserTransforms);
159 bool &HasUserTransforms);
163 bool &HasUserTransforms);
167 bool &HasUserTransforms);
184 bool &HasUserTransforms);
199 void push(llvm::BasicBlock *Header,
const llvm::DebugLoc &StartLoc,
200 const llvm::DebugLoc &EndLoc);
206 const llvm::DebugLoc &EndLoc);
216 return hasInfo() ?
getInfo().getAttributes().IsParallel :
false;
221 void InsertHelper(llvm::Instruction *I)
const;
224 void setParallel(
bool Enable =
true) { StagedAttrs.IsParallel = Enable; }
228 StagedAttrs.VectorizeEnable =
229 Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
234 StagedAttrs.DistributeEnable =
235 Enable ? LoopAttributes::Enable : LoopAttributes::Disable;
240 StagedAttrs.UnrollEnable =
State;
245 StagedAttrs.VectorizePredicateEnable =
State;
250 StagedAttrs.UnrollAndJamEnable =
State;
270 StagedAttrs.PipelineInitiationInterval = C;
275 bool hasInfo()
const {
return !Active.empty(); }
void setVectorizePredicateState(const LoopAttributes::LVEnableState &State)
Set the next pushed vectorize predicate state.
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 VectorizePredicateEnable
Value for llvm.loop.vectorize.predicate metadata.
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.