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>
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) {}
103 llvm::PointerIntPair<llvm::Value *, 1, bool>
Final;
104 llvm::PointerIntPair<llvm::Value *, 1, bool>
Schedule;
105 llvm::PointerIntPair<llvm::Value *, 1, bool>
Priority;
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) {}
189 std::pair<llvm::Value *, llvm::Value *>
getSizes(
unsigned N)
const {
206 uint64_t Size, int32_t Flags = 0);
218 StringRef ParentName,
219 llvm::Function *&OutlinedFn,
220 llvm::Constant *&OutlinedFnID,
256 llvm::Constant *DefaultOpenMPPSource =
nullptr;
258 typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDefaultLocMapTy;
259 OpenMPDefaultLocMapTy OpenMPDefaultLocMap;
260 Address getOrCreateDefaultLocation(
unsigned Flags);
262 llvm::StructType *IdentTy =
nullptr;
264 typedef llvm::DenseMap<unsigned, llvm::Value *> OpenMPDebugLocMapTy;
265 OpenMPDebugLocMapTy OpenMPDebugLocMap;
269 llvm::FunctionType *Kmpc_MicroTy =
nullptr;
271 struct DebugLocThreadIdTy {
276 typedef llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy>
277 OpenMPLocThreadIDMapTy;
278 OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap;
281 std::pair<llvm::Function *, llvm::Function *>>
285 typedef llvm::DenseMap<llvm::Function *,
288 FunctionUDRMapTy FunctionUDRMap;
295 llvm::ArrayType *KmpCriticalNameTy;
301 llvm::StringMap<llvm::AssertingVH<llvm::Constant>, llvm::BumpPtrAllocator>
365 unsigned OffloadingEntriesNum;
375 OFFLOAD_ENTRY_INFO_TARGET_REGION = 0,
377 OFFLOAD_ENTRY_INFO_INVALID = ~0u
381 : Flags(0), Order(~0u),
Kind(OFFLOAD_ENTRY_INFO_INVALID) {}
384 : Flags(Flags), Order(Order), Kind(Kind) {}
390 void setFlags(int32_t NewFlags) { Flags = NewFlags; }
400 OffloadingEntryInfoKinds
Kind;
406 unsigned size()
const {
return OffloadingEntriesNum; }
408 : CGM(CGM), OffloadingEntriesNum(0) {}
416 llvm::Constant *Addr;
424 Addr(nullptr),
ID(nullptr) {}
426 llvm::Constant *Addr,
427 llvm::Constant *
ID, int32_t Flags)
429 Addr(Addr), ID(ID) {}
434 assert(!Addr &&
"Address as been set before!");
438 assert(!
ID &&
"ID as been set before!");
442 return Info->
getKind() == OFFLOAD_ENTRY_INFO_TARGET_REGION;
446 void initializeTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
447 StringRef ParentName,
unsigned LineNum,
450 void registerTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
451 StringRef ParentName,
unsigned LineNum,
452 llvm::Constant *Addr, llvm::Constant *
ID,
456 bool hasTargetRegionEntryInfo(
unsigned DeviceID,
unsigned FileID,
457 StringRef ParentName,
unsigned LineNum)
const;
459 typedef llvm::function_ref<void(
unsigned,
unsigned, StringRef,
unsigned,
460 OffloadEntryInfoTargetRegion &)>
462 void actOnTargetRegionEntriesInfo(
468 typedef llvm::DenseMap<unsigned, OffloadEntryInfoTargetRegion>
469 OffloadEntriesTargetRegionPerLine;
470 typedef llvm::StringMap<OffloadEntriesTargetRegionPerLine>
471 OffloadEntriesTargetRegionPerParentName;
472 typedef llvm::DenseMap<unsigned, OffloadEntriesTargetRegionPerParentName>
473 OffloadEntriesTargetRegionPerFile;
474 typedef llvm::DenseMap<unsigned, OffloadEntriesTargetRegionPerFile>
475 OffloadEntriesTargetRegionPerDevice;
476 typedef OffloadEntriesTargetRegionPerDevice OffloadEntriesTargetRegionTy;
477 OffloadEntriesTargetRegionTy OffloadEntriesTargetRegion;
553 const llvm::Twine &
Name);
613 virtual void clear();
619 virtual std::pair<llvm::Function *, llvm::Function *>
665 bool Tied,
unsigned &NumberOfParts);
692 const RegionCodeGenTy &CriticalOpGen,
694 const Expr *Hint =
nullptr);
700 const RegionCodeGenTy &MasterOpGen,
710 const RegionCodeGenTy &TaskgroupOpGen,
717 const RegionCodeGenTy &SingleOpGen,
728 const RegionCodeGenTy &OrderedOpGen,
741 bool EmitChecks =
true,
742 bool ForceSimpleCall =
false);
777 : LB(LB), UB(UB), Chunk(Chunk) {}
801 unsigned IVSize,
bool IVSigned,
bool Ordered,
802 const DispatchRTInput &DispatchValues);
832 unsigned IVSize,
bool IVSigned,
bool Ordered,
833 Address IL, Address LB, Address UB, Address ST,
856 unsigned IVSize,
bool IVSigned,
857 bool Ordered, Address IL, Address LB,
858 Address UB, Address ST,
896 unsigned IVSize,
bool IVSigned,
897 Address IL, Address LB,
898 Address UB, Address ST);
933 virtual llvm::Function *
936 CodeGenFunction *CGF =
nullptr);
1028 bool HasCancel =
false);
1045 const Expr *ReductionOp,
1046 const Expr *PrivateRef,
1179 StringRef ParentName,
1180 llvm::Function *&OutlinedFn,
1181 llvm::Constant *&OutlinedFnID,
1182 bool IsOffloadEntry,
1249 bool RequiresDevicePointerInfo =
false;
1261 unsigned NumberOfPtrs = 0u;
1268 : RequiresDevicePointerInfo(RequiresDevicePointerInfo) {}
1271 BasePointersArray =
nullptr;
1272 PointersArray =
nullptr;
1273 SizesArray =
nullptr;
1274 MapTypesArray =
nullptr;
1279 return BasePointersArray && PointersArray && SizesArray &&
1280 MapTypesArray && NumberOfPtrs;
1295 const Expr *IfCond,
const Expr *Device,
1296 const RegionCodeGenTy &CodeGen,
1297 TargetDataInfo &Info);
1309 const Expr *Device);
1316 llvm::Function *Fn);
FunctionDecl - 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.
virtual void emitDistributeStaticInit(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDistScheduleClauseKind SchedKind, unsigned IVSize, bool IVSigned, bool Ordered, Address IL, Address LB, Address UB, Address ST, llvm::Value *Chunk=nullptr)
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.
OffloadEntryInfoTargetRegion(unsigned Order, llvm::Constant *Addr, llvm::Constant *ID, int32_t Flags)
virtual bool emitTargetGlobalVariable(GlobalDecl GD)
Emit the global variable if it is a valid device global variable.
void emitSingleReductionCombiner(CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS)
Emits single reduction combiner.
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
virtual bool emitTargetGlobal(GlobalDecl GD)
Emit the global GD if it is meaningful for the target.
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...
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...
llvm::Value * getThreadID(CodeGenFunction &CGF, SourceLocation Loc)
Gets thread id value for the current thread.
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...
virtual void Exit(CodeGenFunction &CGF)
OpenMPDirectiveKind ReductionKind
virtual bool isDynamic(OpenMPScheduleClauseKind ScheduleKind) const
Check if the specified ScheduleKind is dynamic.
OffloadEntryInfoTargetRegion()
OffloadingEntryInfoKinds
Kind of a given entry.
virtual void createOffloadEntry(llvm::Constant *ID, llvm::Constant *Addr, uint64_t Size, int32_t Flags=0)
Creates offloading entry for the provided entry ID ID, address Addr, size Size, and flags Flags...
void createOffloadEntriesAndInfoMetadata()
Creates all the offload entries in the current compilation unit along with the associated metadata...
LValue getSharedLValue(unsigned N) const
Returns LValue for the reduction item.
Struct that keeps all the relevant information that should be kept throughout a 'target data' region...
QualType getTgtOffloadEntryQTy()
Returns __tgt_offload_entry type.
SmallVector< const Expr *, 4 > PrivateVars
RecordDecl - Represents a struct/union/class.
llvm::Constant * getAddress() const
OffloadEntryInfo(OffloadingEntryInfoKinds Kind, unsigned Order, int32_t Flags)
One of these records is kept for each identifier that is lexed.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
virtual void emitFlush(CodeGenFunction &CGF, ArrayRef< const Expr * > Vars, SourceLocation Loc)
Emit flush of the variables specified in 'omp flush' directive.
SmallVector< const Expr *, 4 > LastprivateVars
virtual void emitCancellationPointCall(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion)
Emit code for 'cancellation point' construct.
Defines some OpenMP-specific enums and functions.
llvm::Type * getKmpc_MicroPointerTy()
Returns pointer to kmpc_micro type.
virtual bool emitTargetFunctions(GlobalDecl GD)
Emit the target regions enclosed in GD function definition or the function itself in case it is a val...
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
unsigned size() const
Return number of entries defined so far.
static bool classof(const OffloadEntryInfo *Info)
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
bool requiresDevicePointerInfo()
virtual void emitForStaticInit(CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, Address IL, Address LB, Address UB, Address ST, llvm::Value *Chunk=nullptr)
Call the appropriate runtime routine to initialize it before start of loop.
QualType TgtOffloadEntryQTy
Type struct __tgt_offload_entry{ void *addr; // Pointer to the offload entry info.
virtual StringRef getOutlinedHelperName() const
Get the function name of an outlined region.
void emitCleanups(CodeGenFunction &CGF, unsigned N, Address PrivateAddr)
Emits cleanup code for the reduction item.
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
Address adjustPrivateAddress(CodeGenFunction &CGF, unsigned N, Address PrivateAddr)
Adjusts PrivatedAddr for using instead of the original variable address in normal operations...
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.
SmallVector< const Expr *, 4 > FirstprivateCopies
llvm::Value * emitUpdateLocation(CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0)
Emits object of ident_t type with info for source location.
__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
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.
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 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.
virtual Address getAddrOfArtificialThreadPrivate(CodeGenFunction &CGF, QualType VarType, StringRef Name)
Creates artificial threadprivate variable with name Name and type VarType.
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 void emitOrderedRegion(CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads)
Emit an ordered region.
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)
virtual void emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false)
Emit an implicit/explicit barrier for OpenMP threads.
bool needCleanups(unsigned N)
Returns true if the private copy requires cleanups.
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.
unsigned getOrder() const
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.
virtual void emitDoacrossOrdered(CodeGenFunction &CGF, const OMPDependClause *C)
Emit code for doacross ordered directive with 'depend' clause.
void loadOffloadInfoMetadata()
Loads all the offload entries information from the host IR metadata.
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.
void emitKmpRoutineEntryT(QualType KmpInt32Ty)
Build type kmp_routine_entry_t (if not built yet).
virtual ~CGOpenMPRuntime()
void clearArrayInfo()
Clear information about the data arrays.
virtual void emitCriticalRegion(CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr)
Emits a critical region.
SmallVector< const Expr *, 4 > FirstprivateVars
virtual void emitTargetOutlinedFunctionHelper(const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
Helper to emit outlined function for 'target' directive.
CGOpenMPRuntime(CodeGenModule &CGM)
OpenMPProcBindClauseKind
OpenMP attributes for 'proc_bind' clause.
virtual llvm::Function * emitRegistrationFunction()
Creates the offloading descriptor in the event any target region was emitted in the current module an...
llvm::Constant * createDispatchInitFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_dispatch_init_* runtime function for the specified size IVSize and sign IVSigned...
virtual void emitTaskwaitCall(CodeGenFunction &CGF, SourceLocation Loc)
Emit code for 'taskwait' directive.
GlobalDecl - represents a global declaration.
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()
const MatchFinder::MatchFinderOptions & Options
llvm::Constant * getID() const
bool usesReductionInitializer(unsigned N) const
Returns true if the initialization of the reduction item uses initializer from declare reduction cons...
void emitOMPIfClause(CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen)
Emits code for OpenMP 'if' clause using specified CodeGen function.
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.
llvm::Type * getIdentTyPointerTy()
Returns pointer to ident_t type.
This represents '#pragma omp declare reduction ...' directive.
llvm::PointerIntPair< llvm::Value *, 1, bool > Final
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.
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)
OffloadingEntryInfoKinds getKind() const
OpenMPDirectiveKind
OpenMP directives.
virtual void emitTaskyieldCall(CodeGenFunction &CGF, SourceLocation Loc)
Emits code for a taskyield directive.
Target region entries related.
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...
void emitAggregateType(CodeGenFunction &CGF, unsigned N)
Emits the code for the variable-modified type, if required.
virtual void Enter(CodeGenFunction &CGF)
void setAction(PrePostActionTy &Action) const
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 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...
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.
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)...
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
This class organizes the cross-function state that is used while generating LLVM code.
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
void setAddress(llvm::Constant *V)
virtual void emitForStaticFinish(CodeGenFunction &CGF, SourceLocation Loc)
Call the appropriate runtime routine to notify that we finished all the work with current loop...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
A basic class for pre|post-action for advanced codegen sequence for OpenMP region.
virtual void emitMasterRegion(CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc)
Emits a master region.
llvm::Function * createOffloadingBinaryDescriptorRegistration()
Creates and registers offloading binary descriptor for the current compilation unit.
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.
llvm::PointerIntPair< llvm::Value *, 1, bool > Priority
ReductionCodeGen(ArrayRef< const Expr * > Shareds, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > ReductionOps)
virtual void emitTaskReductionFixups(CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
Required to resolve existing problems in the runtime.
detail::InMemoryDirectory::const_iterator E
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 emitTargetOutlinedFunction(const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
Emit outilined function for 'target' directive.
void emitInitialization(CodeGenFunction &CGF, unsigned N, Address PrivateAddr, LValue SharedLVal, llvm::function_ref< bool(CodeGenFunction &)> DefaultInit)
Performs initialization of the private copy for the reduction item.
OffloadEntriesInfoManagerTy OffloadEntriesInfoManager
static bool classof(const OffloadEntryInfo *Info)
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.
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.
Entity that registers the offloading constants that were emitted so far.
virtual bool isStaticNonchunked(OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const
Check if the specified ScheduleKind is static non-chunked.
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.
llvm::Constant * createDispatchNextFunction(unsigned IVSize, bool IVSigned)
Returns __kmpc_dispatch_next_* runtime function for the specified size IVSize and sign IVSigned...
virtual void emitCancelCall(CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion)
Emit code for 'cancel' construct.
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...
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 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...
virtual Address getAddrOfThreadPrivate(CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc)
Returns address of the threadprivate variable for the current thread.
const VarDecl * getBaseDecl(unsigned N) const
Returns the base declaration of the reduction item.
A reference to a declared variable, function, enum, etc.
virtual void emitDoacrossInit(CodeGenFunction &CGF, const OMPLoopDirective &D)
Emit initialization for doacross loop nesting support.
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.
llvm::Constant * createRuntimeFunction(unsigned Function)
Returns specified OpenMP runtime function.
virtual void emitTaskgroupRegion(CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc)
Emit a taskgroup region.
void operator()(CodeGenFunction &CGF) const
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 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 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...