|
clang
3.8.0
|
#include "CGCXXABI.h"#include "CGCleanup.h"#include "CGOpenMPRuntime.h"#include "CodeGenFunction.h"#include "clang/AST/Decl.h"#include "clang/AST/StmtOpenMP.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/Bitcode/ReaderWriter.h"#include "llvm/IR/CallSite.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/Value.h"#include "llvm/Support/Format.h"#include "llvm/Support/raw_ostream.h"#include <cassert>Go to the source code of this file.
Enumerations | |
| enum | OpenMPSchedType { OMP_sch_lower = 32, OMP_sch_static_chunked = 33, OMP_sch_static = 34, OMP_sch_dynamic_chunked = 35, OMP_sch_guided_chunked = 36, OMP_sch_runtime = 37, OMP_sch_auto = 38, OMP_ord_lower = 64, OMP_ord_static_chunked = 65, OMP_ord_static = 66, OMP_ord_dynamic_chunked = 67, OMP_ord_guided_chunked = 68, OMP_ord_runtime = 69, OMP_ord_auto = 70, OMP_sch_default = OMP_sch_static } |
| Schedule types for 'omp for' loops (these enumerators are taken from the enum sched_type in kmp.h). More... | |
| enum | KmpTaskTFields |
| Indexes of fields for type kmp_task_t. More... | |
| enum | RTCancelKind |
Functions | |
| static LValue | emitLoadOfPointerLValue (CodeGenFunction &CGF, Address PtrAddr, QualType Ty) |
| static CharUnits | getIdentAlign (CodeGenModule &CGM) |
| static CharUnits | getIdentSize (CodeGenModule &CGM) |
| static CharUnits | getOffsetOfIdentField (CGOpenMPRuntime::IdentFieldIndex Field) |
| static Address | createIdentFieldGEP (CodeGenFunction &CGF, Address Addr, CGOpenMPRuntime::IdentFieldIndex Field, const llvm::Twine &Name="") |
| static llvm::Value * | getTypeSize (CodeGenFunction &CGF, QualType Ty) |
| static void | emitOMPIfClause (CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen) |
| Emits code for OpenMP 'if' clause using specified CodeGen function. More... | |
| static void | emitIfStmt (CodeGenFunction &CGF, llvm::Value *IfCond, OpenMPDirectiveKind Kind, SourceLocation Loc, const RegionCodeGenTy &BodyOpGen) |
| static Address | emitAddrOfVarFromArray (CodeGenFunction &CGF, Address Array, unsigned Index, const VarDecl *Var) |
| Given an array of pointers to variables, project the address of a given variable. More... | |
| static llvm::Value * | emitCopyprivateCopyFunction (CodeGenModule &CGM, llvm::Type *ArgsType, ArrayRef< const Expr * > CopyprivateVars, ArrayRef< const Expr * > DestExprs, ArrayRef< const Expr * > SrcExprs, ArrayRef< const Expr * > AssignmentOps) |
| static OpenMPSchedType | getRuntimeSchedule (OpenMPScheduleClauseKind ScheduleKind, bool Chunked, bool Ordered) |
| Map the OpenMP loop schedule to the runtime enumeration. More... | |
| static llvm::Function * | createOffloadingBinaryDescriptorFunction (CodeGenModule &CGM, StringRef Name, const RegionCodeGenTy &Codegen) |
| Create a Ctor/Dtor-like function whose body is emitted through Codegen. More... | |
| static FieldDecl * | addFieldToRecordDecl (ASTContext &C, DeclContext *DC, QualType FieldTy) |
| static RecordDecl * | createPrivatesRecordDecl (CodeGenModule &CGM, ArrayRef< PrivateDataTy > Privates) |
| static RecordDecl * | createKmpTaskTRecordDecl (CodeGenModule &CGM, QualType KmpInt32Ty, QualType KmpRoutineEntryPointerQTy) |
| static RecordDecl * | createKmpTaskTWithPrivatesRecordDecl (CodeGenModule &CGM, QualType KmpTaskTQTy, ArrayRef< PrivateDataTy > Privates) |
| static llvm::Value * | emitProxyTaskFunction (CodeGenModule &CGM, SourceLocation Loc, QualType KmpInt32Ty, QualType KmpTaskTWithPrivatesPtrQTy, QualType KmpTaskTWithPrivatesQTy, QualType KmpTaskTQTy, QualType SharedsPtrTy, llvm::Value *TaskFunction, llvm::Value *TaskPrivatesMap) |
| Emit a proxy function which accepts kmp_task_t as the second argument. More... | |
| static llvm::Value * | emitDestructorsFunction (CodeGenModule &CGM, SourceLocation Loc, QualType KmpInt32Ty, QualType KmpTaskTWithPrivatesPtrQTy, QualType KmpTaskTWithPrivatesQTy) |
| static llvm::Value * | emitTaskPrivateMappingFunction (CodeGenModule &CGM, SourceLocation Loc, ArrayRef< const Expr * > PrivateVars, ArrayRef< const Expr * > FirstprivateVars, QualType PrivatesQTy, ArrayRef< PrivateDataTy > Privates) |
| Emit a privates mapping function for correct handling of private and firstprivate variables. More... | |
| static int | array_pod_sort_comparator (const PrivateDataTy *P1, const PrivateDataTy *P2) |
| static void | EmitOMPAggregateReduction (CodeGenFunction &CGF, QualType Type, const VarDecl *LHSVar, const VarDecl *RHSVar, const llvm::function_ref< void(CodeGenFunction &CGF, const Expr *, const Expr *, const Expr *)> &RedOpGen, const Expr *XExpr=nullptr, const Expr *EExpr=nullptr, const Expr *UpExpr=nullptr) |
| Emit reduction operation for each element of array (required for array sections) LHS op = RHS. More... | |
| static llvm::Value * | emitReductionFunction (CodeGenModule &CGM, llvm::Type *ArgsType, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps) |
| static RTCancelKind | getCancellationKind (OpenMPDirectiveKind CancelRegion) |
| static void | getTargetEntryUniqueInfo (ASTContext &C, SourceLocation Loc, unsigned &DeviceID, unsigned &FileID, unsigned &LineNum, unsigned &ColumnNum) |
| Obtain information that uniquely identifies a target entry. More... | |
| enum KmpTaskTFields |
Indexes of fields for type kmp_task_t.
Definition at line 1987 of file CGOpenMPRuntime.cpp.
| enum OpenMPSchedType |
Schedule types for 'omp for' loops (these enumerators are taken from the enum sched_type in kmp.h).
Definition at line 1750 of file CGOpenMPRuntime.cpp.
| enum RTCancelKind |
Definition at line 3614 of file CGOpenMPRuntime.cpp.
|
static |
Definition at line 2386 of file CGOpenMPRuntime.cpp.
References clang::DeclContext::addDecl(), clang::AS_public, clang::FieldDecl::Create(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::ICIS_NoInit, and clang::Decl::setAccess().
Referenced by createKmpTaskTRecordDecl(), createKmpTaskTWithPrivatesRecordDecl(), createPrivatesRecordDecl(), clang::getTgtBinaryDescriptorQTy(), clang::getTgtDeviceImageQTy(), and clang::getTgtOffloadEntryQTy().
|
static |
Definition at line 2750 of file CGOpenMPRuntime.cpp.
|
static |
Definition at line 344 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateStructGEP(), getOffsetOfIdentField(), and clang::Name.
|
static |
Definition at line 2512 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), clang::ASTContext::buildImplicitRecord(), clang::CodeGen::CodeGenModule::getContext(), and clang::TagDecl::startDefinition().
|
static |
Definition at line 2532 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), clang::ASTContext::buildImplicitRecord(), createPrivatesRecordDecl(), clang::CodeGen::CodeGenModule::getContext(), and clang::TagDecl::startDefinition().
|
static |
Create a Ctor/Dtor-like function whose body is emitted through Codegen.
This is used to emit the two functions that register and unregister the descriptor of the current compilation unit.
Definition at line 2080 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::CodeGen::CodeGenModule::CreateGlobalInitOrDestructFunction(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getTypes(), and clang::CodeGen::CodeGenFunction::StartFunction().
Referenced by clang::createOffloadingBinaryDescriptorRegistration().
|
static |
Definition at line 2485 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), clang::ASTContext::buildImplicitRecord(), E, clang::Decl::getAttrs(), clang::CodeGen::CodeGenModule::getContext(), clang::ValueDecl::getType(), clang::Decl::hasAttrs(), I, and clang::TagDecl::startDefinition().
Referenced by createKmpTaskTWithPrivatesRecordDecl().
|
static |
Given an array of pointers to variables, project the address of a given variable.
Definition at line 1526 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenTypeCache::getPointerSize(), and clang::ValueDecl::getType().
Referenced by emitCopyprivateCopyFunction(), and emitReductionFunction().
|
static |
Definition at line 1539 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, AttributeLangSupport::C, clang::Create(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), E, emitAddrOfVarFromArray(), clang::CodeGen::CodeGenFunction::EmitOMPCopy(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), I, clang::InternalLinkage, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), and clang::CodeGen::CodeGenFunction::StartFunction().
|
static |
Definition at line 2626 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::Create(), clang::CodeGen::CodeGenFunction::disableDebugInfo(), emitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenFunction::pushDestroy(), clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), and clang::QualType::withRestrict().
|
static |
Definition at line 1448 of file CGOpenMPRuntime.cpp.
References clang::ASTContext::BoolTy, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranch(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), and clang::CodeGen::CodeGenModule::getOpenMPRuntime().
|
static |
Definition at line 275 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::getNaturalPointeeTypeAlignment(), clang::Type::getPointeeType(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by emitDestructorsFunction(), emitProxyTaskFunction(), and emitTaskPrivateMappingFunction().
|
static |
Emit reduction operation for each element of array (required for array sections) LHS op = RHS.
| Type | Type of array. |
| LHSVar | Variable on the left side of the reduction operation (references element of array in original variable). |
| RHSVar | Variable on the right side of the reduction operation (references element of array in original variable). |
| RedOpGen | Generator of reduction operation with use of LHSVar and RHSVar. |
Definition at line 3136 of file CGOpenMPRuntime.cpp.
References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::emitArrayLength(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::Address::getAlignment(), clang::Type::getAsArrayTypeUnsafe(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::Address::getPointer(), and clang::ASTContext::getTypeSizeInChars().
Referenced by emitReductionFunction().
|
static |
Emits code for OpenMP 'if' clause using specified CodeGen function.
Here is the logic: if (Cond) { ThenGen(); } else { ElseGen(); }
Definition at line 1245 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranch(), and clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr().
|
static |
Emit a proxy function which accepts kmp_task_t as the second argument.
Definition at line 2559 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::Create(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::disableDebugInfo(), clang::CodeGen::CodeGenFunction::EmitCallOrInvoke(), clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), emitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::RValue::getScalarVal(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::ReturnValue, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and clang::QualType::withRestrict().
|
static |
Definition at line 3207 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::Create(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), E, emitAddrOfVarFromArray(), clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(), EmitOMPAggregateReduction(), clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::CodeGen::CodeGenTypeCache::getPointerSize(), clang::VariableArrayType::getSizeExpr(), clang::CodeGen::CodeGenModule::getTypes(), I, clang::InternalLinkage, clang::Type::isArrayType(), clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenTypeCache::SizeTy, and clang::CodeGen::CodeGenFunction::StartFunction().
|
static |
Emit a privates mapping function for correct handling of private and firstprivate variables.
Definition at line 2682 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeFreeFunctionDeclaration(), clang::ImplicitParamDecl::Create(), clang::Create(), clang::CodeGen::CodeGenFunction::disableDebugInfo(), E, emitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), and clang::CodeGen::CodeGenFunction::StartFunction().
|
static |
Definition at line 3623 of file CGOpenMPRuntime.cpp.
|
static |
Definition at line 333 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypeCache::getPointerAlign().
|
static |
Definition at line 336 of file CGOpenMPRuntime.cpp.
References clang::CharUnits::fromQuantity(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), and clang::CodeGen::CodeGenTypeCache::getPointerSize().
|
static |
Definition at line 340 of file CGOpenMPRuntime.cpp.
References clang::CharUnits::fromQuantity().
Referenced by createIdentFieldGEP().
|
static |
Map the OpenMP loop schedule to the runtime enumeration.
Definition at line 1771 of file CGOpenMPRuntime.cpp.
References OMP_ord_auto, OMP_ord_dynamic_chunked, OMP_ord_guided_chunked, OMP_ord_runtime, OMP_ord_static, OMP_ord_static_chunked, OMP_sch_auto, OMP_sch_dynamic_chunked, OMP_sch_guided_chunked, OMP_sch_runtime, OMP_sch_static, OMP_sch_static_chunked, and clang::OMPC_SCHEDULE_unknown.
Referenced by clang::isDynamic(), and clang::isStaticNonchunked().
|
static |
Obtain information that uniquely identifies a target entry.
This consists of the file and device IDs as well as line and column numbers associated with the relevant entry source location.
Definition at line 3718 of file CGOpenMPRuntime.cpp.
References clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isFileID(), clang::SourceLocation::isValid(), and SM.
Referenced by clang::emitTargetOutlinedFunction(), and clang::scanForTargetRegionsFunctions().
|
static |
Definition at line 970 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, AttributeLangSupport::C, clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenFunction::getVLASize(), and clang::CodeGen::CodeGenTypeCache::SizeTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitAArch64BuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitAsmStmt(), clang::CodeGen::CodeGenFunction::EmitCheckTypeDescriptor(), clang::CodeGen::CodeGenFunction::EmitFromMemory(), clang::CodeGen::CodeGenFunction::EmitToMemory(), clang::ento::SValBuilder::evalIntegralCast(), and clang::CodeGen::CodeGenFunction::typeIsSuitableForInlineAtomic().
1.8.6