|
LLVM
10.0.0
|
An interface to create LLVM-IR for OpenMP directives. More...
#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
Classes | |
| struct | FinalizationInfo |
| struct | LocationDescription |
| Description of a LLVM-IR insertion point (IP) and a debug/source location (filename, line, column, ...). More... | |
Public Types | |
| using | InsertPointTy = IRBuilder<>::InsertPoint |
| Type used throughout for insertion points. More... | |
| using | FinalizeCallbackTy = std::function< void(InsertPointTy CodeGenIP)> |
| Callback type for variable finalization (think destructors). More... | |
| using | BodyGenCallbackTy = function_ref< void(InsertPointTy AllocaIP, InsertPointTy CodeGenIP, BasicBlock &ContinuationBB)> |
| Callback type for body (=inner region) code generation. More... | |
| using | PrivatizeCallbackTy = function_ref< InsertPointTy(InsertPointTy AllocaIP, InsertPointTy CodeGenIP, Value &Val, Value *&ReplVal)> |
| Callback type for variable privatization (think copy & default constructor). More... | |
Public Member Functions | |
| OpenMPIRBuilder (Module &M) | |
Create a new OpenMPIRBuilder operating on the given module M. More... | |
| void | initialize () |
| Initialize the internal state, this will put structures types and potentially other helpers into the underlying module. More... | |
| void | addAttributes (omp::RuntimeFunction FnID, Function &Fn) |
Add attributes known for FnID to Fn. More... | |
| void | pushFinalizationCB (const FinalizationInfo &FI) |
| Push a finalization callback on the finalization stack. More... | |
| void | popFinalizationCB () |
| Pop the last finalization callback from the finalization stack. More... | |
| InsertPointTy | CreateBarrier (const LocationDescription &Loc, omp::Directive DK, bool ForceSimpleCall=false, bool CheckCancelFlag=true) |
| Emitter methods for OpenMP directives. More... | |
| InsertPointTy | CreateCancel (const LocationDescription &Loc, Value *IfCondition, omp::Directive CanceledDirective) |
| Generator for '#omp cancel'. More... | |
| IRBuilder ::InsertPoint | CreateParallel (const LocationDescription &Loc, BodyGenCallbackTy BodyGenCB, PrivatizeCallbackTy PrivCB, FinalizeCallbackTy FiniCB, Value *IfCondition, Value *NumThreads, omp::ProcBindKind ProcBind, bool IsCancellable) |
| Generator for '#omp parallel'. More... | |
An interface to create LLVM-IR for OpenMP directives.
Each OpenMP directive has a corresponding public generator method.
Definition at line 26 of file OMPIRBuilder.h.
| using llvm::OpenMPIRBuilder::BodyGenCallbackTy = function_ref<void(InsertPointTy AllocaIP, InsertPointTy CodeGenIP, BasicBlock &ContinuationBB)> |
Callback type for body (=inner region) code generation.
The callback takes code locations as arguments, each describing a location at which code might need to be generated or a location that is the target of control transfer.
| AllocaIP | is the insertion point at which new alloca instructions should be placed. |
| CodeGenIP | is the insertion point at which the body code should be placed. |
| ContinuationBB | is the basic block target to leave the body. |
Note that all blocks pointed to by the arguments have terminators.
Definition at line 93 of file OMPIRBuilder.h.
| using llvm::OpenMPIRBuilder::FinalizeCallbackTy = std::function<void(InsertPointTy CodeGenIP)> |
Callback type for variable finalization (think destructors).
| CodeGenIP | is the insertion point at which the finalization code should be placed. |
A finalize callback knows about all objects that need finalization, e.g. destruction, when the scope of the currently generated construct is left at the time, and location, the callback is invoked.
Definition at line 51 of file OMPIRBuilder.h.
| using llvm::OpenMPIRBuilder::InsertPointTy = IRBuilder<>::InsertPoint |
Type used throughout for insertion points.
Definition at line 41 of file OMPIRBuilder.h.
| using llvm::OpenMPIRBuilder::PrivatizeCallbackTy = function_ref<InsertPointTy( InsertPointTy AllocaIP, InsertPointTy CodeGenIP, Value &Val, Value *&ReplVal)> |
Callback type for variable privatization (think copy & default constructor).
| AllocaIP | is the insertion point at which new alloca instructions should be placed. |
| CodeGenIP | is the insertion point at which the privatization code should be placed. |
| Val | The value beeing copied/created. |
| ReplVal | The replacement value, thus a copy or new created version of Val. |
ReplVal the replacement of Val. Definition at line 110 of file OMPIRBuilder.h.
|
inline |
Create a new OpenMPIRBuilder operating on the given module M.
This will not have an effect on M (see initialize).
Definition at line 30 of file OMPIRBuilder.h.
References addAttributes(), and initialize().
| void OpenMPIRBuilder::addAttributes | ( | omp::RuntimeFunction | FnID, |
| Function & | Fn | ||
| ) |
Add attributes known for FnID to Fn.
Definition at line 42 of file OMPIRBuilder.cpp.
References assert(), and llvm::Function::getContext().
Referenced by OpenMPIRBuilder().
| OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::CreateBarrier | ( | const LocationDescription & | Loc, |
| omp::Directive | DK, | ||
| bool | ForceSimpleCall = false, |
||
| bool | CheckCancelFlag = true |
||
| ) |
Emitter methods for OpenMP directives.
{ Generator for '#omp barrier'
| Loc | The location where the barrier directive was encountered. |
| DK | The kind of directive that caused the barrier. |
| ForceSimpleCall | Flag to force a simple (=non-cancellation) barrier. |
| CheckCancelFlag | Flag to indicate a cancel barrier return value should be checked and acted upon. |
Definition at line 173 of file OMPIRBuilder.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Args, and llvm::OpenMPIRBuilder::LocationDescription::IP.
| OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::CreateCancel | ( | const LocationDescription & | Loc, |
| Value * | IfCondition, | ||
| omp::Directive | CanceledDirective | ||
| ) |
Generator for '#omp cancel'.
| Loc | The location where the directive was encountered. |
| IfCondition | The evaluated 'if' clause expression, if any. |
| CanceledDirective | The kind of directive that is cancled. |
Definition at line 227 of file OMPIRBuilder.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::BasicBlock::begin(), llvm::BasicBlock::Create(), llvm::BasicBlock::end(), llvm::Instruction::eraseFromParent(), llvm::BasicBlock::getContext(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::BasicBlock::getTerminator(), llvm::OpenMPIRBuilder::LocationDescription::IP, llvm_unreachable, llvm::SplitBlock(), and llvm::SplitBlockAndInsertIfThenElse().
| IRBuilder::InsertPoint OpenMPIRBuilder::CreateParallel | ( | const LocationDescription & | Loc, |
| BodyGenCallbackTy | BodyGenCB, | ||
| PrivatizeCallbackTy | PrivCB, | ||
| FinalizeCallbackTy | FiniCB, | ||
| Value * | IfCondition, | ||
| Value * | NumThreads, | ||
| omp::ProcBindKind | ProcBind, | ||
| bool | IsCancellable | ||
| ) |
Generator for '#omp parallel'.
| Loc | The insert and source location description. |
| BodyGenCB | Callback that will generate the region code. |
| PrivCB | Callback to copy a given variable (think copy constructor). |
| FiniCB | Callback to finalize variable copies. |
| IfCondition | The evaluated 'if' clause expression, if any. |
| NumThreads | The evaluated 'num_threads' clause expression, if any. |
| ProcBind | The value of the 'proc_bind' clause (see ProcBindKind). |
| IsCancellable | Flag to indicate a cancellable parallel region. |
Definition at line 304 of file OMPIRBuilder.cpp.
References llvm::Function::addParamAttr(), llvm::SmallVectorImpl< T >::append(), llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), llvm::sys::path::begin(), llvm::BasicBlock::begin(), llvm::MDBuilder::createCallbackEncoding(), llvm::dbgs(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::sys::path::end(), llvm::BasicBlock::end(), llvm::Instruction::eraseFromParent(), llvm::BasicBlock::eraseFromParent(), llvm::CodeExtractor::extractCodeRegion(), F(), llvm::CodeExtractor::findAllocas(), llvm::CodeExtractor::findInputsOutputs(), llvm::ConstantInt::get(), llvm::MDNode::get(), llvm::CallBase::getCalledFunction(), llvm::FunctionCallee::getCallee(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHI(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Constant::getNullValue(), llvm::Instruction::getNumSuccessors(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Instruction::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::BasicBlock::getUniquePredecessor(), llvm::BasicBlock::getUniqueSuccessor(), I, llvm::SmallVectorImpl< T >::insert(), llvm::OpenMPIRBuilder::LocationDescription::IP, LLVM_DEBUG, llvm::BasicBlock::moveBefore(), llvm::NoAlias, llvm::SmallVectorImpl< T >::pop_back_val(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::Instruction::removeFromParent(), llvm::Value::setName(), llvm::BasicBlock::size(), llvm::BasicBlock::splitBasicBlock(), llvm::SplitBlockAndInsertIfThenElse(), and llvm::successors().
| void OpenMPIRBuilder::initialize | ( | ) |
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!
Definition at line 94 of file OMPIRBuilder.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::StringRef::data(), llvm::OpenMPIRBuilder::LocationDescription::DL, llvm::StringRef::empty(), llvm::DebugLoc::get(), llvm::ConstantInt::get(), llvm::ConstantStruct::get(), llvm::Constant::getNullValue(), llvm::ConstantExpr::getPointerCast(), llvm::ConstantDataArray::getString(), llvm::GlobalValue::Global, llvm::omp::types::initializeTypes(), llvm::OpenMPIRBuilder::LocationDescription::IP, llvm::GlobalValue::PrivateLinkage, llvm::GlobalObject::setAlignment(), llvm::GlobalValue::setUnnamedAddr(), and llvm::to_string().
Referenced by OpenMPIRBuilder().
|
inline |
Pop the last finalization callback from the finalization stack.
NOTE: Temporary solution until Clang CG is gone.
Definition at line 76 of file OMPIRBuilder.h.
|
inline |
Push a finalization callback on the finalization stack.
NOTE: Temporary solution until Clang CG is gone.
Definition at line 69 of file OMPIRBuilder.h.
1.8.13