15 #ifndef LLVM_CLANG_LIB_CODEGEN_CGOPENMPRUNTIMENVPTX_H 16 #define LLVM_CLANG_LIB_CODEGEN_CGOPENMPRUNTIMENVPTX_H 21 #include "llvm/IR/CallSite.h" 31 struct EntryFunctionState {
32 llvm::BasicBlock *ExitBB =
nullptr;
35 class WorkerFunctionState {
37 llvm::Function *WorkerFn;
46 bool isInSpmdExecutionMode()
const;
49 void emitWorkerFunction(WorkerFunctionState &WST);
56 void emitGenericEntryHeader(
CodeGenFunction &CGF, EntryFunctionState &EST,
57 WorkerFunctionState &WST);
61 void emitGenericEntryFooter(
CodeGenFunction &CGF, EntryFunctionState &EST);
68 void emitSpmdEntryFooter(
CodeGenFunction &CGF, EntryFunctionState &EST);
76 void createOffloadEntry(llvm::Constant *
ID, llvm::Constant *Addr,
77 uint64_t Size, int32_t Flags = 0)
override;
89 llvm::Function *&OutlinedFn,
90 llvm::Constant *&OutlinedFnID,
bool IsOffloadEntry,
105 llvm::Function *&OutlinedFn,
106 llvm::Constant *&OutlinedFnID,
bool IsOffloadEntry,
119 StringRef ParentName,
120 llvm::Function *&OutlinedFn,
121 llvm::Constant *&OutlinedFnID,
161 return "__omp_outlined__";
243 const Expr *IfCond)
override;
276 const VarDecl *NativeParam)
const override;
283 const VarDecl *TargetParam)
const override;
310 llvm::DenseMap<llvm::Function *, llvm::Function *> WrapperFunctionsMap;
317 createDataSharingWrapper(llvm::Function *OutlinedParallelFn,
324 #endif // LLVM_CLANG_LIB_CODEGEN_CGOPENMPRUNTIMENVPTX_H
Generic codegen to support fork-join model.
llvm::Value * emitParallelOutlinedFunction(const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) override
Emits inlined function for the specified OpenMP parallel.
Address getParameterAddress(CodeGenFunction &CGF, const VarDecl *NativeParam, const VarDecl *TargetParam) const override
Gets the address of the native argument basing on the address of the target-specific parameter...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
virtual void emitNumThreadsClause(CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc) override
Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads)...
void emitNumTeamsClause(CodeGenFunction &CGF, const Expr *NumTeams, const Expr *ThreadLimit, SourceLocation Loc) override
This function ought to emit, in the general case, a call to.
void emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> CapturedVars, const Expr *IfCond) override
Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which ad...
Expr - This represents one expression.
OpenMPProcBindClauseKind
OpenMP attributes for 'proc_bind' clause.
llvm::Value * emitTeamsOutlinedFunction(const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) override
Emits inlined function for the specified OpenMP teams.
void emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> Args=llvm::None) const override
Emits call of the outlined function with the provided arguments, translating these arguments to corre...
void emitTeamsCall(CodeGenFunction &CGF, const OMPExecutableDirective &D, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> CapturedVars) override
Emits code for teams call of the OutlinedFn with variables captured in a record which address is stor...
Encodes a location in the source.
This is a basic class for representing single OpenMP executable directive.
StringRef getOutlinedHelperName() const override
Get the function name of an outlined region.
OpenMPDirectiveKind
OpenMP directives.
const VarDecl * translateParameter(const FieldDecl *FD, const VarDecl *NativeParam) const override
Translates the native parameter of outlined function if this is required for target.
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
Single Program Multiple Data.
Dataflow Directional Tag Classes.
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
virtual void emitTargetOutlinedFunction(const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
Emit outilined function for 'target' directive.
llvm::Constant * createNVPTXRuntimeFunction(unsigned Function)
Returns specified OpenMP runtime function for the current OpenMP implementation.
virtual void emitReduction(CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr *> Privates, ArrayRef< const Expr *> LHSExprs, ArrayRef< const Expr *> RHSExprs, ArrayRef< const Expr *> ReductionOps, ReductionOptionsTy Options) override
Emit a code for reduction clause.
This file defines OpenMP AST classes for executable directives and clauses.
ExecutionMode
Target codegen is specialized based on two programming models: the 'generic' fork-join model of OpenM...
Privates[]
Gets the list of initial values for linear variables.
virtual void emitProcBindClause(CodeGenFunction &CGF, OpenMPProcBindClauseKind ProcBind, SourceLocation Loc) override
Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generat...
CGOpenMPRuntimeNVPTX(CodeGenModule &CGM)