14 #ifndef LLVM_CLANG_LIB_CODEGEN_CGOPENMPRUNTIME_H 15 #define LLVM_CLANG_LIB_CODEGEN_CGOPENMPRUNTIME_H 21 #include "llvm/ADT/DenseMap.h" 22 #include "llvm/ADT/SmallPtrSet.h" 23 #include "llvm/ADT/StringMap.h" 24 #include "llvm/IR/Function.h" 25 #include "llvm/IR/ValueHandle.h" 41 class OMPExecutableDirective;
42 class OMPLoopDirective;
44 class OMPDeclareReductionDecl;
49 class CodeGenFunction;
71 template <
typename Callable>
72 static void CallbackFn(intptr_t CodeGen, CodeGenFunction &CGF,
74 return (*reinterpret_cast<Callable *>(CodeGen))(CGF, Action);
78 template <
typename Callable>
81 typename std::enable_if<
84 : CodeGen(reinterpret_cast<intptr_t>(&CodeGen)),
85 Callback(CallbackFn<typename
std::remove_reference<Callable>::
type>),
86 PrePostAction(nullptr) {}
88 void operator()(CodeGenFunction &CGF)
const;
103 llvm::PointerIntPair<llvm::Value *, 1, bool>
Final;
104 llvm::PointerIntPair<llvm::Value *, 1, bool>
Schedule;
105 llvm::PointerIntPair<llvm::Value *, 1, bool>
Priority;
107 unsigned NumberOfParts = 0;
109 bool Nogroup =
false;
116 struct ReductionData {
118 const Expr *Ref =
nullptr;
120 const Expr *Private =
nullptr;
122 const Expr *ReductionOp =
nullptr;
123 ReductionData(
const Expr *Ref,
const Expr *Private,
const Expr *ReductionOp)
124 : Ref(Ref), Private(Private), ReductionOp(ReductionOp) {}
174 bool needCleanups(
unsigned N);
189 std::pair<llvm::Value *, llvm::Value *>
getSizes(
unsigned N)
const {
196 bool usesReductionInitializer(
unsigned N)
const;
205 virtual void createOffloadEntry(llvm::Constant *
ID, llvm::Constant *Addr,
206 uint64_t Size, int32_t Flags = 0);
218 StringRef ParentName,
219 llvm::Function *&OutlinedFn,
220 llvm::Constant *&OutlinedFnID,
242 llvm::Type *getIdentTyPointerTy();
261 llvm::Constant *DefaultOpenMPPSource =
nullptr;
263 typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDefaultLocMapTy;
264 OpenMPDefaultLocMapTy OpenMPDefaultLocMap;
265 Address getOrCreateDefaultLocation(
unsigned Flags);
267 llvm::StructType *IdentTy =
nullptr;
269 typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDebugLocMapTy;
270 OpenMPDebugLocMapTy OpenMPDebugLocMap;
274 llvm::FunctionType *Kmpc_MicroTy =
nullptr;
276 struct DebugLocThreadIdTy {
281 typedef llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>
282 OpenMPLocThreadIDMapTy;
283 OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap;
286 std::pair<llvm::Function *, llvm::Function *>>
290 typedef llvm::DenseMap<llvm::Function *,
293 FunctionUDRMapTy FunctionUDRMap;
300 llvm::ArrayType *KmpCriticalNameTy;
306 llvm::StringMap<llvm::AssertingVH<llvm::Constant>, llvm::BumpPtrAllocator>
309 llvm::Type *KmpRoutineEntryPtrTy =
nullptr;
374 unsigned OffloadingEntriesNum;
384 OFFLOAD_ENTRY_INFO_TARGET_REGION = 0,
386 OFFLOAD_ENTRY_INFO_INVALID = ~0u
390 : Flags(0), Order(~0u),
Kind(OFFLOAD_ENTRY_INFO_INVALID) {}
393 : Flags(Flags), Order(Order), Kind(Kind) {}
399 void setFlags(int32_t NewFlags) { Flags = NewFlags; }
415 unsigned size()
const {
return OffloadingEntriesNum; }
417 : CGM(CGM), OffloadingEntriesNum(0) {}
425 llvm::Constant *Addr;
433 Addr(nullptr), ID(nullptr) {}
435 llvm::Constant *Addr,
436 llvm::Constant *ID, int32_t Flags)
438 Addr(Addr), ID(ID) {}
443 assert(!Addr &&
"Address as been set before!");
447 assert(!ID &&
"ID as been set before!");
451 return Info->
getKind() == OFFLOAD_ENTRY_INFO_TARGET_REGION;
455 void initializeTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
456 StringRef ParentName,
unsigned LineNum,
459 void registerTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
460 StringRef ParentName,
unsigned LineNum,
461 llvm::Constant *Addr, llvm::Constant *
ID,
465 bool hasTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
466 StringRef ParentName,
unsigned LineNum)
const;
468 typedef llvm::function_ref<void(
unsigned,
unsigned, StringRef,
unsigned,
471 void actOnTargetRegionEntriesInfo(
477 typedef llvm::DenseMap<unsigned, OffloadEntryInfoTargetRegion>
478 OffloadEntriesTargetRegionPerLine;
479 typedef llvm::StringMap<OffloadEntriesTargetRegionPerLine>
480 OffloadEntriesTargetRegionPerParentName;
481 typedef llvm::DenseMap<unsigned, OffloadEntriesTargetRegionPerParentName>
482 OffloadEntriesTargetRegionPerFile;
483 typedef llvm::DenseMap<unsigned, OffloadEntriesTargetRegionPerFile>
484 OffloadEntriesTargetRegionPerDevice;
485 typedef OffloadEntriesTargetRegionPerDevice OffloadEntriesTargetRegionTy;
486 OffloadEntriesTargetRegionTy OffloadEntriesTargetRegion;
562 const llvm::Twine &Name);
622 virtual void clear();
626 const OMPDeclareReductionDecl *D);
628 virtual std::pair<llvm::Function *, llvm::Function *>
674 bool Tied,
unsigned &NumberOfParts);
703 const Expr *Hint =
nullptr);
750 bool EmitChecks =
true,
751 bool ForceSimpleCall =
false);
786 : LB(LB), UB(UB), Chunk(Chunk) {}
810 unsigned IVSize,
bool IVSigned,
bool Ordered,
818 bool IVSigned =
false;
820 bool Ordered =
false;
839 : IVSize(IVSize), IVSigned(IVSigned), Ordered(Ordered), IL(IL), LB(LB),
840 UB(UB), ST(ST), Chunk(Chunk) {}
910 unsigned IVSize,
bool IVSigned,
947 virtual llvm::Function *
1042 bool HasCancel =
false);
1059 const Expr *ReductionOp,
1060 const Expr *PrivateRef,
1193 StringRef ParentName,
1194 llvm::Function *&OutlinedFn,
1195 llvm::Constant *&OutlinedFnID,
1196 bool IsOffloadEntry,
1263 bool RequiresDevicePointerInfo =
false;
1275 unsigned NumberOfPtrs = 0u;
1282 : RequiresDevicePointerInfo(RequiresDevicePointerInfo) {}
1285 BasePointersArray =
nullptr;
1286 PointersArray =
nullptr;
1287 SizesArray =
nullptr;
1288 MapTypesArray =
nullptr;
1293 return BasePointersArray && PointersArray && SizesArray &&
1294 MapTypesArray && NumberOfPtrs;
1309 const Expr *IfCond,
const Expr *Device,
1323 const Expr *Device);
1330 llvm::Function *Fn);
1347 const VarDecl *NativeParam)
const {
1357 const VarDecl *TargetParam)
const;
1385 const RegionCodeGenTy &CodeGen)
override;
1399 const RegionCodeGenTy &CodeGen)
override;
1420 bool Tied,
unsigned &NumberOfParts)
override;
1435 const Expr *IfCond)
override;
1443 const RegionCodeGenTy &CriticalOpGen,
1445 const Expr *Hint =
nullptr)
override;
1451 const RegionCodeGenTy &MasterOpGen,
1461 const RegionCodeGenTy &TaskgroupOpGen,
1478 const RegionCodeGenTy &OrderedOpGen,
1491 bool ForceSimpleCall =
false)
override;
1511 unsigned IVSize,
bool IVSigned,
bool Ordered,
1512 const DispatchRTInput &DispatchValues)
override;
1532 const StaticRTInput &Values)
override;
1542 const StaticRTInput &Values)
override;
1553 unsigned IVSize,
bool IVSigned)
override;
1580 unsigned IVSize,
bool IVSigned, Address IL,
1581 Address LB, Address UB, Address ST)
override;
1616 CodeGenFunction *CGF =
nullptr)
override;
1624 StringRef Name)
override;
1660 QualType SharedsTy, Address Shareds,
const Expr *IfCond,
1661 const OMPTaskDataTy &Data)
override;
1694 QualType SharedsTy, Address Shareds,
const Expr *IfCond,
1695 const OMPTaskDataTy &Data)
override;
1744 ReductionOptionsTy Options)
override;
1769 const OMPTaskDataTy &Data)
override;
1779 ReductionCodeGen &RCG,
unsigned N)
override;
1788 LValue SharedLVal)
override;
1819 StringRef ParentName,
1820 llvm::Function *&OutlinedFn,
1821 llvm::Constant *&OutlinedFnID,
1822 bool IsOffloadEntry,
1823 const RegionCodeGenTy &CodeGen)
override;
1838 const Expr *IfCond,
const Expr *Device,
1892 const Expr *Device,
const RegionCodeGenTy &CodeGen,
1893 TargetDataInfo &Info)
override;
1905 const Expr *Device)
override;
1922 const VarDecl *NativeParam)
const override;
1929 const VarDecl *TargetParam)
const override;
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
An instance of this class is created to represent a function declaration or definition.
QualType TgtDeviceImageQTy
struct __tgt_device_image{ void *ImageStart; // Pointer to the target code start. ...
Scheduling data for loop-based OpenMP directives.
A (possibly-)qualified type.
llvm::Constant * getID() const
OffloadEntryInfoTargetRegion(unsigned Order, llvm::Constant *Addr, llvm::Constant *ID, int32_t Flags)
void emitSingleReductionCombiner(CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS)
Emits single reduction combiner.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
llvm::SmallPtrSet< const VarDecl *, 4 > ThreadPrivateWithDefinition
Set of threadprivate variables with the generated initializer.
Stmt - This represents one statement.
virtual void emitUserDefinedReduction(CodeGenFunction *CGF, const OMPDeclareReductionDecl *D)
Emit code for the specified user defined reduction construct.
OffloadEntriesInfoManagerTy(CodeGenModule &CGM)
C Language Family Type Representation.
void setFlags(int32_t NewFlags)
QualType getTgtBinaryDescriptorQTy()
Returns __tgt_bin_desc type.
SmallVector< std::pair< OpenMPDependClauseKind, const Expr * >, 4 > Dependences
SmallVector< const Expr *, 4 > LastprivateCopies
llvm::Constant * getOrCreateInternalVariable(llvm::Type *Ty, const llvm::Twine &Name)
Gets (if variable with the given name already exist) or creates internal global variable with the spe...
virtual llvm::Value * emitTaskReductionInit(CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr *> LHSExprs, ArrayRef< const Expr *> RHSExprs, const OMPTaskDataTy &Data)
Emit a code for initialization of task reduction clause.
virtual Address getAddrOfArtificialThreadPrivate(CodeGenFunction &CGF, QualType VarType, StringRef Name)
Creates artificial threadprivate variable with name Name and type VarType.
OffloadingEntryInfoKinds getKind() const
llvm::Value * emitReductionFunction(CodeGenModule &CGM, llvm::Type *ArgsType, ArrayRef< const Expr *> Privates, ArrayRef< const Expr *> LHSExprs, ArrayRef< const Expr *> RHSExprs, ArrayRef< const Expr *> ReductionOps)
Emits reduction function.
void scanForTargetRegionsFunctions(const Stmt *S, StringRef ParentName)
Start scanning from statement S and and emit all target regions found along the way.
llvm::Value * getCriticalRegionLock(StringRef CriticalName)
Returns corresponding lock object for the specified critical region name.
SmallVector< const Expr *, 4 > ReductionCopies
VarDecl - An instance of this class is created to represent a variable declaration or definition...
virtual void emitOutlinedFunctionCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> Args=llvm::None) const
Emits call of the outlined function with the provided arguments, translating these arguments to corre...
bool isValid()
Return true if the current target data information has valid arrays.
llvm::DenseMap< const ValueDecl *, Address > CaptureDeviceAddrMap
Map between the a declaration of a capture and the corresponding base pointer address where the runti...
Class supports emissionof SIMD-only code.
virtual llvm::Value * emitForNext(CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned, Address IL, Address LB, Address UB, Address ST)
Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lowe...
virtual void Exit(CodeGenFunction &CGF)
OpenMPDirectiveKind ReductionKind
OffloadEntryInfoTargetRegion()
OffloadingEntryInfoKinds
Kind of a given entry.
void createOffloadEntriesAndInfoMetadata()
Creates all the offload entries in the current compilation unit along with the associated metadata...
Struct that keeps all the relevant information that should be kept throughout a 'target data' region...
QualType getTgtOffloadEntryQTy()
Returns __tgt_offload_entry type.
virtual void emitTargetDataStandAloneCall(CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device)
Emit the data mapping/movement code associated with the directive D that should be of the form 'targe...
SmallVector< const Expr *, 4 > PrivateVars
RecordDecl - Represents a struct/union/class.
OffloadEntryInfo(OffloadingEntryInfoKinds Kind, unsigned Order, int32_t Flags)
One of these records is kept for each identifier that is lexed.
~CGOpenMPSIMDRuntime() override
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
virtual void emitMasterRegion(CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc)
Emits a master region.
virtual void emitForOrderedIterationEnd(CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned)
Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with th...
SmallVector< const Expr *, 4 > LastprivateVars
virtual void emitDoacrossOrdered(CodeGenFunction &CGF, const OMPDependClause *C)
Emit code for doacross ordered directive with 'depend' clause.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
std::pair< llvm::Value *, llvm::Value * > getSizes(unsigned N) const
Returns the size of the reduction item (in chars and total number of elements in the item)...
virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const
Check if the specified ScheduleKind is dynamic.
Defines some OpenMP-specific enums and functions.
llvm::Type * getKmpc_MicroPointerTy()
Returns pointer to kmpc_micro type.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
static bool classof(const OffloadEntryInfo *Info)
virtual bool emitTargetFunctions(GlobalDecl GD)
Emit the target regions enclosed in GD function definition or the function itself in case it is a val...
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
bool requiresDevicePointerInfo()
QualType TgtOffloadEntryQTy
Type struct __tgt_offload_entry{ void *addr; // Pointer to the offload entry info.
virtual void emitTargetDataCalls(CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device, const RegionCodeGenTy &CodeGen, TargetDataInfo &Info)
Emit the target data mapping code associated with D.
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param IfCond Not a nullptr if if clause was nullptr *otherwise *param Data Additional data for task generation like final list of privates etc *virtual void emitTaskCall(CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Value *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data)
virtual std::pair< llvm::Function *, llvm::Function * > getUserDefinedReduction(const OMPDeclareReductionDecl *D)
Get combiner/initializer for the specified user-defined reduction, if any.
SmallVector< const Expr *, 4 > PrivateCopies
Base class of the entries info.
virtual void emitDeclareSimdFunction(const FunctionDecl *FD, llvm::Function *Fn)
Marks function Fn with properly mangled versions of vector functions.
virtual void emitTeamsCall(CodeGenFunction &CGF, const OMPExecutableDirective &D, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> CapturedVars)
Emits code for teams call of the OutlinedFn with variables captured in a record which address is stor...
SmallVector< const Expr *, 4 > FirstprivateCopies
const VarDecl * getBaseDecl(unsigned N) const
Returns the base declaration of the reduction item.
__INTPTR_TYPE__ intptr_t
A signed integer type with the property that any valid pointer to void can be converted to this type...
virtual llvm::Value * emitTeamsOutlinedFunction(const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
Emits outlined function for the specified OpenMP teams directive D.
SmallVector< const Expr *, 4 > ReductionOps
SmallVector< const Expr *, 4 > ReductionVars
virtual void emitForStaticFinish(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind)
Call the appropriate runtime routine to notify that we finished all the work with current loop...
virtual Address getParameterAddress(CodeGenFunction &CGF, const VarDecl *NativeParam, const VarDecl *TargetParam) const
Gets the address of the native argument basing on the address of the target-specific parameter...
llvm::Constant * createForStaticInitFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_for_static_init_* runtime function for the specified size IVSize and sign IVSigned...
TargetDataInfo(bool RequiresDevicePointerInfo)
Class intended to support codegen of all kind of the reduction clauses.
llvm::Constant * createDispatchFiniFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_dispatch_fini_* runtime function for the specified size IVSize and sign IVSigned...
QualType getTgtDeviceImageQTy()
Returns __tgt_device_image type.
This represents implicit clause 'depend' for the '#pragma omp task' directive.
virtual void emitTaskReductionFixups(CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
Required to resolve existing problems in the runtime.
virtual void emitFlush(CodeGenFunction &CGF, ArrayRef< const Expr *> Vars, SourceLocation Loc)
Emit flush of the variables specified in 'omp flush' directive.
RegionCodeGenTy(Callable &&CodeGen, typename std::enable_if< !std::is_same< typename std::remove_reference< Callable >::type, RegionCodeGenTy >::value >::type *=nullptr)
Expr - This represents one expression.
virtual llvm::Value * emitParallelOutlinedFunction(const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
Emits outlined function for the specified OpenMP parallel directive D.
void loadOffloadInfoMetadata()
Loads all the offload entries information from the host IR metadata.
void emitKmpRoutineEntryT(QualType KmpInt32Ty)
Build type kmp_routine_entry_t (if not built yet).
virtual const VarDecl * translateParameter(const FieldDecl *FD, const VarDecl *NativeParam) const
Translates the native parameter of outlined function if this is required for target.
QualType SavedKmpTaskloopTQTy
Saved kmp_task_t for taskloop-based directive.
virtual ~CGOpenMPRuntime()
virtual bool isStaticNonchunked(OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const
Check if the specified ScheduleKind is static non-chunked.
void clearArrayInfo()
Clear information about the data arrays.
SmallVector< const Expr *, 4 > FirstprivateVars
virtual Address getAddrOfThreadPrivate(CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc)
Returns address of the threadprivate variable for the current thread.
CGOpenMPRuntime(CodeGenModule &CGM)
OpenMPProcBindClauseKind
OpenMP attributes for 'proc_bind' clause.
llvm::Constant * createDispatchInitFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_dispatch_init_* runtime function for the specified size IVSize and sign IVSigned...
virtual void emitCriticalRegion(CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr)
Emits a critical region.
GlobalDecl - represents a global declaration.
virtual bool emitTargetGlobalVariable(GlobalDecl GD)
Emit the global variable if it is a valid device global variable.
QualType KmpDependInfoTy
Type typedef struct kmp_depend_info { kmp_intptr_t base_addr; size_t len; struct { bool in:1; bool ou...
QualType TgtBinaryDescriptorQTy
struct __tgt_bin_desc{ int32_t NumDevices; // Number of devices supported.
The l-value was considered opaque, so the alignment was determined from a type.
virtual ~PrePostActionTy()
void functionFinished(CodeGenFunction &CGF)
Cleans up references to the objects in finished function.
Encodes a location in the source.
llvm::function_ref< void(unsigned, unsigned, StringRef, unsigned, OffloadEntryInfoTargetRegion &)> OffloadTargetRegionEntryInfoActTy
brief Applies action Action on all registered entries.
This represents '#pragma omp declare reduction ...' directive.
llvm::PointerIntPair< llvm::Value *, 1, bool > Final
virtual void emitSingleRegion(CodeGenFunction &CGF, const RegionCodeGenTy &SingleOpGen, SourceLocation Loc, ArrayRef< const Expr *> CopyprivateVars, ArrayRef< const Expr *> DestExprs, ArrayRef< const Expr *> SrcExprs, ArrayRef< const Expr *> AssignmentOps)
Emits a single region.
virtual void emitNumTeamsClause(CodeGenFunction &CGF, const Expr *NumTeams, const Expr *ThreadLimit, SourceLocation Loc)
Emits call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams...
This is a basic class for representing single OpenMP executable directive.
virtual void emitCancellationPointCall(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion)
Emit code for 'cancellation point' construct.
OpenMPDirectiveKind
OpenMP directives.
virtual llvm::Function * emitThreadPrivateVarDefinition(const VarDecl *VD, Address VDAddr, SourceLocation Loc, bool PerformInit, CodeGenFunction *CGF=nullptr)
Emit a code for initialization of threadprivate variable.
virtual void emitTargetCall(CodeGenFunction &CGF, const OMPExecutableDirective &D, llvm::Value *OutlinedFn, llvm::Value *OutlinedFnID, const Expr *IfCond, const Expr *Device, ArrayRef< llvm::Value *> CapturedVars)
Emit the target offloading code associated with D.
Target region entries related.
virtual void emitDoacrossInit(CodeGenFunction &CGF, const OMPLoopDirective &D)
Emit initialization for doacross loop nesting support.
virtual llvm::Value * emitTaskOutlinedFunction(const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, const VarDecl *PartIDVar, const VarDecl *TaskTVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool Tied, unsigned &NumberOfParts)
Emits outlined function for the OpenMP task directive D.
unsigned size() const
Return number of entries defined so far.
virtual void Enter(CodeGenFunction &CGF)
virtual void emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *OutlinedFn, ArrayRef< llvm::Value *> CapturedVars, const Expr *IfCond)
Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which ad...
void emitThreadPrivateVarInit(CodeGenFunction &CGF, Address VDAddr, llvm::Value *Ctor, llvm::Value *CopyCtor, llvm::Value *Dtor, SourceLocation Loc)
Emits initialization code for the threadprivate variables.
virtual void emitProcBindClause(CodeGenFunction &CGF, OpenMPProcBindClauseKind ProcBind, SourceLocation Loc)
Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generat...
virtual void emitTaskyieldCall(CodeGenFunction &CGF, SourceLocation Loc)
Emits code for a taskyield directive.
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final list of privates etc *TaskResultTy emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Value *TaskFunction, QualType SharedsTy, Address Shareds, const OMPTaskDataTy &Data)
virtual Address emitThreadIDAddress(CodeGenFunction &CGF, SourceLocation Loc)
Emits address of the word in a memory where current thread id is stored.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
void setAction(PrePostActionTy &Action) const
This class organizes the cross-function state that is used while generating LLVM code.
Dataflow Directional Tag Classes.
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
void setAddress(llvm::Constant *V)
virtual bool emitTargetGlobal(GlobalDecl GD)
Emit the global GD if it is meaningful for the target.
virtual void emitCancelCall(CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion)
Emit code for 'cancel' construct.
A basic class for pre|post-action for advanced codegen sequence for OpenMP region.
LValue getSharedLValue(unsigned N) const
Returns LValue for the reduction item.
unsigned getOrder() const
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param IfCond Not a nullptr if if clause was nullptr *otherwise *param Data Additional data for task generation like final list of privates etc *virtual void emitTaskLoopCall(CodeGenFunction &CGF, SourceLocation Loc, const OMPLoopDirective &D, llvm::Value *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data)
llvm::Function * createOffloadingBinaryDescriptorRegistration()
Creates and registers offloading binary descriptor for the current compilation unit.
llvm::PointerIntPair< llvm::Value *, 1, bool > Priority
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.
OffloadEntriesInfoManagerTy OffloadEntriesInfoManager
CGOpenMPSIMDRuntime(CodeGenModule &CGM)
static bool classof(const OffloadEntryInfo *Info)
virtual void emitDistributeStaticInit(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDistScheduleClauseKind SchedKind, const StaticRTInput &Values)
virtual StringRef getOutlinedHelperName() const
Get the function name of an outlined region.
llvm::Constant * getAddress() const
virtual void emitOrderedRegion(CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads)
Emit an ordered region.
virtual void emitInlinedDirective(CodeGenFunction &CGF, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool HasCancel=false)
Emit code for the directive that does not require outlining.
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Entity that registers the offloading constants that were emitted so far.
llvm::Constant * createDispatchNextFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_dispatch_next_* runtime function for the specified size IVSize and sign IVSigned...
virtual void emitTaskgroupRegion(CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc)
Emit a taskgroup region.
virtual llvm::Function * emitRegistrationFunction()
Creates the offloading descriptor in the event any target region was emitted in the current module an...
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)
Emit a code for reduction clause.
Defines the clang::SourceLocation class and associated facilities.
llvm::PointerIntPair< llvm::Value *, 1, bool > Schedule
void setID(llvm::Constant *V)
Privates[]
Gets the list of initial values for linear variables.
virtual void emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false)
Emit an implicit/explicit barrier for OpenMP threads.
virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, const DispatchRTInput &DispatchValues)
Call the appropriate runtime routine to initialize it before start of loop.
A reference to a declared variable, function, enum, etc.
virtual void emitForStaticInit(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind, const OpenMPScheduleTy &ScheduleKind, const StaticRTInput &Values)
Call the appropriate runtime routine to initialize it before start of loop.
QualType KmpDimTy
struct kmp_dim { // loop bounds info casted to kmp_int64 kmp_int64 lo; // lower kmp_int64 up; // uppe...
LValue - This represents an lvalue references.
QualType SavedKmpTaskTQTy
Saved kmp_task_t for task directive.
virtual Address getTaskReductionItem(CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *ReductionsPtr, LValue SharedLVal)
Get the address of void * type of the privatue copy of the reduction item specified by the SharedLVal...
llvm::Constant * createRuntimeFunction(unsigned Function)
Returns specified OpenMP runtime function.
virtual void emitNumThreadsClause(CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc)
Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads)...
SmallVector< const Expr *, 4 > FirstprivateInits
llvm::Constant * getOrCreateThreadPrivateCache(const VarDecl *VD)
If the specified mangled name is not in the module, create and return threadprivate cache object...
virtual void emitTaskwaitCall(CodeGenFunction &CGF, SourceLocation Loc)
Emit code for 'taskwait' directive.