LLVM: lib/Frontend/OpenMP/OMPIRBuilder.cpp File Reference (original) (raw)

This file implements the OpenMPIRBuilder class, which is used as a convenient way to create LLVM instructions for OpenMP directives. More...

Go to the source code of this file.

Macros
#define DEBUG_TYPE "openmp-ir-builder"
#define OMP_ATTRS_SET(VarName, AttrSet)
#define OMP_RTL_ATTRS(Enum, FnAttrSet, RetAttrSet, ArgAttrSets)
#define OMP_RTL(Enum, Str, IsVarArg, ReturnType, ...)
#define OMP_RTL(Enum, Str, ...)
#define OMP_CANCEL_KIND(Enum, Str, DirectiveEnum, Value)
#define OMP_CANCEL_KIND(Enum, Str, DirectiveEnum, Value)
#define OMP_TYPE(VarName, InitValue)
#define OMP_ARRAY_TYPE(VarName, ElemTy, ArraySize)
#define OMP_FUNCTION_TYPE(VarName, IsVarArg, ReturnType, ...)
#define OMP_STRUCT_TYPE(VarName, StructName, Packed, ...)
Functions
static bool isConflictIP (IRBuilder<>::InsertPoint IP1, IRBuilder<>::InsertPoint IP2)
Return whether IP1 and IP2 are ambiguous, i.e.
static bool isValidWorkshareLoopScheduleType (OMPScheduleType SchedType)
static void restoreIPandDebugLoc (llvm::IRBuilderBase &Builder, llvm::IRBuilderBase::InsertPoint IP)
This is wrapper over IRBuilderBase::restoreIP that also restores the current debug location to the last instruction in the specified basic block if the insert point points to the end of the block.
static const omp::GV & getGridValue (const Triple &T, Function *Kernel)
static OMPScheduleType getOpenMPBaseScheduleType (llvm::omp::ScheduleKind ClauseKind, bool HasChunks, bool HasSimdModifier, bool HasDistScheduleChunks)
Determine which scheduling algorithm to use, determined from schedule clause arguments.
static OMPScheduleType getOpenMPOrderingScheduleType (OMPScheduleType BaseScheduleType, bool HasOrderedClause)
Adds ordering modifier flags to schedule type.
static OMPScheduleType getOpenMPMonotonicityScheduleType (OMPScheduleType ScheduleType, bool HasSimdModifier, bool HasMonotonic, bool HasNonmonotonic, bool HasOrderedClause)
Adds monotonicity modifier flags to schedule type.
static OMPScheduleType computeOpenMPScheduleType (ScheduleKind ClauseKind, bool HasChunks, bool HasSimdModifier, bool HasMonotonicModifier, bool HasNonmonotonicModifier, bool HasOrderedClause, bool HasDistScheduleChunks)
Determine the schedule type using schedule and ordering clause arguments.
static void redirectTo (BasicBlock *Source, BasicBlock *Target, DebugLoc DL)
Make Source branch to Target.
Value * createFakeIntVal (IRBuilderBase &Builder, OpenMPIRBuilder::InsertPointTy OuterAllocaIP, llvm::SmallVectorImpl< Instruction * > &ToBeDeleted, OpenMPIRBuilder::InsertPointTy InnerAllocaIP, const Twine &Name="", bool AsPtr=true)
static void raiseUserConstantDataAllocasToEntryBlock (IRBuilderBase &Builder, Function *Function)
static void targetParallelCallback (OpenMPIRBuilder *OMPIRBuilder, Function &OutlinedFn, Function *OuterFn, BasicBlock *OuterAllocaBB, Value *Ident, Value *IfCondition, Value *NumThreads, Instruction *PrivTID, AllocaInst *PrivTIDAddr, Value *ThreadID, const SmallVector< Instruction *, 4 > &ToBeDeleted)
static void hostParallelCallback (OpenMPIRBuilder *OMPIRBuilder, Function &OutlinedFn, Function *OuterFn, Value *Ident, Value *IfCondition, Instruction *PrivTID, AllocaInst *PrivTIDAddr, const SmallVector< Instruction *, 4 > &ToBeDeleted)
static Value * emitTaskDependencies (OpenMPIRBuilder &OMPBuilder, const SmallVectorImpl< OpenMPIRBuilder::DependData > &Dependencies)
static OpenMPIRBuilder::InsertPointTy getInsertPointAfterInstr (Instruction *I)
static void checkReductionInfos (ArrayRef< OpenMPIRBuilder::ReductionInfo > ReductionInfos, bool IsGPU)
static Function * getFreshReductionFunc (Module &M)
static Error populateReductionFunction (Function *ReductionFunc, ArrayRef< OpenMPIRBuilder::ReductionInfo > ReductionInfos, IRBuilder<> &Builder, ArrayRef< bool > IsByRef, bool IsGPU)
static llvm::CallInst * emitNoUnwindRuntimeCall (IRBuilder<> &Builder, llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args, const llvm::Twine &Name)
static FunctionCallee getKmpcDistForStaticInitForType (Type *Ty, Module &M, OpenMPIRBuilder &OMPBuilder)
static FunctionCallee getKmpcForStaticInitForType (Type *Ty, Module &M, OpenMPIRBuilder &OMPBuilder)
static void addAccessGroupMetadata (BasicBlock *Block, MDNode *AccessGroup, LoopInfo &LI)
Attach llvm.access.group metadata to the memref instructions of Block.
static void addLoopMetadata (CanonicalLoopInfo *Loop, ArrayRef< Metadata * > Properties)
Attach loop metadata Properties to the loop described by Loop.
static void applyParallelAccessesMetadata (CanonicalLoopInfo *CLI, LLVMContext &Ctx, Loop *Loop, LoopInfo &LoopInfo, SmallVector< Metadata * > &LoopMDList)
static FunctionCallee getKmpcForStaticLoopForType (Type *Ty, OpenMPIRBuilder *OMPBuilder, WorksharingLoopType LoopType)
static void createTargetLoopWorkshareCall (OpenMPIRBuilder *OMPBuilder, WorksharingLoopType LoopType, BasicBlock *InsertBlock, Value *Ident, Value *LoopBodyArg, Value *TripCount, Function &LoopBodyFn, bool NoLoop)
static void workshareLoopTargetCallback (OpenMPIRBuilder *OMPIRBuilder, CanonicalLoopInfo *CLI, Value *Ident, Function &OutlinedFn, const SmallVector< Instruction *, 4 > &ToBeDeleted, WorksharingLoopType LoopType, bool NoLoop)
static FunctionCallee getKmpcForDynamicInitForType (Type *Ty, Module &M, OpenMPIRBuilder &OMPBuilder)
Returns an LLVM function to call for initializing loop bounds using OpenMP dynamic scheduling depending on type.
static FunctionCallee getKmpcForDynamicNextForType (Type *Ty, Module &M, OpenMPIRBuilder &OMPBuilder)
Returns an LLVM function to call for updating the next loop using OpenMP dynamic scheduling depending on type.
static FunctionCallee getKmpcForDynamicFiniForType (Type *Ty, Module &M, OpenMPIRBuilder &OMPBuilder)
Returns an LLVM function to call for finalizing the dynamic loop using depending on type.
static void redirectAllPredecessorsTo (BasicBlock *OldTarget, BasicBlock *NewTarget, DebugLoc DL)
Redirect all edges that branch to OldTarget to NewTarget.
static void removeUnusedBlocksFromParent (ArrayRef< BasicBlock * > BBs)
Determine which blocks in BBs are reachable from outside and remove the ones that are not reachable from the function.
static void addBasicBlockMetadata (BasicBlock *BB, ArrayRef< Metadata * > Properties)
Attach metadata Properties to the basic block described by BB.
static std::unique_ptr< TargetMachine > createTargetMachine (Function *F, CodeGenOptLevel OptLevel)
Create the TargetMachine object to query the backend for optimization preferences.
static int32_t computeHeuristicUnrollFactor (CanonicalLoopInfo *CLI)
Heuristically determine the best-performant unroll factor for CLI.
static void updateNVPTXAttr (Function &Kernel, StringRef Name, int32_t Value, bool Min)
static void FixupDebugInfoForOutlinedFunction (OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, Function *Func, DenseMap< Value *, std::tuple< Value *, unsigned > > &ValueReplacementMap)
static Value * removeASCastIfPresent (Value *V)
static Expected< Function * > createOutlinedFunction (OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, const OpenMPIRBuilder::TargetKernelDefaultAttrs &DefaultAttrs, StringRef FuncName, SmallVectorImpl< Value * > &Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy &CBFunc, OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy &ArgAccessorFuncCB)
static LoadInst * loadSharedDataFromTaskDescriptor (OpenMPIRBuilder &OMPIRBuilder, IRBuilderBase &Builder, Value *TaskWithPrivates, Type *TaskWithPrivatesTy)
Given a task descriptor, TaskWithPrivates, return the pointer to the block of pointers containing shared data between the parent task and the created task.
static Function * emitTargetTaskProxyFunction (OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, CallInst *StaleCI, StructType *PrivatesTy, StructType *TaskWithPrivatesTy, const size_t NumOffloadingArrays, const int SharedArgsOperandNo)
Create an entry point for a target task with the following.
static Type * getOffloadingArrayType (Value *V)
static StructType * createTaskWithPrivatesTy (OpenMPIRBuilder &OMPIRBuilder, ArrayRef< Value * > OffloadingArraysToPrivatize)
static Error emitTargetOutlinedFunction (OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, bool IsOffloadEntry, TargetRegionEntryInfo &EntryInfo, const OpenMPIRBuilder::TargetKernelDefaultAttrs &DefaultAttrs, Function *&OutlinedFn, Constant *&OutlinedFnID, SmallVectorImpl< Value * > &Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy &CBFunc, OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy &ArgAccessorFuncCB)
static void emitTargetCall (OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, OpenMPIRBuilder::InsertPointTy AllocaIP, OpenMPIRBuilder::TargetDataInfo &Info, const OpenMPIRBuilder::TargetKernelDefaultAttrs &DefaultAttrs, const OpenMPIRBuilder::TargetKernelRuntimeAttrs &RuntimeAttrs, Value *IfCond, Function *OutlinedFn, Constant *OutlinedFnID, SmallVectorImpl< Value * > &Args, OpenMPIRBuilder::GenMapInfoCallbackTy GenMapInfoCB, OpenMPIRBuilder::CustomMapperCallbackTy CustomMapperCB, const SmallVector< llvm::OpenMPIRBuilder::DependData > &Dependencies, bool HasNoWait, Value *DynCGroupMem, OMPDynGroupprivateFallbackType DynCGroupMemFallback)
Variables
static cl::opt< bool > OptimisticAttributes ("openmp-ir-builder-optimistic-attributes", cl::Hidden, cl::desc("Use optimistic attributes describing " "'as-if' properties of runtime calls."), cl::init(false))
static cl::opt< double > UnrollThresholdFactor ("openmp-ir-builder-unroll-threshold-factor", cl::Hidden, cl::desc("Factor for the unroll threshold to account for code " "simplifications still taking place"), cl::init(1.5))

This file implements the OpenMPIRBuilder class, which is used as a convenient way to create LLVM instructions for OpenMP directives.

Definition in file OMPIRBuilder.cpp.

DEBUG_TYPE

#define DEBUG_TYPE "openmp-ir-builder"

OMP_ARRAY_TYPE

#define OMP_ARRAY_TYPE ( VarName,
ElemTy,
ArraySize )

Value:

VarName##Ty = ArrayType::get(ElemTy, ArraySize); \

VarName##PtrTy = PointerType::get(Ctx, DefaultTargetAS);

OMP_ATTRS_SET

#define OMP_ATTRS_SET ( VarName,
AttrSet )

Value:

This class holds the attributes for a particular argument, parameter, function, or return value.

OMP_CANCEL_KIND [1/2]

#define OMP_CANCEL_KIND ( Enum,
Str,
DirectiveEnum,
Value )

Value:

case DirectiveEnum: \

CancelKind = Builder.getInt32(Value); \

break;

LLVM Value Representation.

OMP_CANCEL_KIND [2/2]

#define OMP_CANCEL_KIND ( Enum,
Str,
DirectiveEnum,
Value )

Value:

case DirectiveEnum: \

CancelKind = Builder.getInt32(Value); \

break;

OMP_FUNCTION_TYPE

#define OMP_FUNCTION_TYPE ( VarName,
IsVarArg,
ReturnType,
... )

Value:

VarName = FunctionType::get(ReturnType, {__VA_ARGS__}, IsVarArg); \

VarName##Ptr = PointerType::get(Ctx, ProgramAS);

OMP_RTL [1/2]

#define OMP_RTL ( Enum,
Str,
IsVarArg,
ReturnType,
... )

Value:

case Enum: \

FnTy = FunctionType::get(ReturnType, ArrayRef<Type *>{__VA_ARGS__}, \

IsVarArg); \

Fn = M.getFunction(Str); \

break;

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

OMP_RTL [2/2]

#define OMP_RTL ( Enum,
Str,
... )

Value:

case Enum: \

break;

static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)

@ ExternalLinkage

Externally visible function.

OMP_RTL_ATTRS

#define OMP_RTL_ATTRS ( Enum,
FnAttrSet,
RetAttrSet,
ArgAttrSets )

Value:

case Enum: \

FnAttrs = FnAttrs.addAttributes(Ctx, FnAttrSet); \

addAttrSet(RetAttrs, RetAttrSet, false); \

for (size_t ArgNo = 0; ArgNo < ArgAttrSets.size(); ++ArgNo) \

addAttrSet(ArgAttrs[ArgNo], ArgAttrSets[ArgNo]); \

Fn.setAttributes(AttributeList::get(Ctx, FnAttrs, RetAttrs, ArgAttrs)); \

break;

OMP_STRUCT_TYPE

#define OMP_STRUCT_TYPE ( VarName,
StructName,
Packed,
... )

Value:

if (!T) \

VarName = T; \

VarName##Ptr = PointerType::get(Ctx, DefaultTargetAS);

const std::string FatArchTraits< MachO::fat_arch >::StructName

static LLVM_ABI StructType * getTypeByName(LLVMContext &C, StringRef Name)

Return the type with the specified name, or null if there is none by that name.

static LLVM_ABI StructType * create(LLVMContext &Context, StringRef Name)

This creates an identified struct.

OMP_TYPE

#define OMP_TYPE ( VarName,
InitValue )

addAccessGroupMetadata()

addBasicBlockMetadata()

Attach metadata Properties to the basic block described by BB.

If the basic block already has metadata, the basic block properties are appended.

Definition at line 6101 of file OMPIRBuilder.cpp.

References llvm::append_range(), llvm::drop_begin(), llvm::ArrayRef< T >::empty(), llvm::BasicBlock::getContext(), llvm::MDNode::getDistinct(), llvm::Instruction::getMetadata(), llvm::BasicBlock::getTerminator(), llvm::MDNode::operands(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::MDNode::replaceOperandWith(), and llvm::Instruction::setMetadata().

Referenced by addLoopMetadata().

addLoopMetadata()

void addLoopMetadata ( CanonicalLoopInfo * Loop, ArrayRef< Metadata * > Properties ) static

applyParallelAccessesMetadata()

checkReductionInfos()

void checkReductionInfos ( ArrayRef< OpenMPIRBuilder::ReductionInfo > ReductionInfos, bool IsGPU ) static

computeHeuristicUnrollFactor()

int32_t computeHeuristicUnrollFactor ( CanonicalLoopInfo * CLI) static

Heuristically determine the best-performant unroll factor for CLI.

This depends on the target processor. We are re-using the same heuristics as the LoopUnrollPass.

Definition at line 6397 of file OMPIRBuilder.cpp.

References llvm::Aggressive, assert(), llvm::TargetTransformInfo::UnrollingPreferences::BEInsns, llvm::UnrollCostEstimator::canUnroll(), llvm::CodeMetrics::collectEphemeralValues(), llvm::computeUnrollCount(), llvm::TargetTransformInfo::UnrollingPreferences::Count, createTargetMachine(), llvm::dbgs(), llvm::dyn_cast(), F, FAM, llvm::TargetTransformInfo::UnrollingPreferences::Force, llvm::gatherPeelingPreferences(), llvm::gatherUnrollingPreferences(), llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::UnrollCostEstimator::getRolledLoopSize(), I, llvm::SmallPtrSetImpl< PtrType >::insert(), LLVM_DEBUG, llvm::TargetTransformInfo::UnrollingPreferences::OptSizeThreshold, llvm::TargetTransformInfo::UnrollingPreferences::PartialOptSizeThreshold, llvm::TargetTransformInfo::UnrollingPreferences::PartialThreshold, llvm::AssumptionAnalysis::run(), llvm::DominatorTreeAnalysis::run(), llvm::LoopAnalysis::run(), llvm::ScalarEvolutionAnalysis::run(), llvm::TargetIRAnalysis::run(), llvm::Value::stripPointerCasts(), llvm::TargetTransformInfo::UnrollingPreferences::Threshold, and UnrollThresholdFactor.

computeOpenMPScheduleType()

OMPScheduleType computeOpenMPScheduleType ( ScheduleKind ClauseKind, bool HasChunks, bool HasSimdModifier, bool HasMonotonicModifier, bool HasNonmonotonicModifier, bool HasOrderedClause, bool HasDistScheduleChunks ) static

createFakeIntVal()

createOutlinedFunction()

Expected< Function * > createOutlinedFunction ( OpenMPIRBuilder & OMPBuilder, IRBuilderBase & Builder, const OpenMPIRBuilder::TargetKernelDefaultAttrs & DefaultAttrs, StringRef FuncName, SmallVectorImpl< Value * > & Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy & CBFunc, OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy & ArgAccessorFuncCB ) static

Definition at line 7760 of file OMPIRBuilder.cpp.

References llvm::BasicBlock::begin(), llvm::convertUsersOfConstantsToInstructions(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::dyn_cast(), FixupDebugInfoForOutlinedFunction(), llvm::FunctionType::get(), llvm::Argument::getArgNo(), llvm::BasicBlock::getFirstNonPHIIt(), llvm::BasicBlock::getFirstNonPHIOrDbg(), llvm::Function::getFnAttribute(), llvm::Type::getInt64Ty(), llvm::BasicBlock::getModule(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::GlobalValue::InternalLinkage, llvm::isa(), llvm::Type::isPointerTy(), llvm::make_early_inc_range(), llvm::make_range(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), removeASCastIfPresent(), Users, and llvm::zip().

Referenced by emitTargetOutlinedFunction().

createTargetLoopWorkshareCall()

createTargetMachine()

Create the TargetMachine object to query the backend for optimization preferences.

Ideally, this would be passed from the front-end to the OpenMPBuilder, but e.g. Clang does not pass it to its CodeGen layer and creates it only when needed for the LLVM pass pipline. We use some default options to avoid having to pass too many settings from the frontend that probably do not matter.

Currently, TargetMachine is only used sometimes by the unrollLoopPartial method. If we are going to use TargetMachine for more purposes, especially those that are sensitive to TargetOptions, RelocModel and CodeModel, it might become be worth requiring front-ends to pass on their TargetMachine, or at least cache it between methods. Note that while fontends such as Clang have just a single main TargetMachine per translation unit, "target-cpu" and "target-features" that determine the TargetMachine are per-function and can be overrided using attribute((target("OPTIONS"))).

Definition at line 6376 of file OMPIRBuilder.cpp.

References llvm::Target::createTargetMachine(), F, llvm::TargetRegistry::lookupTarget(), and Options.

Referenced by llvm::lto::backend(), computeHeuristicUnrollFactor(), LLVMCreateTargetMachineWithOptions(), splitCodeGen(), and llvm::lto::thinBackend().

createTaskWithPrivatesTy()

StructType * createTaskWithPrivatesTy ( OpenMPIRBuilder & OMPIRBuilder, ArrayRef< Value * > OffloadingArraysToPrivatize ) static

emitNoUnwindRuntimeCall()

emitTargetCall()

void emitTargetCall ( OpenMPIRBuilder & OMPBuilder, IRBuilderBase & Builder, OpenMPIRBuilder::InsertPointTy AllocaIP, OpenMPIRBuilder::TargetDataInfo & Info, const OpenMPIRBuilder::TargetKernelDefaultAttrs & DefaultAttrs, const OpenMPIRBuilder::TargetKernelRuntimeAttrs & RuntimeAttrs, Value * IfCond, Function * OutlinedFn, Constant * OutlinedFnID, SmallVectorImpl< Value * > & Args, OpenMPIRBuilder::GenMapInfoCallbackTy GenMapInfoCB, OpenMPIRBuilder::CustomMapperCallbackTy CustomMapperCB, const SmallVector< llvm::OpenMPIRBuilder::DependData > & Dependencies, bool HasNoWait, Value * DynCGroupMem, OMPDynGroupprivateFallbackType DynCGroupMemFallback ) static

emitTargetOutlinedFunction()

Error emitTargetOutlinedFunction ( OpenMPIRBuilder & OMPBuilder, IRBuilderBase & Builder, bool IsOffloadEntry, TargetRegionEntryInfo & EntryInfo, const OpenMPIRBuilder::TargetKernelDefaultAttrs & DefaultAttrs, Function *& OutlinedFn, Constant *& OutlinedFnID, SmallVectorImpl< Value * > & Inputs, OpenMPIRBuilder::TargetBodyGenCallbackTy & CBFunc, OpenMPIRBuilder::TargetGenArgAccessorsCallbackTy & ArgAccessorFuncCB ) static

emitTargetTaskProxyFunction()

Create an entry point for a target task with the following.

It'll have the following signature void .omp_target_task_proxy_func(i32 thread.id, ptr task) This function is called from emitTargetTask once the code to launch the target kernel has been outlined already. NumOffloadingArrays is the number of offloading arrays that we need to copy into the task structure so that the deferred target task can access this data even after the stack frame of the generating task has been rolled back. Offloading arrays contain base pointers, pointers, sizes etc of the data that the target kernel will access. These in effect are the non-empty arrays of pointers held by OpenMPIRBuilder::TargetDataRTArgs.

Definition at line 7980 of file OMPIRBuilder.cpp.

References llvm::CallBase::arg_size(), assert(), llvm::cast(), llvm::BasicBlock::Create(), llvm::Function::Create(), llvm::dyn_cast(), llvm::FunctionType::get(), llvm::AllocaInst::getAlign(), llvm::AllocaInst::getAllocatedType(), llvm::CallBase::getArgOperand(), llvm::CallBase::getCalledFunction(), llvm::Type::getInt32Ty(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::Value::getPointerAlignment(), llvm::GlobalValue::InternalLinkage, loadSharedDataFromTaskDescriptor(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorImpl< T >::reserve(), and llvm::Value::setName().

emitTaskDependencies()

Value * emitTaskDependencies ( OpenMPIRBuilder & OMPBuilder, const SmallVectorImpl< OpenMPIRBuilder::DependData > & Dependencies ) static

FixupDebugInfoForOutlinedFunction()

Definition at line 7692 of file OMPIRBuilder.cpp.

References assert(), llvm::filterDbgVars(), llvm::MDNode::get(), llvm::DIVariable::getAlignInBits(), llvm::DILocalVariable::getAnnotations(), llvm::DILocalVariable::getArg(), llvm::DIScope::getFile(), llvm::DIVariable::getFile(), llvm::DILocalVariable::getFlags(), llvm::DIVariable::getLine(), llvm::DIVariable::getName(), llvm::DILocalVariable::getScope(), llvm::DIVariable::getType(), I, instructions, and llvm::isa().

Referenced by createOutlinedFunction().

getFreshReductionFunc()

getGridValue()

getInsertPointAfterInstr()

OpenMPIRBuilder::InsertPointTy getInsertPointAfterInstr ( Instruction * I) static

getKmpcDistForStaticInitForType()

getKmpcForDynamicFiniForType()

Returns an LLVM function to call for finalizing the dynamic loop using depending on type.

Only i32 and i64 are supported by the runtime. Always interpret integers as unsigned similarly to CanonicalLoopInfo.

Definition at line 5603 of file OMPIRBuilder.cpp.

References llvm_unreachable.

getKmpcForDynamicInitForType()

Returns an LLVM function to call for initializing loop bounds using OpenMP dynamic scheduling depending on type.

Only i32 and i64 are supported by the runtime. Always interpret integers as unsigned similarly to CanonicalLoopInfo.

Definition at line 5572 of file OMPIRBuilder.cpp.

References llvm_unreachable.

getKmpcForDynamicNextForType()

Returns an LLVM function to call for updating the next loop using OpenMP dynamic scheduling depending on type.

Only i32 and i64 are supported by the runtime. Always interpret integers as unsigned similarly to CanonicalLoopInfo.

Definition at line 5588 of file OMPIRBuilder.cpp.

References llvm_unreachable.

getKmpcForStaticInitForType()

getKmpcForStaticLoopForType()

getOffloadingArrayType()

Type * getOffloadingArrayType ( Value * V) static

getOpenMPBaseScheduleType()

OMPScheduleType getOpenMPBaseScheduleType ( llvm::omp::ScheduleKind ClauseKind, bool HasChunks, bool HasSimdModifier, bool HasDistScheduleChunks ) static

getOpenMPMonotonicityScheduleType()

getOpenMPOrderingScheduleType()

hostParallelCallback()

Definition at line 1462 of file OMPIRBuilder.cpp.

References llvm::Function::addFnAttr(), llvm::Function::addParamAttr(), llvm::SmallVectorImpl< T >::append(), llvm::CallBase::arg_begin(), llvm::Function::arg_begin(), llvm::CallBase::arg_end(), llvm::Function::arg_size(), assert(), llvm::cast(), Cond, llvm::MDBuilder::createCallbackEncoding(), llvm::dbgs(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), F, llvm::MDNode::get(), llvm::FunctionCallee::getCallee(), llvm::Constant::getNullValue(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, LLVM_DEBUG, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Value::user_back().

isConflictIP()

Return whether IP1 and IP2 are ambiguous, i.e.

that inserting instructions at position IP1 may change the meaning of IP2 or vice-versa. This is because an InsertPoint stores the instruction before something is inserted. For instance, if both point to the same instruction, two IRBuilders alternating creating instruction will cause the instructions to be interleaved.

Definition at line 89 of file OMPIRBuilder.cpp.

isValidWorkshareLoopScheduleType()

loadSharedDataFromTaskDescriptor()

LoadInst * loadSharedDataFromTaskDescriptor ( OpenMPIRBuilder & OMPIRBuilder, IRBuilderBase & Builder, Value * TaskWithPrivates, Type * TaskWithPrivatesTy ) static

populateReductionFunction()

Definition at line 4031 of file OMPIRBuilder.cpp.

References llvm::BasicBlock::Create(), llvm::enumerate(), llvm::ArrayType::get(), llvm::Function::getArg(), llvm::Module::getContext(), llvm::Value::getName(), llvm::GlobalValue::getParent(), llvm::Value::getType(), LHS, RHS, llvm::ArrayRef< T >::size(), and llvm::Error::success().

raiseUserConstantDataAllocasToEntryBlock()

redirectAllPredecessorsTo()

redirectTo()

removeASCastIfPresent()

removeUnusedBlocksFromParent()

restoreIPandDebugLoc()

targetParallelCallback()

void targetParallelCallback ( OpenMPIRBuilder * OMPIRBuilder, Function & OutlinedFn, Function * OuterFn, BasicBlock * OuterAllocaBB, Value * Ident, Value * IfCondition, Value * NumThreads, Instruction * PrivTID, AllocaInst * PrivTIDAddr, Value * ThreadID, const SmallVector< Instruction *, 4 > & ToBeDeleted ) static

Definition at line 1373 of file OMPIRBuilder.cpp.

References llvm::Function::addFnAttr(), llvm::Function::addParamAttr(), llvm::CallBase::arg_begin(), llvm::Function::arg_begin(), llvm::Function::arg_size(), assert(), llvm::cast(), Cond, llvm::dbgs(), llvm::Instruction::eraseFromParent(), llvm::ArrayType::get(), llvm::AllocaInst::getAddressSpace(), llvm::BasicBlock::getFirstInsertionPt(), llvm::Constant::getNullValue(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, LLVM_DEBUG, and llvm::Value::user_back().

updateNVPTXAttr()

workshareLoopTargetCallback()

Definition at line 5349 of file OMPIRBuilder.cpp.

References llvm::CallBase::arg_size(), assert(), createTargetLoopWorkshareCall(), llvm::DeleteDeadBlocks(), llvm::dyn_cast(), llvm::BasicBlock::end(), llvm::Instruction::eraseFromParent(), llvm::CallBase::getArgOperand(), llvm::Instruction::getDebugLoc(), llvm::Constant::getNullValue(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getTerminator(), llvm::Value::getUniqueUndroppableUser(), and llvm::BasicBlock::splice().

OptimisticAttributes

cl::opt< bool > OptimisticAttributes("openmp-ir-builder-optimistic-attributes", cl::Hidden, cl::desc("Use optimistic attributes describing " "'as-if' properties of runtime calls."), cl::init(false)) ( "openmp-ir-builder-optimistic-attributes" , cl::Hidden , cl::desc("Use optimistic attributes describing " "'as-if' properties of runtime calls.") , cl::init(false) ) static

UnrollThresholdFactor

cl::opt< double > UnrollThresholdFactor("openmp-ir-builder-unroll-threshold-factor", cl::Hidden, cl::desc("Factor for the unroll threshold to account for code " "simplifications still taking place"), cl::init(1.5)) ( "openmp-ir-builder-unroll-threshold-factor" , cl::Hidden , cl::desc("Factor for the unroll threshold to account for code " "simplifications still taking place") , cl::init(1.5) ) static