clang API Documentation
This file implements semantic analysis for OpenMP directives and clauses. More...
#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/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.
Defines | |
#define | DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack) |
Enumerations | |
enum | DefaultDataSharingAttributes |
Default data sharing attributes, which can be applied to directive. More... | |
Functions | |
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, SourceLocation StartLoc) |
static bool | CheckOpenMPIterationSpace (OpenMPDirectiveKind DKind, Stmt *S, Sema &SemaRef, DSAStackTy &DSA, unsigned CurrentNestedLoopCount, unsigned NestedLoopCount, Expr *NestedLoopCountExpr, 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). | |
static VarDecl * | BuildVarDecl (Sema &SemaRef, SourceLocation Loc, QualType Type, StringRef Name) |
Build a variable declaration for OpenMP loop iteration variable. | |
static ExprResult | BuildCounterUpdate (Sema &SemaRef, Scope *S, SourceLocation Loc, ExprResult VarRef, ExprResult Start, ExprResult Iter, ExprResult Step, bool Subtract) |
Build 'VarRef = Start + Iter * Step'. | |
static ExprResult | WidenIterationCount (unsigned Bits, Expr *E, Sema &SemaRef) |
Convert integer expression E to make it have at least Bits bits. | |
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. | |
static unsigned | CheckOpenMPLoop (OpenMPDirectiveKind DKind, Expr *NestedLoopCountExpr, Stmt *AStmt, Sema &SemaRef, DSAStackTy &DSA, llvm::DenseMap< VarDecl *, Expr * > &VarsWithImplicitDSA, BuiltLoopExprs &Built) |
Called on a for stmt to check itself and nested loops (if any). | |
static Expr * | GetCollapseNumberExpr (ArrayRef< OMPClause * > Clauses) |
This file implements semantic analysis for OpenMP directives and clauses.
Definition in file SemaOpenMP.cpp.
#define DSAStack static_cast<DSAStackTy *>(VarDataSharingAttributesStack) |
Definition at line 552 of file SemaOpenMP.cpp.
Referenced by clang::Sema::ActOnOpenMPAlignedClause(), clang::Sema::ActOnOpenMPCopyinClause(), clang::Sema::ActOnOpenMPCopyprivateClause(), clang::Sema::ActOnOpenMPDefaultClause(), clang::Sema::ActOnOpenMPExecutableDirective(), clang::Sema::ActOnOpenMPFinalClause(), clang::Sema::ActOnOpenMPFirstprivateClause(), clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPIfClause(), clang::Sema::ActOnOpenMPLastprivateClause(), clang::Sema::ActOnOpenMPLinearClause(), clang::Sema::ActOnOpenMPOrderedClause(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), clang::Sema::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPRegionStart(), clang::Sema::ActOnOpenMPSharedClause(), clang::Sema::ActOnOpenMPSimdDirective(), clang::Sema::ActOnOpenMPTargetDirective(), clang::Sema::CheckOMPThreadPrivateDecl(), clang::Sema::EndOpenMPDSABlock(), and clang::Sema::StartOpenMPDSABlock().
Default data sharing attributes, which can be applied to directive.
Definition at line 38 of file SemaOpenMP.cpp.
static ExprResult BuildCounterUpdate | ( | Sema & | SemaRef, |
Scope * | S, | ||
SourceLocation | Loc, | ||
ExprResult | VarRef, | ||
ExprResult | Start, | ||
ExprResult | Iter, | ||
ExprResult | Step, | ||
bool | Subtract | ||
) | [static] |
Build 'VarRef = Start + Iter * Step'.
Definition at line 2579 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::ExprError(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Expr::getType(), clang::Expr::IgnoreImplicit(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), and clang::Sema::PerformImplicitConversion().
Referenced by CheckOpenMPLoop().
static VarDecl* BuildVarDecl | ( | Sema & | SemaRef, |
SourceLocation | Loc, | ||
QualType | Type, | ||
StringRef | Name | ||
) | [static] |
Build a variable declaration for OpenMP loop iteration variable.
Definition at line 2567 of file SemaOpenMP.cpp.
References clang::Sema::Context, clang::VarDecl::Create(), clang::Sema::CurContext, clang::IdentifierTable::get(), clang::Preprocessor::getIdentifierTable(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::Sema::PP, clang::SC_None, and clang::Decl::setImplicit().
Referenced by CheckOpenMPLoop().
static bool CheckNestingOfRegions | ( | Sema & | SemaRef, |
DSAStackTy * | Stack, | ||
OpenMPDirectiveKind | CurrentRegion, | ||
const DeclarationNameInfo & | CurrentName, | ||
SourceLocation | StartLoc | ||
) | [static] |
Definition at line 1198 of file SemaOpenMP.cpp.
References clang::Sema::Diag(), clang::DeclarationNameInfo::getName(), clang::getOpenMPDirectiveName(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTeamsDirective(), clang::isOpenMPWorksharingDirective(), and clang::SourceLocation::isValid().
Referenced by clang::Sema::ActOnOpenMPExecutableDirective().
static bool CheckOpenMPIterationSpace | ( | OpenMPDirectiveKind | DKind, |
Stmt * | S, | ||
Sema & | SemaRef, | ||
DSAStackTy & | DSA, | ||
unsigned | CurrentNestedLoopCount, | ||
unsigned | NestedLoopCount, | ||
Expr * | NestedLoopCountExpr, | ||
llvm::DenseMap< VarDecl *, Expr * > & | VarsWithImplicitDSA, | ||
LoopIterationSpace & | ResultIterSpace | ||
) | [static] |
Called on a for stmt to check and extract its iteration space for further processing (such as collapsing).
Definition at line 2432 of file SemaOpenMP.cpp.
References clang::Sema::CurContext, clang::Sema::Diag(), clang::Expr::getExprLoc(), clang::Sema::getLangOpts(), clang::Stmt::getLocStart(), clang::getOpenMPClauseName(), clang::getOpenMPDirectiveName(), clang::Stmt::getSourceRange(), clang::DeclContext::isDependentContext(), clang::isOpenMPLoopDirective(), clang::isOpenMPPrivate(), clang::isOpenMPSimdDirective(), clang::isOpenMPWorksharingDirective(), ReportOriginalDSA(), and S.
Referenced by CheckOpenMPLoop().
static unsigned CheckOpenMPLoop | ( | OpenMPDirectiveKind | DKind, |
Expr * | NestedLoopCountExpr, | ||
Stmt * | AStmt, | ||
Sema & | SemaRef, | ||
DSAStackTy & | DSA, | ||
llvm::DenseMap< VarDecl *, Expr * > & | VarsWithImplicitDSA, | ||
BuiltLoopExprs & | Built | ||
) | [static] |
Called on a for stmt to check itself and nested loops (if any).
Definition at line 2641 of file SemaOpenMP.cpp.
References clang::Sema::ActOnIntegerConstant(), clang::Sema::ActOnParenExpr(), clang::BO_Add, clang::BO_Assign, clang::BO_Div, clang::BO_GT, clang::BO_LT, clang::BO_Mul, clang::BO_Rem, clang::BO_Sub, clang::Sema::BuildBinOp(), BuildCounterUpdate(), clang::Sema::BuildDeclRefExpr(), BuildVarDecl(), AttributeLangSupport::C, CheckOpenMPIterationSpace(), clang::Sema::Context, clang::Sema::CurContext, clang::Expr::EvaluateAsInt(), FitsInto(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Sema::getASTContext(), clang::Expr::getType(), clang::Type::hasSignedIntegerRepresentation(), clang::Stmt::IgnoreContainers(), clang::DeclContext::isDependentContext(), clang::Expr::isIntegerConstantExpr(), clang::ActionResult< PtrTy, CompressInvalid >::isUnset(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::VK_LValue, and WidenIterationCount().
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 2628 of file SemaOpenMP.cpp.
References clang::Sema::Context, and clang::Expr::isIntegerConstantExpr().
Referenced by CheckOpenMPLoop().
static Expr* GetCollapseNumberExpr | ( | ArrayRef< OMPClause * > | Clauses | ) | [static] |
Definition at line 2903 of file SemaOpenMP.cpp.
References AttributeLangSupport::C.
Referenced by clang::Sema::ActOnOpenMPForDirective(), clang::Sema::ActOnOpenMPForSimdDirective(), clang::Sema::ActOnOpenMPParallelForDirective(), clang::Sema::ActOnOpenMPParallelForSimdDirective(), and clang::Sema::ActOnOpenMPSimdDirective().
static void ReportOriginalDSA | ( | Sema & | SemaRef, |
DSAStackTy * | Stack, | ||
const VarDecl * | VD, | ||
DSAStackTy::DSAVarData | DVar, | ||
bool | IsLoopIterVar = false |
||
) | [static] |
Definition at line 865 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::ActOnOpenMPPrivateClause(), clang::Sema::ActOnOpenMPReductionClause(), clang::Sema::ActOnOpenMPSharedClause(), and CheckOpenMPIterationSpace().
static ExprResult WidenIterationCount | ( | unsigned | Bits, |
Expr * | E, | ||
Sema & | SemaRef | ||
) | [static] |
Convert integer expression E to make it have at least Bits bits.
Definition at line 2611 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().