class OpenMPIRBuilder

Declaration

class OpenMPIRBuilder { /* full declaration omitted */ };

Description

An interface to create LLVM-IR for OpenMP directives. Each OpenMP directive has a corresponding public generator method.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:75

Member Variables

public SmallVector< llvm::OpenMPIRBuilder::FinalizationInfo, 8> FinalizationStack
The finalization stack made up of finalize callbacks currently in-flight, wrapped into FinalizationInfo objects that reference also the finalization target block and the kind of cancellable directive.
public llvm::Module& M
The underlying LLVM-IR module
public IRBuilder<> Builder
The LLVM-IR Builder used to create IR.
public StringMap<llvm::Constant*> SrcLocStrMap
Map to remember source location strings
public DenseMap<std::pair<Constant*, uint64_t>, llvm::Constant*> IdentMap
Map to remember existing ident_t*.
public SmallVector<llvm::OpenMPIRBuilder::OutlineInfo, 16> OutlineInfos
Collection of regions that need to be outlined during finalization.
public std::forward_list<CanonicalLoopInfo> LoopInfos
Collection of owned canonical loop objects that eventually need to be free'd.
public StringMap<AssertingVH<llvm::Constant>, llvm::BumpPtrAllocator> InternalVars
An ordered map of auto-generated variables to their unique names. It stores variables with the following names: 1) ".gomp_critical_user_" + <critical _section_name> + ".var" for "omp critical" directives; 2) <mangled _name_for_global_var> + ".cache." for cache for threadprivate variables.
public llvm::Type* Void = nullptr
public llvm::Type* Int1 = nullptr
public llvm::Type* Int8 = nullptr
public llvm::Type* Int16 = nullptr
public llvm::Type* Int32 = nullptr
public llvm::Type* Int64 = nullptr
public llvm::Type* Int8Ptr = nullptr
public llvm::Type* Int16Ptr = nullptr
public llvm::Type* Int32Ptr = nullptr
public llvm::Type* Int64Ptr = nullptr
public llvm::Type* Double = nullptr
public llvm::Type* SizeTy = nullptr
public llvm::Type* VoidPtr = nullptr
public llvm::Type* VoidPtrPtr = nullptr
public llvm::Type* VoidPtrPtrPtr = nullptr
public llvm::Type* Int8PtrPtr = nullptr
public llvm::Type* Int8PtrPtrPtr = nullptr
public llvm::ArrayType* KmpCriticalNameTy = nullptr
public llvm::PointerType* KmpCriticalNamePtrTy = nullptr
public llvm::StructType* Ident = nullptr
public llvm::PointerType* IdentPtr = nullptr
public llvm::StructType* OffloadEntry = nullptr
public llvm::PointerType* OffloadEntryPtr = nullptr
public llvm::StructType* KernelArgs = nullptr
public llvm::PointerType* KernelArgsPtr = nullptr
public llvm::StructType* AsyncInfo = nullptr
public llvm::PointerType* AsyncInfoPtr = nullptr
public llvm::FunctionType* ParallelTask = nullptr
public llvm::PointerType* ParallelTaskPtr = nullptr
public llvm::FunctionType* ReduceFunction = nullptr
public llvm::PointerType* ReduceFunctionPtr = nullptr
public llvm::FunctionType* CopyFunction = nullptr
public llvm::PointerType* CopyFunctionPtr = nullptr
public llvm::FunctionType* KmpcCtor = nullptr
public llvm::PointerType* KmpcCtorPtr = nullptr
public llvm::FunctionType* KmpcDtor = nullptr
public llvm::PointerType* KmpcDtorPtr = nullptr
public llvm::FunctionType* KmpcCopyCtor = nullptr
public llvm::PointerType* KmpcCopyCtorPtr = nullptr
public llvm::FunctionType* TaskRoutineEntry = nullptr
public llvm::PointerType* TaskRoutineEntryPtr = nullptr
public llvm::FunctionType* ShuffleReduce = nullptr
public llvm::PointerType* ShuffleReducePtr = nullptr
public llvm::FunctionType* InterWarpCopy = nullptr
public llvm::PointerType* InterWarpCopyPtr = nullptr
public llvm::FunctionType* GlobalList = nullptr
public llvm::PointerType* GlobalListPtr = nullptr

Method Overview

  • private llvm::OpenMPIRBuilder::InsertPointTy EmitOMPInlinedRegion(omp::Directive OMPD, llvm::Instruction * EntryCall, llvm::Instruction * ExitCall, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, bool Conditional = false, bool HasFinalize = true, bool IsCancellable = false)
  • public OpenMPIRBuilder(llvm::Module & M)
  • public void addAttributes(omp::RuntimeFunction FnID, llvm::Function & Fn)
  • public void addOutlineInfo(llvm::OpenMPIRBuilder::OutlineInfo && OI)
  • private llvm::OpenMPIRBuilder::InsertPointTy applyDynamicWorkshareLoop(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * CLI, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, omp::OMPScheduleType SchedType, bool NeedsBarrier, llvm::Value * Chunk = nullptr)
  • public void applySimd(llvm::CanonicalLoopInfo * Loop, llvm::ConstantInt * Simdlen)
  • private llvm::OpenMPIRBuilder::InsertPointTy applyStaticChunkedWorkshareLoop(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * CLI, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, bool NeedsBarrier, llvm::Value * ChunkSize)
  • private llvm::OpenMPIRBuilder::InsertPointTy applyStaticWorkshareLoop(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * CLI, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, bool NeedsBarrier)
  • public llvm::OpenMPIRBuilder::InsertPointTy applyWorkshareLoop(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * CLI, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, bool NeedsBarrier, llvm::omp::ScheduleKind SchedKind = llvm::omp::OMP_SCHEDULE_Default, llvm::Value * ChunkSize = nullptr, bool HasSimdModifier = false, bool HasMonotonicModifier = false, bool HasNonmonotonicModifier = false, bool HasOrderedClause = false)
  • private bool checkAndEmitFlushAfterAtomic(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::AtomicOrdering AO, llvm::OpenMPIRBuilder::AtomicKind AK)
  • public llvm::CanonicalLoopInfo * collapseLoops(llvm::DebugLoc DL, ArrayRef<llvm::CanonicalLoopInfo *> Loops, llvm::OpenMPIRBuilder::InsertPointTy ComputeIP)
  • public llvm::OpenMPIRBuilder::InsertPointTy createAtomicCapture(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder::AtomicOpValue & X, llvm::OpenMPIRBuilder::AtomicOpValue & V, llvm::Value * Expr, llvm::AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp, llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy & UpdateOp, bool UpdateExpr, bool IsPostfixUpdate, bool IsXBinopExpr)
  • public llvm::OpenMPIRBuilder::InsertPointTy createAtomicCompare(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::AtomicOpValue & X, llvm::OpenMPIRBuilder::AtomicOpValue & V, llvm::OpenMPIRBuilder::AtomicOpValue & R, llvm::Value * E, llvm::Value * D, llvm::AtomicOrdering AO, omp::OMPAtomicCompareOp Op, bool IsXBinopExpr, bool IsPostfixUpdate, bool IsFailOnly)
  • public llvm::OpenMPIRBuilder::InsertPointTy createAtomicRead(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::AtomicOpValue & X, llvm::OpenMPIRBuilder::AtomicOpValue & V, llvm::AtomicOrdering AO)
  • public llvm::OpenMPIRBuilder::InsertPointTy createAtomicUpdate(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder::AtomicOpValue & X, llvm::Value * Expr, llvm::AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp, llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy & UpdateOp, bool IsXBinopExpr)
  • public llvm::OpenMPIRBuilder::InsertPointTy createAtomicWrite(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::AtomicOpValue & X, llvm::Value * Expr, llvm::AtomicOrdering AO)
  • public llvm::OpenMPIRBuilder::InsertPointTy createBarrier(const llvm::OpenMPIRBuilder::LocationDescription & Loc, omp::Directive DK, bool ForceSimpleCall = false, bool CheckCancelFlag = true)
  • public llvm::CallInst * createCachedThreadPrivate(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * Pointer, llvm::ConstantInt * Size, const llvm::Twine & Name = llvm::Twine(""))
  • public llvm::OpenMPIRBuilder::InsertPointTy createCancel(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * IfCondition, omp::Directive CanceledDirective)
  • public llvm::CanonicalLoopInfo * createCanonicalLoop(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy BodyGenCB, llvm::Value * Start, llvm::Value * Stop, llvm::Value * Step, bool IsSigned, bool InclusiveStop, llvm::OpenMPIRBuilder::InsertPointTy ComputeIP = {}, const llvm::Twine & Name = "loop")
  • public llvm::CanonicalLoopInfo * createCanonicalLoop(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy BodyGenCB, llvm::Value * TripCount, const llvm::Twine & Name = "loop")
  • public llvm::OpenMPIRBuilder::InsertPointTy createCopyPrivate(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * BufSize, llvm::Value * CpyBuf, llvm::Value * CpyFn, llvm::Value * DidIt)
  • public llvm::OpenMPIRBuilder::InsertPointTy createCopyinClauseBlocks(llvm::OpenMPIRBuilder::InsertPointTy IP, llvm::Value * MasterAddr, llvm::Value * PrivateAddr, llvm::IntegerType * IntPtrTy, bool BranchtoEnd = true)
  • public llvm::OpenMPIRBuilder::InsertPointTy createCritical(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, llvm::StringRef CriticalName, llvm::Value * HintInst)
  • public void createFlush(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public llvm::GlobalValue * createGlobalFlag(unsigned int Value, llvm::StringRef Name)
  • public llvm::CanonicalLoopInfo * createLoopSkeleton(llvm::DebugLoc DL, llvm::Value * TripCount, llvm::Function * F, llvm::BasicBlock * PreInsertBefore, llvm::BasicBlock * PostInsertBefore, const llvm::Twine & Name = {})
  • public void createMapperAllocas(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, unsigned int NumOperands, struct MapperAllocas & MapperAllocas)
  • public llvm::OpenMPIRBuilder::InsertPointTy createMasked(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, llvm::Value * Filter)
  • public llvm::OpenMPIRBuilder::InsertPointTy createMaster(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB)
  • public llvm::CallInst * createOMPAlloc(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * Size, llvm::Value * Allocator, std::string Name = "")
  • public llvm::CallInst * createOMPFree(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * Addr, llvm::Value * Allocator, std::string Name = "")
  • public llvm::CallInst * createOMPInteropDestroy(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * InteropVar, llvm::Value * Device, llvm::Value * NumDependences, llvm::Value * DependenceAddress, bool HaveNowaitClause)
  • public llvm::CallInst * createOMPInteropInit(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * InteropVar, omp::OMPInteropType InteropType, llvm::Value * Device, llvm::Value * NumDependences, llvm::Value * DependenceAddress, bool HaveNowaitClause)
  • public llvm::CallInst * createOMPInteropUse(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value * InteropVar, llvm::Value * Device, llvm::Value * NumDependences, llvm::Value * DependenceAddress, bool HaveNowaitClause)
  • public llvm::GlobalVariable * createOffloadMapnames(SmallVectorImpl<llvm::Constant *> & Names, std::string VarName)
  • public llvm::GlobalVariable * createOffloadMaptypes(SmallVectorImpl<uint64_t> & Mappings, std::string VarName)
  • public llvm::OpenMPIRBuilder::InsertPointTy createOrderedDepend(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, unsigned int NumLoops, ArrayRef<llvm::Value *> StoreValues, const llvm::Twine & Name, bool IsDependSource)
  • public llvm::OpenMPIRBuilder::InsertPointTy createOrderedThreadsSimd(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, bool IsThreads)
  • public IRBuilder<>::InsertPoint createParallel(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::PrivatizeCallbackTy PrivCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, llvm::Value * IfCondition, llvm::Value * NumThreads, omp::ProcBindKind ProcBind, bool IsCancellable)
  • public llvm::OpenMPIRBuilder::InsertPointTy createReductions(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, ArrayRef<llvm::OpenMPIRBuilder::ReductionInfo> ReductionInfos, bool IsNoWait = false)
  • public llvm::OpenMPIRBuilder::InsertPointTy createSection(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB)
  • public llvm::OpenMPIRBuilder::InsertPointTy createSections(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, ArrayRef<llvm::OpenMPIRBuilder::StorableBodyGenCallbackTy> SectionCBs, llvm::OpenMPIRBuilder::PrivatizeCallbackTy PrivCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, bool IsCancellable, bool IsNowait)
  • public llvm::OpenMPIRBuilder::InsertPointTy createSingle(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB, bool IsNowait, llvm::Value * DidIt)
  • public void createTargetDeinit(const llvm::OpenMPIRBuilder::LocationDescription & Loc, bool IsSPMD, bool RequiresFullRuntime)
  • public llvm::OpenMPIRBuilder::InsertPointTy createTargetInit(const llvm::OpenMPIRBuilder::LocationDescription & Loc, bool IsSPMD, bool RequiresFullRuntime)
  • public llvm::OpenMPIRBuilder::InsertPointTy createTask(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB, bool Tied = true, llvm::Value * Final = nullptr)
  • public llvm::OpenMPIRBuilder::InsertPointTy createTaskgroup(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB)
  • public void createTaskwait(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public void createTaskyield(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • private std::pair<Value *, Value *> emitAtomicUpdate(llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::Value * X, llvm::Type * XElemTy, llvm::Value * Expr, llvm::AtomicOrdering AO, AtomicRMWInst::BinOp RMWOp, llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy & UpdateOp, bool VolatileX, bool IsXBinopExpr)
  • public llvm::OpenMPIRBuilder::InsertPointTy emitBarrierImpl(const llvm::OpenMPIRBuilder::LocationDescription & Loc, omp::Directive DK, bool ForceSimpleCall, bool CheckCancelFlag)
  • public void emitCancelationCheckImpl(llvm::Value * CancelFlag, omp::Directive CanceledDirective, llvm::OpenMPIRBuilder::FinalizeCallbackTy ExitCB = {})
  • private llvm::OpenMPIRBuilder::InsertPointTy emitCommonDirectiveEntry(omp::Directive OMPD, llvm::Value * EntryCall, llvm::BasicBlock * ExitBB, bool Conditional = false)
  • private llvm::OpenMPIRBuilder::InsertPointTy emitCommonDirectiveExit(omp::Directive OMPD, llvm::OpenMPIRBuilder::InsertPointTy FinIP, llvm::Instruction * ExitCall, bool HasFinalize = true)
  • public void emitFlush(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public void emitMapperCall(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Function * MapperFunc, llvm::Value * SrcLocInfo, llvm::Value * MaptypesArg, llvm::Value * MapnamesArg, struct MapperAllocas & MapperAllocas, int64_t DeviceID, unsigned int NumOperands)
  • public void emitOffloadingEntry(llvm::Constant * Addr, llvm::StringRef Name, uint64_t Size, int32_t Flags, llvm::StringRef SectionName = "omp_offloading_entries")
  • private llvm::Value * emitRMWOpAsInstruction(llvm::Value * Src1, llvm::Value * Src2, AtomicRMWInst::BinOp RMWOp)
  • public llvm::OpenMPIRBuilder::InsertPointTy emitTargetKernel(const llvm::OpenMPIRBuilder::LocationDescription & Loc, llvm::Value *& Return, llvm::Value * Ident, llvm::Value * DeviceID, llvm::Value * NumTeams, llvm::Value * NumThreads, llvm::Value * HostPtr, ArrayRef<llvm::Value *> KernelArgs, ArrayRef<llvm::Value *> NoWaitArgs = {})
  • public void emitTaskwaitImpl(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public void emitTaskyieldImpl(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public void finalize(llvm::Function * Fn = nullptr)
  • public llvm::OpenMPIRBuilder::InsertPointTy getInsertionPoint()
  • private static std::string getNameWithSeparators(ArrayRef<llvm::StringRef> Parts, llvm::StringRef FirstSeparator, llvm::StringRef Separator)
  • private llvm::Value * getOMPCriticalRegionLock(llvm::StringRef CriticalName)
  • public llvm::Constant * getOrCreateDefaultSrcLocStr(uint32_t & SrcLocStrSize)
  • public llvm::Constant * getOrCreateIdent(llvm::Constant * SrcLocStr, uint32_t SrcLocStrSize, omp::IdentFlag Flags = llvm::omp::IdentFlag(0), unsigned int Reserve2Flags = 0)
  • private llvm::Constant * getOrCreateOMPInternalVariable(llvm::Type * Ty, const llvm::Twine & Name, unsigned int AddressSpace = 0)
  • public llvm::FunctionCallee getOrCreateRuntimeFunction(llvm::Module & M, omp::RuntimeFunction FnID)
  • public llvm::Function * getOrCreateRuntimeFunctionPtr(omp::RuntimeFunction FnID)
  • public llvm::Constant * getOrCreateSrcLocStr(llvm::StringRef LocStr, uint32_t & SrcLocStrSize)
  • public llvm::Constant * getOrCreateSrcLocStr(llvm::StringRef FunctionName, llvm::StringRef FileName, unsigned int Line, unsigned int Column, uint32_t & SrcLocStrSize)
  • public llvm::Constant * getOrCreateSrcLocStr(llvm::DebugLoc DL, uint32_t & SrcLocStrSize, llvm::Function * F = nullptr)
  • public llvm::Constant * getOrCreateSrcLocStr(const llvm::OpenMPIRBuilder::LocationDescription & Loc, uint32_t & SrcLocStrSize)
  • public llvm::Value * getOrCreateThreadID(llvm::Value * Ident)
  • public void initialize()
  • private void initializeTypes(llvm::Module & M)
  • public bool isLastFinalizationInfoCancellable(omp::Directive DK)
  • public void popFinalizationCB()
  • public void pushFinalizationCB(const llvm::OpenMPIRBuilder::FinalizationInfo & FI)
  • public std::vector<CanonicalLoopInfo *> tileLoops(llvm::DebugLoc DL, ArrayRef<llvm::CanonicalLoopInfo *> Loops, ArrayRef<llvm::Value *> TileSizes)
  • public void unrollLoopFull(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * Loop)
  • public void unrollLoopHeuristic(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * Loop)
  • public void unrollLoopPartial(llvm::DebugLoc DL, llvm::CanonicalLoopInfo * Loop, int32_t Factor, llvm::CanonicalLoopInfo ** UnrolledCLI)
  • public bool updateToLocation(const llvm::OpenMPIRBuilder::LocationDescription & Loc)
  • public ~OpenMPIRBuilder()

Methods

llvm::OpenMPIRBuilder::InsertPointTy
EmitOMPInlinedRegion(
    omp::Directive OMPD,
    llvm::Instruction* EntryCall,
    llvm::Instruction* ExitCall,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    bool Conditional = false,
    bool HasFinalize = true,
    bool IsCancellable = false)

Description

Common Interface to generate OMP inlined regions

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1298

Parameters

omp::Directive OMPD
Directive to generate inlined region for
llvm::Instruction* EntryCall
Call to the entry OMP Runtime Function
llvm::Instruction* ExitCall
Call to the ending OMP Runtime Function
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Body code generation callback.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Finalization Callback. Will be called when finalizing region
bool Conditional = false
indicate if the entry call result will be used to evaluate a conditional of whether a thread will execute body code or not.
bool HasFinalize = true
indicate if the directive will require finalization and has a finalization callback in the stack that should be called.
bool IsCancellable = false
if HasFinalize is set to true, indicate if the the directive should be cancellable.

Returns

The insertion point after the region

OpenMPIRBuilder(llvm::Module& M)

Description

Create a new OpenMPIRBuilder operating on the given module \p M. This will not have an effect on \p M (see initialize).

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:79

Parameters

llvm::Module& M

void addAttributes(omp::RuntimeFunction FnID,
                   llvm::Function& Fn)

Description

Add attributes known for \p FnID to \p Fn.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:93

Parameters

omp::RuntimeFunction FnID
llvm::Function& Fn

void addOutlineInfo(
    llvm::OpenMPIRBuilder::OutlineInfo&& OI)

Description

Add a new region that will be outlined later.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:933

Parameters

llvm::OpenMPIRBuilder::OutlineInfo&& OI

llvm::OpenMPIRBuilder::InsertPointTy
applyDynamicWorkshareLoop(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* CLI,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    omp::OMPScheduleType SchedType,
    bool NeedsBarrier,
    llvm::Value* Chunk = nullptr)

Description

Modifies the canonical loop to be a dynamically-scheduled workshare loop. This takes a \p LoopInfo representing a canonical loop, such as the one created by \p createCanonicalLoop and emits additional instructions to turn it into a workshare loop. In particular, it calls to an OpenMP runtime function in the preheader to obtain, and then in each iteration to update the loop counter.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:464

Parameters

llvm::DebugLoc DL
Debug location for instructions added for the workshare-loop construct itself.
llvm::CanonicalLoopInfo* CLI
A descriptor of the canonical loop to workshare.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
An insertion point for Alloca instructions usable in the preheader of the loop.
omp::OMPScheduleType SchedType
Type of scheduling to be passed to the init function.
bool NeedsBarrier
Indicates whether a barrier must be insterted after the loop.
llvm::Value* Chunk = nullptr
The size of loop chunk considered as a unit when scheduling. If \p nullptr, defaults to 1.

Returns

Point where to insert code after the workshare construct.

void applySimd(llvm::CanonicalLoopInfo* Loop,
               llvm::ConstantInt* Simdlen)

Description

Add metadata to simd-ize a loop.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:604

Parameters

llvm::CanonicalLoopInfo* Loop
The loop to simd-ize.
llvm::ConstantInt* Simdlen
The Simdlen length to apply to the simd loop.

llvm::OpenMPIRBuilder::InsertPointTy
applyStaticChunkedWorkshareLoop(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* CLI,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    bool NeedsBarrier,
    llvm::Value* ChunkSize)

Description

Modifies the canonical loop a statically-scheduled workshare loop with a user-specified chunk size.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:438

Parameters

llvm::DebugLoc DL
Debug location for instructions added for the workshare-loop construct itself.
llvm::CanonicalLoopInfo* CLI
A descriptor of the canonical loop to workshare.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
An insertion point for Alloca instructions usable in the preheader of the loop.
bool NeedsBarrier
Indicates whether a barrier must be inserted after the loop.
llvm::Value* ChunkSize
The user-specified chunk size.

Returns

Point where to insert code after the workshare construct.

llvm::OpenMPIRBuilder::InsertPointTy
applyStaticWorkshareLoop(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* CLI,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    bool NeedsBarrier)

Description

Modifies the canonical loop to be a statically-scheduled workshare loop. This takes a \p LoopInfo representing a canonical loop, such as the one created by \p createCanonicalLoop and emits additional instructions to turn it into a workshare loop. In particular, it calls to an OpenMP runtime function in the preheader to obtain the loop bounds to be used in the current thread, updates the relevant instructions in the canonical loop and calls to an OpenMP runtime finalization function after the loop.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:421

Parameters

llvm::DebugLoc DL
Debug location for instructions added for the workshare-loop construct itself.
llvm::CanonicalLoopInfo* CLI
A descriptor of the canonical loop to workshare.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
An insertion point for Alloca instructions usable in the preheader of the loop.
bool NeedsBarrier
Indicates whether a barrier must be inserted after the loop.

Returns

Point where to insert code after the workshare construct.

llvm::OpenMPIRBuilder::InsertPointTy
applyWorkshareLoop(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* CLI,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    bool NeedsBarrier,
    llvm::omp::ScheduleKind SchedKind =
        llvm::omp::OMP_SCHEDULE_Default,
    llvm::Value* ChunkSize = nullptr,
    bool HasSimdModifier = false,
    bool HasMonotonicModifier = false,
    bool HasNonmonotonicModifier = false,
    bool HasOrderedClause = false)

Description

Modifies the canonical loop to be a workshare loop. This takes a \p LoopInfo representing a canonical loop, such as the one created by \p createCanonicalLoop and emits additional instructions to turn it into a workshare loop. In particular, it calls to an OpenMP runtime function in the preheader to obtain the loop bounds to be used in the current thread, updates the relevant instructions in the canonical loop and calls to an OpenMP runtime finalization function after the loop. The concrete transformation is done by applyStaticWorkshareLoop, applyStaticChunkedWorkshareLoop, or applyDynamicWorkshareLoop, depending on the value of \p SchedKind and \p ChunkSize.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:503

Parameters

llvm::DebugLoc DL
Debug location for instructions added for the workshare-loop construct itself.
llvm::CanonicalLoopInfo* CLI
A descriptor of the canonical loop to workshare.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
An insertion point for Alloca instructions usable in the preheader of the loop.
bool NeedsBarrier
Indicates whether a barrier must be insterted after the loop.
llvm::omp::ScheduleKind SchedKind = llvm::omp::OMP_SCHEDULE_Default
Scheduling algorithm to use.
llvm::Value* ChunkSize = nullptr
The chunk size for the inner loop.
bool HasSimdModifier = false
Whether the simd modifier is present in the schedule clause.
bool HasMonotonicModifier = false
Whether the monotonic modifier is present in the schedule clause.
bool HasNonmonotonicModifier = false
Whether the nonmonotonic modifier is present in the schedule clause.
bool HasOrderedClause = false
Whether the (parameterless) ordered clause is present.

Returns

Point where to insert code after the workshare construct.

bool checkAndEmitFlushAfterAtomic(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::AtomicOrdering AO,
    llvm::OpenMPIRBuilder::AtomicKind AK)

Description

Determine whether to emit flush or not

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1354

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::AtomicOrdering AO
The required atomic ordering
llvm::OpenMPIRBuilder::AtomicKind AK
The OpenMP atomic operation kind used.

Returns

wether a flush was emitted or not

llvm::CanonicalLoopInfo* collapseLoops(
    llvm::DebugLoc DL,
    ArrayRef<llvm::CanonicalLoopInfo*> Loops,
    llvm::OpenMPIRBuilder::InsertPointTy
        ComputeIP)

Description

Collapse a loop nest into a single loop. Merges loops of a loop nest into a single CanonicalLoopNest representation that has the same number of innermost loop iterations as the origin loop nest. The induction variables of the input loops are derived from the collapsed loop's induction variable. This is intended to be used to implement OpenMP's collapse clause. Before applying a directive, collapseLoops normalizes a loop nest to contain only a single loop and the directive's implementation does not need to handle multiple loops itself. This does not remove the need to handle all loop nest handling by directives, such as the ordered( <n >) clause or the simd schedule-clause modifier of the worksharing-loop directive. Example: After collapsing with Loops={i,j}, the loop is changed to In the current implementation, the following limitations apply: * All input loops have an induction variable of the same type. * The collapsed loop will have the same trip count integer type as the input loops. Therefore it is possible that the collapsed loop cannot represent all iterations of the input loops. For instance, assuming a 32 bit integer type, and two input loops both iterating 2^16 times, the theoretical trip count of the collapsed loop would be 2^32 iteration, which cannot be represented in an 32-bit integer. Behavior is undefined in this case. * The trip counts of every input loop must be available at \p ComputeIP. Non-rectangular loops are not yet supported. * At each nest level, code between a surrounding loop and its nested loop is hoisted into the loop body, and such code will be executed more often than before collapsing (or not at all if any inner loop iteration has a trip count of 0). This is permitted by the OpenMP specification.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:398

Parameters

llvm::DebugLoc DL
Debug location for instructions added for collapsing, such as instructions to compute/derive the input loop's induction variables.
ArrayRef<llvm::CanonicalLoopInfo*> Loops
Loops in the loop nest to collapse. Loops are specified from outermost-to-innermost and every control flow of a loop's body must pass through its directly nested loop.
llvm::OpenMPIRBuilder::InsertPointTy ComputeIP
Where additional instruction that compute the collapsed trip count. If not set, defaults to before the generated loop.

Returns

The CanonicalLoopInfo object representing the collapsed loop.

llvm::OpenMPIRBuilder::InsertPointTy
createAtomicCapture(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::OpenMPIRBuilder::AtomicOpValue& X,
    llvm::OpenMPIRBuilder::AtomicOpValue& V,
    llvm::Value* Expr,
    llvm::AtomicOrdering AO,
    AtomicRMWInst::BinOp RMWOp,
    llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy&
        UpdateOp,
    bool UpdateExpr,
    bool IsPostfixUpdate,
    bool IsXBinopExpr)

Description

Emit atomic update for constructs: --- Only Scalar data types V = X; X = X BinOp Expr , X = X BinOp Expr; V = X, V = X; X = Expr BinOp X, X = Expr BinOp X; V = X, V = X; X = UpdateOp(X), X = UpdateOp(X); V = X,

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1486

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
llvm::OpenMPIRBuilder::AtomicOpValue& X
The target atomic pointer to be updated
llvm::OpenMPIRBuilder::AtomicOpValue& V
Memory address where to store captured value
llvm::Value* Expr
The value to update X with.
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions
AtomicRMWInst::BinOp RMWOp
The binary operation used for update. If operation is not supported by atomicRMW, or belong to {FADD, FSUB, BAD_BINOP}. Then a cmpExch based atomic will be generated.
llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy& UpdateOp
Code generator for complex expressions that cannot be expressed through atomicrmw instruction.
bool UpdateExpr
true if X is an in place update of the form X = X BinOp Expr or X = Expr BinOp X
bool IsPostfixUpdate
true if original value of 'x' must be stored in 'v', not an updated one.
bool IsXBinopExpr
true if X is Left H.S. in Right H.S. part of the update expression, false otherwise. (e.g. true for X = X BinOp Expr)

Returns

Insertion point after generated atomic capture IR.

llvm::OpenMPIRBuilder::InsertPointTy
createAtomicCompare(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::AtomicOpValue& X,
    llvm::OpenMPIRBuilder::AtomicOpValue& V,
    llvm::OpenMPIRBuilder::AtomicOpValue& R,
    llvm::Value* E,
    llvm::Value* D,
    llvm::AtomicOrdering AO,
    omp::OMPAtomicCompareOp Op,
    bool IsXBinopExpr,
    bool IsPostfixUpdate,
    bool IsFailOnly)

Description

Emit atomic compare for constructs: --- Only scalar data types cond-expr-stmt: x = x ordop expr ? expr : x; x = expr ordop x ? expr : x; x = x == e ? d : x; x = e == x ? d : x; (this one is not in the spec) cond-update-stmt: if (x ordop expr) { x = expr; } if (expr ordop x) { x = expr; } if (x == e) { x = d; } if (e == x) { x = d; } (this one is not in the spec) conditional-update-capture-atomic: v = x; cond-update-stmt; (IsPostfixUpdate=true, IsFailOnly=false) cond-update-stmt; v = x; (IsPostfixUpdate=false, IsFailOnly=false) if (x == e) { x = d; } else { v = x; } (IsPostfixUpdate=false, IsFailOnly=true) r = x == e; if (r) { x = d; } (IsPostfixUpdate=false, IsFailOnly=false) r = x == e; if (r) { x = d; } else { v = x; } (IsPostfixUpdate=false, IsFailOnly=true)

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1538

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::AtomicOpValue& X
The target atomic pointer to be updated.
llvm::OpenMPIRBuilder::AtomicOpValue& V
Memory address where to store captured value (for compare capture only).
llvm::OpenMPIRBuilder::AtomicOpValue& R
Memory address where to store comparison result (for compare capture with '==' only).
llvm::Value* E
The expected value ('e') for forms that use an equality comparison or an expression ('expr') for forms that use 'ordop' (logically an atomic maximum or minimum).
llvm::Value* D
The desired value for forms that use an equality comparison. If forms that use 'ordop', it should be\p nullptr.
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions.
omp::OMPAtomicCompareOp Op
Atomic compare operation. It can only be ==, < , or >.
bool IsXBinopExpr
True if the conditional statement is in the form where x is on LHS. It only matters for < or >.
bool IsPostfixUpdate
True if original value of 'x' must be stored in 'v', not an updated one (for compare capture only).
bool IsFailOnly
True if the original value of 'x' is stored to 'v' only when the comparison fails. This is only valid for the case the comparison is '=='.

Returns

Insertion point after generated atomic capture IR.

llvm::OpenMPIRBuilder::InsertPointTy
createAtomicRead(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::AtomicOpValue& X,
    llvm::OpenMPIRBuilder::AtomicOpValue& V,
    llvm::AtomicOrdering AO)

Description

Emit atomic Read for : V = X --- Only Scalar data types.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1412

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::AtomicOpValue& X
The target pointer to be atomically read
llvm::OpenMPIRBuilder::AtomicOpValue& V
Memory address where to store atomically read value
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions.

Returns

Insertion point after generated atomic read IR.

llvm::OpenMPIRBuilder::InsertPointTy
createAtomicUpdate(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::OpenMPIRBuilder::AtomicOpValue& X,
    llvm::Value* Expr,
    llvm::AtomicOrdering AO,
    AtomicRMWInst::BinOp RMWOp,
    llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy&
        UpdateOp,
    bool IsXBinopExpr)

Description

Emit atomic update for constructs: X = X BinOp Expr ,or X = Expr BinOp X For complex Operations: X = UpdateOp(X) => CmpExch X, old_X, UpdateOp(X) Only Scalar data types.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1449

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
llvm::OpenMPIRBuilder::AtomicOpValue& X
The target atomic pointer to be updated
llvm::Value* Expr
The value to update X with.
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions.
AtomicRMWInst::BinOp RMWOp
The binary operation used for update. If operation is not supported by atomicRMW, or belong to {FADD, FSUB, BAD_BINOP}. Then a `cmpExch` based atomic will be generated.
llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy& UpdateOp
Code generator for complex expressions that cannot be expressed through atomicrmw instruction.
bool IsXBinopExpr
true if \a X is Left H.S. in Right H.S. part of the update expression, false otherwise. (e.g. true for X = X BinOp Expr)

Returns

Insertion point after generated atomic update IR.

llvm::OpenMPIRBuilder::InsertPointTy
createAtomicWrite(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::AtomicOpValue& X,
    llvm::Value* Expr,
    llvm::AtomicOrdering AO)

Description

Emit atomic write for : X = Expr --- Only Scalar data types.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1425

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::AtomicOpValue& X
The target pointer to be atomically written to
llvm::Value* Expr
The value to store.
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions.

Returns

Insertion point after generated atomic Write IR.

llvm::OpenMPIRBuilder::InsertPointTy
createBarrier(const llvm::OpenMPIRBuilder::
                  LocationDescription& Loc,
              omp::Directive DK,
              bool ForceSimpleCall = false,
              bool CheckCancelFlag = true)

Description

Generator for '#omp barrier'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:225

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the barrier directive was encountered.
omp::Directive DK
The kind of directive that caused the barrier.
bool ForceSimpleCall = false
Flag to force a simple (=non-cancellation) barrier.
bool CheckCancelFlag = true
Flag to indicate a cancel barrier return value should be checked and acted upon.

Returns

The insertion point after the barrier.

llvm::CallInst* createCachedThreadPrivate(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* Pointer,
    llvm::ConstantInt* Size,
    const llvm::Twine& Name = llvm::Twine(""))

Description

Create a runtime call for kmpc_threadprivate_cached

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1145

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* Pointer
pointer to data to be cached
llvm::ConstantInt* Size
size of data to be cached
const llvm::Twine& Name = llvm::Twine("")
Name of call Instruction for callinst

Returns

CallInst to the thread private cache call.

llvm::OpenMPIRBuilder::InsertPointTy createCancel(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* IfCondition,
    omp::Directive CanceledDirective)

Description

Generator for '#omp cancel'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:236

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the directive was encountered.
llvm::Value* IfCondition
The evaluated 'if' clause expression, if any.
omp::Directive CanceledDirective
The kind of directive that is cancled.

Returns

The insertion point after the barrier.

llvm::CanonicalLoopInfo* createCanonicalLoop(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy
        BodyGenCB,
    llvm::Value* Start,
    llvm::Value* Stop,
    llvm::Value* Step,
    bool IsSigned,
    bool InclusiveStop,
    llvm::OpenMPIRBuilder::InsertPointTy
        ComputeIP = {},
    const llvm::Twine& Name = "loop")

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:331

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy BodyGenCB
Callback that will generate the loop body code.
llvm::Value* Start
Value of the loop counter for the first iterations.
llvm::Value* Stop
Loop counter values past this will stop the loop.
llvm::Value* Step
Loop counter increment after each iteration; negative means counting down.
bool IsSigned
Whether Start, Stop and Step are signed integers.
bool InclusiveStop
Whether \p Stop itself is a valid value for the loop counter.
llvm::OpenMPIRBuilder::InsertPointTy ComputeIP = {}
Insertion point for instructions computing the trip count. Can be used to ensure the trip count is available at the outermost loop of a loop nest. If not set, defaults to the preheader of the generated loop.
const llvm::Twine& Name = "loop"
Base name used to derive BB and instruction names.

Returns

An object representing the created control flow structure which can be used for loop-associated directives.

llvm::CanonicalLoopInfo* createCanonicalLoop(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy
        BodyGenCB,
    llvm::Value* TripCount,
    const llvm::Twine& Name = "loop")

Description

Generator for the control flow structure of an OpenMP canonical loop. This generator operates on the logical iteration space of the loop, i.e. the caller only has to provide a loop trip count of the loop as defined by base language semantics. The trip count is interpreted as an unsigned integer. The induction variable passed to \p BodyGenCB will be of the same type and run from 0 to \p TripCount - 1. It is up to the callback to convert the logical iteration variable to the loop counter variable in the loop body.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:278

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description. The insert location can be between two instructions or the end of a degenerate block (e.g. a BB under construction).
llvm::OpenMPIRBuilder::LoopBodyGenCallbackTy BodyGenCB
Callback that will generate the loop body code.
llvm::Value* TripCount
Number of iterations the loop body is executed.
const llvm::Twine& Name = "loop"
Base name used to derive BB and instruction names.

Returns

An object representing the created control flow structure which can be used for loop-associated directives.

llvm::OpenMPIRBuilder::InsertPointTy
createCopyPrivate(const llvm::OpenMPIRBuilder::
                      LocationDescription& Loc,
                  llvm::Value* BufSize,
                  llvm::Value* CpyBuf,
                  llvm::Value* CpyFn,
                  llvm::Value* DidIt)

Description

Generator for __kmpc_copyprivate

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:987

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The source location description.
llvm::Value* BufSize
Number of elements in the buffer.
llvm::Value* CpyBuf
List of pointers to data to be copied.
llvm::Value* CpyFn
function to call for copying data.
llvm::Value* DidIt
flag variable; 1 for 'single' thread, 0 otherwise.

Returns

The insertion position *after* the CopyPrivate call.

llvm::OpenMPIRBuilder::InsertPointTy
createCopyinClauseBlocks(
    llvm::OpenMPIRBuilder::InsertPointTy IP,
    llvm::Value* MasterAddr,
    llvm::Value* PrivateAddr,
    llvm::IntegerType* IntPtrTy,
    bool BranchtoEnd = true)

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1110

Parameters

llvm::OpenMPIRBuilder::InsertPointTy IP
llvm::Value* MasterAddr
llvm::Value* PrivateAddr
llvm::IntegerType* IntPtrTy
bool BranchtoEnd = true

Returns

The insertion point where copying operation to be emitted.

llvm::OpenMPIRBuilder::InsertPointTy
createCritical(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    llvm::StringRef CriticalName,
    llvm::Value* HintInst)

Description

Generator for '#omp critical'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1036

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region body code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.
llvm::StringRef CriticalName
name of the lock used by the critical directive
llvm::Value* HintInst
Hint Instruction for hint clause associated with critical

Returns

The insertion position *after* the critical.

void createFlush(const llvm::OpenMPIRBuilder::
                     LocationDescription& Loc)

Description

Generator for '#omp flush'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:609

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the flush directive was encountered

llvm::GlobalValue* createGlobalFlag(
    unsigned int Value,
    llvm::StringRef Name)

Description

Create a hidden global flag \p Name in the module with initial value \p Value.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:801

Parameters

unsigned int Value
llvm::StringRef Name

llvm::CanonicalLoopInfo* createLoopSkeleton(
    llvm::DebugLoc DL,
    llvm::Value* TripCount,
    llvm::Function* F,
    llvm::BasicBlock* PreInsertBefore,
    llvm::BasicBlock* PostInsertBefore,
    const llvm::Twine& Name = {})

Description

Create the control flow structure of a canonical OpenMP loop. The emitted loop will be disconnected, i.e. no edge to the loop's preheader and no terminator in the AfterBB. The OpenMPIRBuilder's IRBuilder location is not preserved.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1559

Parameters

llvm::DebugLoc DL
DebugLoc used for the instructions in the skeleton.
llvm::Value* TripCount
Value to be used for the trip count.
llvm::Function* F
Function in which to insert the BasicBlocks.
llvm::BasicBlock* PreInsertBefore
Where to insert BBs that execute before the body, typically the body itself.
llvm::BasicBlock* PostInsertBefore
Where to insert BBs that execute after the body.
const llvm::Twine& Name = {}
Base name used to derive BB and instruction names.

Returns

The CanonicalLoopInfo that represents the emitted loop.

void createMapperAllocas(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    unsigned int NumOperands,
    struct MapperAllocas& MapperAllocas)

Description

Create the allocas instruction used in call to mapper functions.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:958

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
unsigned int NumOperands
struct MapperAllocas& MapperAllocas

llvm::OpenMPIRBuilder::InsertPointTy createMasked(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    llvm::Value* Filter)

Description

Generator for '#omp masked'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1023

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finialize variable copies.
llvm::Value* Filter

Returns

The insertion position *after* the masked.

llvm::OpenMPIRBuilder::InsertPointTy createMaster(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB)

Description

Generator for '#omp master'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1012

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.

Returns

The insertion position *after* the master.

llvm::CallInst* createOMPAlloc(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* Size,
    llvm::Value* Allocator,
    std::string Name = "")

Description

Create a runtime call for kmpc_Alloc

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1123

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* Size
Size of allocated memory space
llvm::Value* Allocator
Allocator information instruction
std::string Name = ""
Name of call Instruction for OMP_alloc

Returns

CallInst to the OMP_Alloc call

llvm::CallInst* createOMPFree(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* Addr,
    llvm::Value* Allocator,
    std::string Name = "")

Description

Create a runtime call for kmpc_free

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1134

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* Addr
Address of memory space to be freed
llvm::Value* Allocator
Allocator information instruction
std::string Name = ""
Name of call Instruction for OMP_Free

Returns

CallInst to the OMP_Free call

llvm::CallInst* createOMPInteropDestroy(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* InteropVar,
    llvm::Value* Device,
    llvm::Value* NumDependences,
    llvm::Value* DependenceAddress,
    bool HaveNowaitClause)

Description

Create a runtime call for __tgt_interop_destroy

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1178

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* InteropVar
variable to be allocated
llvm::Value* Device
devide to which offloading will occur
llvm::Value* NumDependences
number of dependence variables
llvm::Value* DependenceAddress
pointer to dependence variables
bool HaveNowaitClause
does nowait clause exist

Returns

CallInst to the __tgt_interop_destroy call

llvm::CallInst* createOMPInteropInit(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* InteropVar,
    omp::OMPInteropType InteropType,
    llvm::Value* Device,
    llvm::Value* NumDependences,
    llvm::Value* DependenceAddress,
    bool HaveNowaitClause)

Description

Create a runtime call for __tgt_interop_init

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1161

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* InteropVar
variable to be allocated
omp::OMPInteropType InteropType
type of interop operation
llvm::Value* Device
devide to which offloading will occur
llvm::Value* NumDependences
number of dependence variables
llvm::Value* DependenceAddress
pointer to dependence variables
bool HaveNowaitClause
does nowait clause exist

Returns

CallInst to the __tgt_interop_init call

llvm::CallInst* createOMPInteropUse(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value* InteropVar,
    llvm::Value* Device,
    llvm::Value* NumDependences,
    llvm::Value* DependenceAddress,
    bool HaveNowaitClause)

Description

Create a runtime call for __tgt_interop_use

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1194

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::Value* InteropVar
variable to be allocated
llvm::Value* Device
devide to which offloading will occur
llvm::Value* NumDependences
number of dependence variables
llvm::Value* DependenceAddress
pointer to dependence variables
bool HaveNowaitClause
does nowait clause exist

Returns

CallInst to the __tgt_interop_use call

llvm::GlobalVariable* createOffloadMapnames(
    SmallVectorImpl<llvm::Constant*>& Names,
    std::string VarName)

Description

Create the global variable holding the offload names information.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:948

Parameters

SmallVectorImpl<llvm::Constant*>& Names
std::string VarName

llvm::GlobalVariable* createOffloadMaptypes(
    SmallVectorImpl<uint64_t>& Mappings,
    std::string VarName)

Description

Create the global variable holding the offload mappings information.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:943

Parameters

SmallVectorImpl<uint64_t>& Mappings
std::string VarName

llvm::OpenMPIRBuilder::InsertPointTy
createOrderedDepend(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    unsigned int NumLoops,
    ArrayRef<llvm::Value*> StoreValues,
    const llvm::Twine& Name,
    bool IsDependSource)

Description

Generator for '#omp ordered depend (source | sink)'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1051

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
unsigned int NumLoops
The number of loops in depend clause.
ArrayRef<llvm::Value*> StoreValues
The value will be stored in vector address.
const llvm::Twine& Name
The name of alloca instruction.
bool IsDependSource
If true, depend source; otherwise, depend sink.

Returns

The insertion position *after* the ordered.

llvm::OpenMPIRBuilder::InsertPointTy
createOrderedThreadsSimd(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    bool IsThreads)

Description

Generator for '#omp ordered [threads | simd]'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1065

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.
bool IsThreads
If true, with threads clause or without clause; otherwise, with simd clause;

Returns

The insertion position *after* the ordered.

IRBuilder<>::InsertPoint createParallel(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::PrivatizeCallbackTy
        PrivCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    llvm::Value* IfCondition,
    llvm::Value* NumThreads,
    omp::ProcBindKind ProcBind,
    bool IsCancellable)

Description

Generator for '#omp parallel'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:253

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion points to be used for alloca instructions.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
llvm::OpenMPIRBuilder::PrivatizeCallbackTy PrivCB
Callback to copy a given variable (think copy constructor).
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.
llvm::Value* IfCondition
The evaluated 'if' clause expression, if any.
llvm::Value* NumThreads
The evaluated 'num_threads' clause expression, if any.
omp::ProcBindKind ProcBind
The value of the 'proc_bind' clause (see ProcBindKind).
bool IsCancellable
Flag to indicate a cancellable parallel region.

Returns

The insertion position *after* the parallel.

llvm::OpenMPIRBuilder::InsertPointTy
createReductions(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    ArrayRef<llvm::OpenMPIRBuilder::ReductionInfo>
        ReductionInfos,
    bool IsNoWait = false)

Description

Generator for '#omp reduction'. Emits the IR instructing the runtime to perform the specific kind of reductions. Expects reduction variables to have been privatized and initialized to reduction-neutral values separately. Emits the calls to runtime functions as well as the reduction function and the basic blocks performing the reduction atomically and non-atomically. The code emitted for the following: corresponds to the following sketch.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:749

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the reduction was encountered. Must be within the associate directive and after the last local access to the reduction variables.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
An insertion point suitable for allocas usable in reductions.
ArrayRef<llvm::OpenMPIRBuilder::ReductionInfo> ReductionInfos
A list of info on each reduction variable.
bool IsNoWait = false
A flag set if the reduction is marked as nowait.

llvm::OpenMPIRBuilder::InsertPointTy
createSection(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB)

Description

Generator for '#omp section'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1094

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region body code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.

Returns

The insertion position *after* the section.

llvm::OpenMPIRBuilder::InsertPointTy
createSections(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    ArrayRef<llvm::OpenMPIRBuilder::
                 StorableBodyGenCallbackTy>
        SectionCBs,
    llvm::OpenMPIRBuilder::PrivatizeCallbackTy
        PrivCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    bool IsCancellable,
    bool IsNowait)

Description

Generator for '#omp sections'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1081

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion points to be used for alloca instructions.
ArrayRef<llvm::OpenMPIRBuilder:: StorableBodyGenCallbackTy> SectionCBs
Callbacks that will generate body of each section.
llvm::OpenMPIRBuilder::PrivatizeCallbackTy PrivCB
Callback to copy a given variable (think copy constructor).
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.
bool IsCancellable
Flag to indicate a cancellable parallel region.
bool IsNowait
If true, barrier - to ensure all sections are executed before moving forward will not be generated.

Returns

The insertion position *after* the sections.

llvm::OpenMPIRBuilder::InsertPointTy createSingle(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        FiniCB,
    bool IsNowait,
    llvm::Value* DidIt)

Description

Generator for '#omp single'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1000

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The source location description.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
llvm::OpenMPIRBuilder::FinalizeCallbackTy FiniCB
Callback to finalize variable copies.
bool IsNowait
If false, a barrier is emitted.
llvm::Value* DidIt
Local variable used as a flag to indicate 'single' thread

Returns

The insertion position *after* the single call.

void createTargetDeinit(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    bool IsSPMD,
    bool RequiresFullRuntime)

Description

Create a runtime call for kmpc_target_deinit

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1219

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
bool IsSPMD
Flag to indicate if the kernel is an SPMD kernel or not.
bool RequiresFullRuntime
Indicate if a full device runtime is necessary.

llvm::OpenMPIRBuilder::InsertPointTy
createTargetInit(const llvm::OpenMPIRBuilder::
                     LocationDescription& Loc,
                 bool IsSPMD,
                 bool RequiresFullRuntime)

Description

Create a runtime call for kmpc_target_init

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1211

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The insert and source location description.
bool IsSPMD
Flag to indicate if the kernel is an SPMD kernel or not.
bool RequiresFullRuntime
Indicate if a full device runtime is necessary.

llvm::OpenMPIRBuilder::InsertPointTy createTask(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB,
    bool Tied = true,
    llvm::Value* Final = nullptr)

Description

Generator for `#omp task`

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:629

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the task construct was encountered.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.
bool Tied = true
True if the task is tied, false if the task is untied.
llvm::Value* Final = nullptr
i1 value which is `true` if the task is final, `false` if the task is not final.

llvm::OpenMPIRBuilder::InsertPointTy
createTaskgroup(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::OpenMPIRBuilder::BodyGenCallbackTy
        BodyGenCB)

Description

Generator for the taskgroup construct

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:638

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the taskgroup construct was encountered.
llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
llvm::OpenMPIRBuilder::BodyGenCallbackTy BodyGenCB
Callback that will generate the region code.

void createTaskwait(const llvm::OpenMPIRBuilder::
                        LocationDescription& Loc)

Description

Generator for '#omp taskwait'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:614

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the taskwait directive was encountered.

void createTaskyield(const llvm::OpenMPIRBuilder::
                         LocationDescription& Loc)

Description

Generator for '#omp taskyield'

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:619

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location where the taskyield directive was encountered.

std::pair<Value*, Value*> emitAtomicUpdate(
    llvm::OpenMPIRBuilder::InsertPointTy AllocaIP,
    llvm::Value* X,
    llvm::Type* XElemTy,
    llvm::Value* Expr,
    llvm::AtomicOrdering AO,
    AtomicRMWInst::BinOp RMWOp,
    llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy&
        UpdateOp,
    bool VolatileX,
    bool IsXBinopExpr)

Description

Emit atomic update for constructs: X = X BinOp Expr ,or X = Expr BinOp X For complex Operations: X = UpdateOp(X) => CmpExch X, old_X, UpdateOp(X) Only Scalar data types.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1382

Parameters

llvm::OpenMPIRBuilder::InsertPointTy AllocaIP
The insertion point to be used for alloca instructions.
llvm::Value* X
The target atomic pointer to be updated
llvm::Type* XElemTy
The element type of the atomic pointer.
llvm::Value* Expr
The value to update X with.
llvm::AtomicOrdering AO
Atomic ordering of the generated atomic instructions.
AtomicRMWInst::BinOp RMWOp
The binary operation used for update. If operation is not supported by atomicRMW, or belong to {FADD, FSUB, BAD_BINOP}. Then a `cmpExch` based atomic will be generated.
llvm::OpenMPIRBuilder::AtomicUpdateCallbackTy& UpdateOp
Code generator for complex expressions that cannot be expressed through atomicrmw instruction.
bool VolatileX
true if \a X volatile?
bool IsXBinopExpr
true if \a X is Left H.S. in Right H.S. part of the update expression, false otherwise. (e.g. true for X = X BinOp Expr)

Returns

A pair of the old value of X before the update, and the value used for the update.

llvm::OpenMPIRBuilder::InsertPointTy
emitBarrierImpl(const llvm::OpenMPIRBuilder::
                    LocationDescription& Loc,
                omp::Directive DK,
                bool ForceSimpleCall,
                bool CheckCancelFlag)

Description

Generate a barrier runtime call.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:859

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location at which the request originated and is fulfilled.
omp::Directive DK
The directive which caused the barrier
bool ForceSimpleCall
Flag to force a simple (=non-cancellation) barrier.
bool CheckCancelFlag
Flag to indicate a cancel barrier return value should be checked and acted upon.

Returns

The insertion point after the barrier.

void emitCancelationCheckImpl(
    llvm::Value* CancelFlag,
    omp::Directive CanceledDirective,
    llvm::OpenMPIRBuilder::FinalizeCallbackTy
        ExitCB = {})

Description

Generate control flow and cleanup for cancellation.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:829

Parameters

llvm::Value* CancelFlag
Flag indicating if the cancellation is performed.
omp::Directive CanceledDirective
The kind of directive that is cancled.
llvm::OpenMPIRBuilder::FinalizeCallbackTy ExitCB = {}
Extra code to be generated in the exit block.

llvm::OpenMPIRBuilder::InsertPointTy
emitCommonDirectiveEntry(omp::Directive OMPD,
                         llvm::Value* EntryCall,
                         llvm::BasicBlock* ExitBB,
                         bool Conditional = false)

Description

Common interface for generating entry calls for OMP Directives. if the directive has a region/body, It will set the insertion point to the body

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1261

Parameters

omp::Directive OMPD
Directive to generate entry blocks for
llvm::Value* EntryCall
Call to the entry OMP Runtime Function
llvm::BasicBlock* ExitBB
block where the region ends.
bool Conditional = false
indicate if the entry call result will be used to evaluate a conditional of whether a thread will execute body code or not.

Returns

The insertion position in exit block

llvm::OpenMPIRBuilder::InsertPointTy
emitCommonDirectiveExit(
    omp::Directive OMPD,
    llvm::OpenMPIRBuilder::InsertPointTy FinIP,
    llvm::Instruction* ExitCall,
    bool HasFinalize = true)

Description

Common interface to finalize the region

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1275

Parameters

omp::Directive OMPD
Directive to generate exiting code for
llvm::OpenMPIRBuilder::InsertPointTy FinIP
Insertion point for emitting Finalization code and exit call
llvm::Instruction* ExitCall
Call to the ending OMP Runtime Function
bool HasFinalize = true
indicate if the directive will require finalization and has a finalization callback in the stack that should be called.

Returns

The insertion position in exit block

void emitFlush(const llvm::OpenMPIRBuilder::
                   LocationDescription& Loc)

Description

Generate a flush runtime call.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:866

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location at which the request originated and is fulfilled.

void emitMapperCall(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Function* MapperFunc,
    llvm::Value* SrcLocInfo,
    llvm::Value* MaptypesArg,
    llvm::Value* MapnamesArg,
    struct MapperAllocas& MapperAllocas,
    int64_t DeviceID,
    unsigned int NumOperands)

Description

Create the call for the target mapper function.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:971

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The source location description.
llvm::Function* MapperFunc
Function to be called.
llvm::Value* SrcLocInfo
Source location information global.
llvm::Value* MaptypesArg
The argument types.
llvm::Value* MapnamesArg
The argument names.
struct MapperAllocas& MapperAllocas
The AllocaInst used for the call.
int64_t DeviceID
Device ID for the call.
unsigned int NumOperands
Number of operands in the call.

void emitOffloadingEntry(
    llvm::Constant* Addr,
    llvm::StringRef Name,
    uint64_t Size,
    int32_t Flags,
    llvm::StringRef SectionName =
        "omp_offloading_entries")

Description

Create an offloading section struct used to register this global at runtime. Type struct __tgt_offload_entry{ void *addr; // Pointer to the offload entry info. // (function or global) char *name; // Name of the function or global. size_t size; // Size of the entry info (0 if it a function). int32_t flags; int32_t reserved; };

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:820

Parameters

llvm::Constant* Addr
The pointer to the global being registered.
llvm::StringRef Name
The symbol name associated with the global.
uint64_t Size
The size in bytes of the global (0 for functions).
int32_t Flags
Flags associated with the entry.
llvm::StringRef SectionName = "omp_offloading_entries"
The section this entry will be placed at.

llvm::Value* emitRMWOpAsInstruction(
    llvm::Value* Src1,
    llvm::Value* Src2,
    AtomicRMWInst::BinOp RMWOp)

Description

Emit the binary op. described by \p RMWOp, using \p Src1 and \p Src2 .

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1390

Parameters

llvm::Value* Src1
llvm::Value* Src2
AtomicRMWInst::BinOp RMWOp

Returns

The instruction

llvm::OpenMPIRBuilder::InsertPointTy
emitTargetKernel(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    llvm::Value*& Return,
    llvm::Value* Ident,
    llvm::Value* DeviceID,
    llvm::Value* NumTeams,
    llvm::Value* NumThreads,
    llvm::Value* HostPtr,
    ArrayRef<llvm::Value*> KernelArgs,
    ArrayRef<llvm::Value*> NoWaitArgs = {})

Description

Generate a target region entry call.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:844

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location at which the request originated and is fulfilled.
llvm::Value*& Return
Return value of the created function returned by reference.
llvm::Value* Ident
llvm::Value* DeviceID
Identifier for the device via the 'device' clause.
llvm::Value* NumTeams
Numer of teams for the region via the 'num_teams' clause or 0 if unspecified and -1 if there is no 'teams' clause.
llvm::Value* NumThreads
Number of threads via the 'thread_limit' clause.
llvm::Value* HostPtr
Pointer to the host-side pointer of the target kernel.
ArrayRef<llvm::Value*> KernelArgs
Array of arguments to the kernel.
ArrayRef<llvm::Value*> NoWaitArgs = {}

void emitTaskwaitImpl(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc)

Description

Generate a taskwait runtime call.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:884

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location at which the request originated and is fulfilled.

void emitTaskyieldImpl(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc)

Description

Generate a taskyield runtime call.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:889

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
The location at which the request originated and is fulfilled.

void finalize(llvm::Function* Fn = nullptr)

Description

Finalize the underlying module, e.g., by outlining regions.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:90

Parameters

llvm::Function* Fn = nullptr
The function to be finalized. If not used, all functions are finalized.

llvm::OpenMPIRBuilder::InsertPointTy
getInsertionPoint()

Description

Return the insertion point used by the underlying IRBuilder.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:757

static std::string getNameWithSeparators(
    ArrayRef<llvm::StringRef> Parts,
    llvm::StringRef FirstSeparator,
    llvm::StringRef Separator)

Description

Get the platform-specific name separator.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1309

Parameters

ArrayRef<llvm::StringRef> Parts
different parts of the final name that needs separation
llvm::StringRef FirstSeparator
First separator used between the initial two parts of the name.
llvm::StringRef Separator
separator used between all of the rest consecutive parts of the name

llvm::Value* getOMPCriticalRegionLock(
    llvm::StringRef CriticalName)

Description

Returns corresponding lock object for the specified critical region name. If the lock object does not exist it is created, otherwise the reference to the existing copy is returned.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1327

Parameters

llvm::StringRef CriticalName
Name of the critical region.

llvm::Constant* getOrCreateDefaultSrcLocStr(
    uint32_t& SrcLocStrSize)

Description

Return the (LLVM-IR) string describing the default source location.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:776

Parameters

uint32_t& SrcLocStrSize

llvm::Constant* getOrCreateIdent(
    llvm::Constant* SrcLocStr,
    uint32_t SrcLocStrSize,
    omp::IdentFlag Flags =
        llvm::omp::IdentFlag(0),
    unsigned int Reserve2Flags = 0)

Description

Return an ident_t* encoding the source location \p SrcLocStr and \p Flags. TODO: Create a enum class for the Reserve2Flags

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:795

Parameters

llvm::Constant* SrcLocStr
uint32_t SrcLocStrSize
omp::IdentFlag Flags = llvm::omp::IdentFlag(0)
unsigned int Reserve2Flags = 0

llvm::Constant* getOrCreateOMPInternalVariable(
    llvm::Type* Ty,
    const llvm::Twine& Name,
    unsigned int AddressSpace = 0)

Description

Gets (if variable with the given name already exist) or creates internal global variable with the specified Name. The created variable has linkage CommonLinkage by default and is initialized by null value.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1319

Parameters

llvm::Type* Ty
Type of the global variable. If it is exist already the type must be the same.
const llvm::Twine& Name
Name of the variable.
unsigned int AddressSpace = 0

llvm::FunctionCallee getOrCreateRuntimeFunction(
    llvm::Module& M,
    omp::RuntimeFunction FnID)

Description

Return the function declaration for the runtime function with \p FnID.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:767

Parameters

llvm::Module& M
omp::RuntimeFunction FnID

llvm::Function* getOrCreateRuntimeFunctionPtr(
    omp::RuntimeFunction FnID)

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:770

Parameters

omp::RuntimeFunction FnID

llvm::Constant* getOrCreateSrcLocStr(
    llvm::StringRef LocStr,
    uint32_t& SrcLocStrSize)

Description

Return the (LLVM-IR) string describing the source location \p LocStr.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:773

Parameters

llvm::StringRef LocStr
uint32_t& SrcLocStrSize

llvm::Constant* getOrCreateSrcLocStr(
    llvm::StringRef FunctionName,
    llvm::StringRef FileName,
    unsigned int Line,
    unsigned int Column,
    uint32_t& SrcLocStrSize)

Description

Return the (LLVM-IR) string describing the source location identified by the arguments.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:780

Parameters

llvm::StringRef FunctionName
llvm::StringRef FileName
unsigned int Line
unsigned int Column
uint32_t& SrcLocStrSize

llvm::Constant* getOrCreateSrcLocStr(
    llvm::DebugLoc DL,
    uint32_t& SrcLocStrSize,
    llvm::Function* F = nullptr)

Description

Return the (LLVM-IR) string describing the DebugLoc \p DL. Use \p F as fallback if \p DL does not specify the function name.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:786

Parameters

llvm::DebugLoc DL
uint32_t& SrcLocStrSize
llvm::Function* F = nullptr

llvm::Constant* getOrCreateSrcLocStr(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc,
    uint32_t& SrcLocStrSize)

Description

Return the (LLVM-IR) string describing the source location \p Loc.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:790

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc
uint32_t& SrcLocStrSize

llvm::Value* getOrCreateThreadID(
    llvm::Value* Ident)

Description

Return the current thread ID.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:894

Parameters

llvm::Value* Ident
The ident (ident_t*) describing the query origin.

void initialize()

Description

Initialize the internal state, this will put structures types and potentially other helpers into the underlying module. Must be called before any other method and only once!

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:85

void initializeTypes(llvm::Module& M)

Description

Create all simple and struct types exposed by the runtime and remember the llvm::PointerTypes of them for easy access later.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:1247

Parameters

llvm::Module& M

bool isLastFinalizationInfoCancellable(
    omp::Directive DK)

Description

Return true if the last entry in the finalization stack is of kind \p DK and cancellable.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:875

Parameters

omp::Directive DK

void popFinalizationCB()

Description

Pop the last finalization callback from the finalization stack. NOTE: Temporary solution until Clang CG is gone.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:131

void pushFinalizationCB(
    const llvm::OpenMPIRBuilder::FinalizationInfo&
        FI)

Description

Push a finalization callback on the finalization stack. NOTE: Temporary solution until Clang CG is gone.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:124

Parameters

const llvm::OpenMPIRBuilder::FinalizationInfo& FI

std::vector<CanonicalLoopInfo*> tileLoops(
    llvm::DebugLoc DL,
    ArrayRef<llvm::CanonicalLoopInfo*> Loops,
    ArrayRef<llvm::Value*> TileSizes)

Description

Tile a loop nest. Tiles the loops of \p Loops by the tile sizes in \p TileSizes. Loops in\p / Loops must be perfectly nested, from outermost to innermost loop (i.e. Loops.front() is the outermost loop). The trip count llvm::Value of every loop and every tile sizes must be usable in the outermost loop's preheader. This implies that the loop nest is rectangular. Example: After tiling with Loops={i,j} and TileSizes={5,7}, the loop is changed to The returned vector are the loops {i1,j1,i2,j2}. The loops i1 and j1 are referred to the floor, and the loops i2 and j2 are the tiles. Tiling also handles non-constant trip counts, non-constant tile sizes and trip counts that are not multiples of the tile size. In the latter case the tile loop of the last floor-loop iteration will have fewer iterations than specified as its tile size.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:555

Parameters

llvm::DebugLoc DL
Debug location for instructions added by tiling, for instance the floor- and tile trip count computation.
ArrayRef<llvm::CanonicalLoopInfo*> Loops
Loops to tile. The CanonicalLoopInfo objects are invalidated by this method, i.e. should not used after tiling.
ArrayRef<llvm::Value*> TileSizes
For each loop in \p Loops, the tile size for that dimensions.

Returns

A list of generated loops. Contains twice as many loops as the input loop nest; the first half are the floor loops and the second half are the tile loops.

void unrollLoopFull(llvm::DebugLoc DL,
                    llvm::CanonicalLoopInfo* Loop)

Description

Fully unroll a loop. Instead of unrolling the loop immediately (and duplicating its body instructions), it is deferred to LLVM's LoopUnrollPass by adding loop metadata.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:566

Parameters

llvm::DebugLoc DL
Debug location for instructions added by unrolling.
llvm::CanonicalLoopInfo* Loop
The loop to unroll. The loop will be invalidated.

void unrollLoopHeuristic(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* Loop)

Description

Fully or partially unroll a loop. How the loop is unrolled is determined using LLVM's LoopUnrollPass.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:573

Parameters

llvm::DebugLoc DL
Debug location for instructions added by unrolling.
llvm::CanonicalLoopInfo* Loop
The loop to unroll. The loop will be invalidated.

void unrollLoopPartial(
    llvm::DebugLoc DL,
    llvm::CanonicalLoopInfo* Loop,
    int32_t Factor,
    llvm::CanonicalLoopInfo** UnrolledCLI)

Description

Partially unroll a loop. The CanonicalLoopInfo of the unrolled loop for use with chained loop-associated directive can be requested using \p UnrolledCLI. Not needing the CanonicalLoopInfo allows more efficient code generation by deferring the actual unrolling to the LoopUnrollPass using loop metadata. A loop-associated directive applied to the unrolled loop needs to know the new trip count which means that if using a heuristically determined unroll factor (\p Factor == 0), that factor must be computed immediately. We are using the same logic as the LoopUnrollPass to derived the unroll factor, but which assumes that some canonicalization has taken place (e.g. Mem2Reg, LICM, GVN, Inlining, etc.). That is, the heuristic will perform better when the unrolled loop's CanonicalLoopInfo is not needed.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:597

Parameters

llvm::DebugLoc DL
Debug location for instructions added by unrolling.
llvm::CanonicalLoopInfo* Loop
The loop to unroll. The loop will be invalidated.
int32_t Factor
The factor to unroll the loop by. A factor of 0 indicates that a heuristic should be used to determine the unroll-factor.
llvm::CanonicalLoopInfo** UnrolledCLI
If non-null, receives the CanonicalLoopInfo of the partially unrolled loop. Otherwise, uses loop metadata to defer unrolling to the LoopUnrollPass.

bool updateToLocation(
    const llvm::OpenMPIRBuilder::
        LocationDescription& Loc)

Description

Update the internal location to \p Loc.

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:760

Parameters

const llvm::OpenMPIRBuilder::LocationDescription& Loc

~OpenMPIRBuilder()

Declared at: llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h:80