|
clang
3.8.0
|
This file implements semantic analysis for OpenMP directives and clauses. More...
#include "TreeTransform.h"#include "clang/AST/ASTContext.h"#include "clang/AST/ASTMutationListener.h"#include "clang/AST/Decl.h"#include "clang/AST/DeclCXX.h"#include "clang/AST/DeclOpenMP.h"#include "clang/AST/StmtCXX.h"#include "clang/AST/StmtOpenMP.h"#include "clang/AST/StmtVisitor.h"#include "clang/Basic/OpenMPKinds.h"#include "clang/Basic/TargetInfo.h"#include "clang/Lex/Preprocessor.h"#include "clang/Sema/Initialization.h"#include "clang/Sema/Lookup.h"#include "clang/Sema/Scope.h"#include "clang/Sema/ScopeInfo.h"#include "clang/Sema/SemaInternal.h"Go to the source code of this file.
Macros | |
| #define | DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack) |
Enumerations | |
| enum | DefaultDataSharingAttributes |
| Default data sharing attributes, which can be applied to directive. More... | |
Functions | |
| static VarDecl * | buildVarDecl (Sema &SemaRef, SourceLocation Loc, QualType Type, StringRef Name, const AttrVec *Attrs=nullptr) |
| Build a variable declaration for OpenMP loop iteration variable. More... | |
| static DeclRefExpr * | buildDeclRefExpr (Sema &S, VarDecl *D, QualType Ty, SourceLocation Loc, bool RefersToCapture=false) |
| static bool | FinishOpenMPLinearClause (OMPLinearClause &Clause, DeclRefExpr *IV, Expr *NumIterations, Sema &SemaRef, Scope *S) |
| static void | ReportOriginalDSA (Sema &SemaRef, DSAStackTy *Stack, const VarDecl *VD, DSAStackTy::DSAVarData DVar, bool IsLoopIterVar=false) |
| static bool | CheckNestingOfRegions (Sema &SemaRef, DSAStackTy *Stack, OpenMPDirectiveKind CurrentRegion, const DeclarationNameInfo &CurrentName, OpenMPDirectiveKind CancelRegion, SourceLocation StartLoc) |
| static bool | checkIfClauses (Sema &S, OpenMPDirectiveKind Kind, ArrayRef< OMPClause * > Clauses, ArrayRef< OpenMPDirectiveKind > AllowedNameModifiers) |
| static bool | CheckOpenMPIterationSpace (OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA, unsigned CurrentNestedLoopCount, unsigned NestedLoopCount, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA, LoopIterationSpace &ResultIterSpace) |
| Called on a for stmt to check and extract its iteration space for further processing (such as collapsing). More... | |
| static ExprResult | BuildCounterInit (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start) |
| Build 'VarRef = Start. More... | |
| static ExprResult | BuildCounterUpdate (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start, ExprResult Iter, ExprResult Step, bool Subtract) |
| Build 'VarRef = Start + Iter * Step'. More... | |
| static ExprResult | WidenIterationCount (unsigned Bits, Expr *E, Sema &SemaRef) |
| Convert integer expression E to make it have at least Bits bits. More... | |
| static bool | FitsInto (unsigned Bits, bool Signed, Expr *E, Sema &SemaRef) |
| Check if the given expression E is a constant integer that fits into Bits bits. More... | |
| static unsigned | CheckOpenMPLoop (OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr, Expr *OrderedLoopCountExpr, Stmt *AStmt, Sema &SemaRef, DSAStackTy &DSA, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA, OMPLoopDirective::HelperExprs &Built) |
| Called on a for stmt to check itself and nested loops (if any). More... | |
| static Expr * | getCollapseNumberExpr (ArrayRef< OMPClause * > Clauses) |
| static Expr * | getOrderedNumberExpr (ArrayRef< OMPClause * > Clauses) |
| static bool | checkSimdlenSafelenValues (Sema &S, const Expr *Simdlen, const Expr *Safelen) |
| static bool | checkGrainsizeNumTasksClauses (Sema &S, ArrayRef< OMPClause * > Clauses) |
| static bool | IsNonNegativeIntegerValue (Expr *&ValExpr, Sema &SemaRef, OpenMPClauseKind CKind, bool StrictlyPositive) |
| static std::string | getListOfPossibleValues (OpenMPClauseKind K, unsigned First, unsigned Last, ArrayRef< unsigned > Exclude=llvm::None) |
| static bool | checkScheduleModifiers (Sema &S, OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, SourceLocation M1Loc, SourceLocation M2Loc) |
| static bool | IsCXXRecordForMappable (Sema &SemaRef, SourceLocation Loc, DSAStackTy *Stack, CXXRecordDecl *RD) |
| static bool | CheckTypeMappable (SourceLocation SL, SourceRange SR, Sema &SemaRef, DSAStackTy *Stack, QualType QTy) |
This file implements semantic analysis for OpenMP directives and clauses.
Definition in file SemaOpenMP.cpp.
| #define DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack) |
Definition at line 773 of file SemaOpenMP.cpp.
Referenced by clang::Sema::ActOnOpenMPAlignedClause(), clang::Sema::ActOnOpenMPCancelDirective(), clang::Sema::ActOnOpenMPCancellationPointDirective(), clang::Sema::ActOnOpenMPCopyinClause(), clang::Sema::ActOnOpenMPCopyprivateClause(), clang::Sema::ActOnOpenMPCriticalDirective(), clang::Sema::ActOnOpenMPDefaultClause(), clang::Sema::ActOnOpenMPDependClause(), clang::Sema::ActOnOpenMPDistributeDirective(), clang::Sema::ActOnOpenMPExecutableDirective(), clang::Sema::ActOnOpenMPFinalClause(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnOpenMPIfClause(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnOpenMPLoopInitialization(), clang::Sema::ActOnOpenMPMapClause(), clang::Sema::ActOnOpenMPNowaitClause(), clang::Sema::ActOnOpenMPOrderedClause(), clang::Sema::ActOnOpenMPOrderedDirective(), clang::Sema::ActOnOpenMPParallelDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPParallelSectionsDirective(), clang::Sema::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPRegionEnd(), clang::Sema::ActOnOpenMPRegionStart(), clang::Sema::ActOnOpenMPScheduleClause(), clang::Sema::ActOnOpenMPSectionDirective(), clang::Sema::ActOnOpenMPSectionsDirective(), clang::Sema::ActOnOpenMPSharedClause(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPTargetDirective(), clang::Sema::ActOnOpenMPTaskDirective(), clang::Sema::ActOnOpenMPTaskLoopDirective(), clang::Sema::ActOnOpenMPTaskLoopSimdDirective(), clang::Sema::CheckOMPThreadPrivateDecl(), clang::Sema::EndOpenMPClause(), clang::Sema::EndOpenMPDSABlock(), clang::Sema::IsOpenMPCapturedByRef(), clang::Sema::IsOpenMPCapturedVar(), clang::Sema::isOpenMPPrivateVar(), clang::Sema::isOpenMPTargetCapturedVar(), clang::Sema::StartOpenMPClause(), and clang::Sema::StartOpenMPDSABlock().
Default data sharing attributes, which can be applied to directive.
Definition at line 40 of file SemaOpenMP.cpp.
|
static |
Build 'VarRef = Start.
Definition at line 3625 of file SemaOpenMP.cpp.
References clang::Sema::AA_Converting, clang::BO_Assign, clang::Sema::BuildBinOp(), clang::Sema::Context, clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Expr::getType(), clang::ASTContext::hasSameType(), clang::Expr::IgnoreImplicit(), and clang::Sema::PerformImplicitConversion().
Referenced by CheckOpenMPLoop().
|
static |
Build 'VarRef = Start + Iter * Step'.
Definition at line 3656 of file SemaOpenMP.cpp.
References clang::Sema::AA_Converting, clang::Sema::ActOnParenExpr(), clang::BO_Add, clang::BO_Assign, clang::BO_Mul, clang::BO_Sub, clang::Sema::BuildBinOp(), clang::Sema::Context, clang::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Expr::getType(), clang::ASTContext::hasSameType(), clang::Expr::IgnoreImplicit(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), and clang::Sema::PerformImplicitConversion().
Referenced by CheckOpenMPLoop(), and FinishOpenMPLinearClause().
|
static |
Definition at line 574 of file SemaOpenMP.cpp.
References clang::Sema::Context, clang::DeclRefExpr::Create(), clang::Sema::getASTContext(), clang::Decl::markUsed(), clang::Decl::setReferenced(), and clang::VK_LValue.
Referenced by clang::Sema::ActOnOpenMPCopyinClause(), clang::Sema::ActOnOpenMPCopyprivateClause(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnOpenMPIdExpression(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPScheduleClause(), CheckOpenMPLoop(), clang::Sema::EndOpenMPDSABlock(), and FinishOpenMPLinearClause().
|
static |
Build a variable declaration for OpenMP loop iteration variable.
Definition at line 558 of file SemaOpenMP.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, clang::VarDecl::Create(), clang::Sema::CurContext, E, clang::IdentifierTable::get(), clang::Preprocessor::getIdentifierTable(), clang::ASTContext::getTrivialTypeSourceInfo(), I, clang::Sema::PP, clang::SC_None, and clang::Decl::setImplicit().
Referenced by clang::Sema::ActOnOpenMPCopyinClause(), clang::Sema::ActOnOpenMPCopyprivateClause(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPScheduleClause(), CheckOpenMPLoop(), and clang::Sema::EndOpenMPDSABlock().
Definition at line 5551 of file SemaOpenMP.cpp.
References AttributeLangSupport::C, clang::Sema::Diag(), clang::OMPClause::getClauseKind(), clang::OMPClause::getLocStart(), and clang::getOpenMPClauseName().
Referenced by clang::Sema::ActOnOpenMPTaskLoopDirective(), and clang::Sema::ActOnOpenMPTaskLoopSimdDirective().
|
static |
Definition at line 2455 of file SemaOpenMP.cpp.
References AttributeLangSupport::C, clang::Sema::Diag(), End, clang::getOpenMPClauseName(), clang::getOpenMPDirectiveName(), and clang::OMPD_unknown.
Referenced by clang::Sema::ActOnOpenMPExecutableDirective().
|
static |
Definition at line 1698 of file SemaOpenMP.cpp.
References clang::Sema::Diag(), clang::DeclarationNameInfo::getName(), clang::getOpenMPDirectiveName(), clang::isOpenMPDistributeDirective(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPTeamsDirective(), clang::isOpenMPWorksharingDirective(), clang::SourceLocation::isValid(), and clang::OMPD_unknown.
Referenced by clang::Sema::ActOnOpenMPExecutableDirective().
|
static |
Called on a for stmt to check and extract its iteration space for further processing (such as collapsing).
Definition at line 3477 of file SemaOpenMP.cpp.
References clang::Sema::CurContext, clang::Sema::Diag(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::QualType::getNonReferenceType(), clang::getOpenMPClauseName(), clang::getOpenMPDirectiveName(), clang::Expr::getType(), clang::DeclContext::isDependentContext(), clang::isOpenMPDistributeDirective(), clang::isOpenMPLoopDirective(), clang::isOpenMPPrivate(), clang::isOpenMPSimdDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::OMPC_unknown, ReportOriginalDSA(), and S.
Referenced by CheckOpenMPLoop().
|
static |
Called on a for stmt to check itself and nested loops (if any).
Definition at line 3743 of file SemaOpenMP.cpp.
References clang::Sema::AA_Converting, clang::Sema::ActOnConditionalOp(), clang::Sema::ActOnFinishFullExpr(), clang::Sema::ActOnIntegerConstant(), clang::Sema::ActOnParenExpr(), clang::Sema::AddInitializerToDecl(), clang::BO_Add, clang::BO_Assign, clang::BO_Div, clang::BO_GT, clang::BO_LAnd, clang::BO_LT, clang::BO_Mul, clang::BO_Rem, clang::BO_Sub, clang::Sema::BuildBinOp(), BuildCounterInit(), BuildCounterUpdate(), buildDeclRefExpr(), buildVarDecl(), AttributeLangSupport::C, clang::OMPLoopDirective::HelperExprs::CalcLastIteration, CheckOpenMPIterationSpace(), clang::OMPLoopDirective::HelperExprs::clear(), clang::OMPLoopDirective::HelperExprs::Cond, clang::Sema::Context, clang::OMPLoopDirective::HelperExprs::Counters, clang::Sema::CurContext, clang::Sema::Diag(), clang::OMPLoopDirective::HelperExprs::EUB, clang::Expr::EvaluateAsInt(), clang::OMPLoopDirective::HelperExprs::Finals, FitsInto(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getASTContext(), clang::Expr::getExprLoc(), clang::ASTContext::getIntTypeForBitwidth(), clang::Expr::getType(), clang::Type::hasSignedIntegerRepresentation(), clang::OMPLoopDirective::HelperExprs::IL, clang::OMPLoopDirective::HelperExprs::Inc, clang::OMPLoopDirective::HelperExprs::Init, clang::OMPLoopDirective::HelperExprs::Inits, clang::DeclContext::isDependentContext(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPDistributeDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::ActionResult< PtrTy, CompressInvalid >::isUnset(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::OMPLoopDirective::HelperExprs::IterationVarRef, clang::OMPLoopDirective::HelperExprs::LastIteration, clang::OMPLoopDirective::HelperExprs::LB, clang::OMPLoopDirective::HelperExprs::NLB, clang::OMPLoopDirective::HelperExprs::NUB, clang::OMPLoopDirective::HelperExprs::NumIterations, clang::Sema::PerformImplicitConversion(), clang::OMPLoopDirective::HelperExprs::PreCond, clang::OMPLoopDirective::HelperExprs::PrivateCounters, clang::Result, clang::OMPLoopDirective::HelperExprs::ST, clang::OMPLoopDirective::HelperExprs::UB, clang::OMPLoopDirective::HelperExprs::Updates, and WidenIterationCount().
Referenced by clang::Sema::ActOnOpenMPDistributeDirective(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPTaskLoopDirective(), and clang::Sema::ActOnOpenMPTaskLoopSimdDirective().
|
static |
Definition at line 6164 of file SemaOpenMP.cpp.
References clang::Sema::Diag(), getListOfPossibleValues(), clang::getOpenMPClauseName(), clang::SourceLocation::isValid(), clang::OMPC_SCHEDULE_MODIFIER_last, and clang::OMPC_SCHEDULE_MODIFIER_unknown.
Referenced by clang::Sema::ActOnOpenMPScheduleClause().
|
static |
Definition at line 4159 of file SemaOpenMP.cpp.
References clang::Expr::containsUnexpandedParameterPack(), clang::Sema::Context, clang::Sema::Diag(), clang::Expr::EvaluateAsInt(), clang::Expr::getExprLoc(), clang::Expr::isInstantiationDependent(), clang::Expr::isTypeDependent(), and clang::Expr::isValueDependent().
Referenced by clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), and clang::Sema::ActOnOpenMPSimdDirective().
|
static |
Definition at line 8355 of file SemaOpenMP.cpp.
References clang::Sema::Diag(), IsCXXRecordForMappable(), clang::Type::isIncompleteType(), and clang::Decl::isInvalidDecl().
Referenced by clang::Sema::ActOnOpenMPMapClause().
|
static |
Definition at line 7789 of file SemaOpenMP.cpp.
References clang::Sema::ActOnFinishFullExpr(), clang::Sema::ActOnIntegerConstant(), BuildCounterUpdate(), buildDeclRefExpr(), CalcStep, Finals, clang::ActionResult< PtrTy, CompressInvalid >::get(), Step, Updates, and clang::OMPVarListClause< T >::varlists().
Referenced by clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), and clang::Sema::ActOnOpenMPSimdDirective().
Check if the given expression E is a constant integer that fits into Bits bits.
Definition at line 3730 of file SemaOpenMP.cpp.
References clang::Sema::Context, clang::Expr::isIntegerConstantExpr(), and clang::Result.
Referenced by CheckOpenMPLoop().
Definition at line 4143 of file SemaOpenMP.cpp.
Referenced by clang::Sema::ActOnOpenMPDistributeDirective(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPTaskLoopDirective(), and clang::Sema::ActOnOpenMPTaskLoopSimdDirective().
|
static |
Definition at line 6028 of file SemaOpenMP.cpp.
References clang::getOpenMPSimpleClauseTypeName(), and clang::LangAS::Last.
Referenced by clang::Sema::ActOnOpenMPDefaultClause(), clang::Sema::ActOnOpenMPDependClause(), clang::Sema::ActOnOpenMPProcBindClause(), clang::Sema::ActOnOpenMPScheduleClause(), and checkScheduleModifiers().
|
static |
Definition at line 8311 of file SemaOpenMP.cpp.
References clang::CXXRecordDecl::bases(), clang::Sema::Context, clang::Sema::Diag(), clang::Decl::getLocation(), clang::ASTContext::getRecordType(), clang::CXXRecordDecl::isDynamicClass(), clang::Decl::isInvalidDecl(), clang::VarDecl::isStaticDataMember(), and Stack.
Referenced by CheckTypeMappable().
|
static |
Definition at line 5828 of file SemaOpenMP.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Expr::getExprLoc(), clang::getOpenMPClauseName(), clang::Expr::isInstantiationDependent(), clang::Expr::isIntegerConstantExpr(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), clang::Sema::PerformOpenMPImplicitIntegerConversion(), and clang::Result.
Referenced by clang::Sema::ActOnOpenMPDeviceClause(), clang::Sema::ActOnOpenMPGrainsizeClause(), clang::Sema::ActOnOpenMPNumTasksClause(), clang::Sema::ActOnOpenMPNumTeamsClause(), clang::Sema::ActOnOpenMPNumThreadsClause(), clang::Sema::ActOnOpenMPPriorityClause(), and clang::Sema::ActOnOpenMPThreadLimitClause().
|
static |
Definition at line 1254 of file SemaOpenMP.cpp.
References clang::Sema::Diag(), clang::Sema::getASTContext(), clang::Decl::getLocation(), clang::getOpenMPClauseName(), clang::getOpenMPDirectiveName(), clang::ValueDecl::getType(), clang::QualType::isConstant(), clang::VarDecl::isFileVarDecl(), clang::VarDecl::isLocalVarDecl(), clang::VarDecl::isStaticDataMember(), and clang::VarDecl::isStaticLocal().
Referenced by clang::Sema::ActOnOpenMPCopyprivateClause(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnOpenMPMapClause(), clang::Sema::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPSharedClause(), and CheckOpenMPIterationSpace().
|
static |
Convert integer expression E to make it have at least Bits bits.
Definition at line 3713 of file SemaOpenMP.cpp.
References clang::Sema::AA_Converting, AttributeLangSupport::C, clang::Sema::Context, clang::ExprError(), clang::Expr::getType(), and clang::Sema::PerformImplicitConversion().
Referenced by CheckOpenMPLoop().
1.8.6