clang  19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::SemaSYCL Class Reference

#include "clang/Sema/SemaSYCL.h"

Inheritance diagram for clang::SemaSYCL:
Inheritance graph
[legend]

Public Types

enum  SYCLRestrictKind {
  KernelGlobalVariable , KernelRTTI , KernelNonConstStaticDataVariable , KernelCallVirtualFunction ,
  KernelUseExceptions , KernelCallRecursiveFunction , KernelCallFunctionPointer , KernelAllocateStorage ,
  KernelUseAssembly , KernelCallDllimportFunction , KernelCallVariadicFunction , KernelCallUndefinedFunction ,
  KernelConstStaticVariable
}
 
- Public Types inherited from clang::SemaBase
enum class  DeviceDiagnosticReason {
  None = 0 , OmpDevice = 1 << 0 , OmpHost = 1 << 1 , OmpAll = OmpDevice | OmpHost ,
  CudaDevice = 1 << 2 , CudaHost = 1 << 3 , CudaAll = CudaDevice | CudaHost , Sycl = 1 << 4 ,
  Esimd = 1 << 5 , All = OmpAll | CudaAll | Sycl | Esimd
}
 Bitmask to contain the list of reasons a single diagnostic should be emitted, based on its language. More...
 

Public Member Functions

 SemaSYCL (Sema &S)
 
void CheckSYCLKernelCall (FunctionDecl *CallerFunc, ArrayRef< const Expr * > Args)
 
SemaDiagnosticBuilder DiagIfDeviceCode (SourceLocation Loc, unsigned DiagID, DeviceDiagnosticReason Reason=DeviceDiagnosticReason::Sycl|DeviceDiagnosticReason::Esimd)
 Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code". More...
 
void deepTypeCheckForDevice (SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
 
void addSyclOpenCLKernel (const FunctionDecl *SyclKernel, FunctionDecl *OpenCLKernel)
 
void addSyclDeviceDecl (Decl *d)
 
llvm::SetVector< Decl * > & syclDeviceDecls ()
 
SYCLIntegrationHeadergetSyclIntegrationHeader ()
 Lazily creates and returns SYCL integration header instance. More...
 
SYCLIntegrationFootergetSyclIntegrationFooter ()
 
void addSyclVarDecl (VarDecl *VD)
 
bool hasSyclIntegrationHeader ()
 
bool hasSyclIntegrationFooter ()
 
bool isDeclAllowedInSYCLDeviceCode (const Decl *D)
 
void checkSYCLDeviceVarDecl (VarDecl *Var)
 
void copySYCLKernelAttrs (CXXMethodDecl *CallOperator)
 
void ConstructOpenCLKernel (FunctionDecl *KernelCallerFunc, MangleContext &MC)
 
void SetSYCLKernelNames ()
 
void MarkDevices ()
 
void ProcessFreeFunction (FunctionDecl *FD)
 
ExprResult ActOnSYCLBuiltinNumFieldsExpr (ParsedType PT)
 Get the number of fields or captures within the parsed type. More...
 
ExprResult BuildSYCLBuiltinNumFieldsExpr (SourceLocation Loc, QualType SourceTy)
 
ExprResult ActOnSYCLBuiltinFieldTypeExpr (ParsedType PT, Expr *Idx)
 Get a value based on the type of the given field number so that callers can wrap it in a decltype() to get the actual type of the field. More...
 
ExprResult BuildSYCLBuiltinFieldTypeExpr (SourceLocation Loc, QualType SourceTy, Expr *Idx)
 
ExprResult ActOnSYCLBuiltinNumBasesExpr (ParsedType PT)
 Get the number of base classes within the parsed type. More...
 
ExprResult BuildSYCLBuiltinNumBasesExpr (SourceLocation Loc, QualType SourceTy)
 
ExprResult ActOnSYCLBuiltinBaseTypeExpr (ParsedType PT, Expr *Idx)
 Get a value based on the type of the given base number so that callers can wrap it in a decltype() to get the actual type of the base class. More...
 
ExprResult BuildSYCLBuiltinBaseTypeExpr (SourceLocation Loc, QualType SourceTy, Expr *Idx)
 
bool checkAllowedSYCLInitializer (VarDecl *VD)
 
void finalizeSYCLDelayedAnalysis (const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc, DeviceDiagnosticReason Reason)
 Finishes analysis of the deferred functions calls that may be not properly declared for device compilation. More...
 
bool isSYCLEsimdPrivateGlobal (VarDecl *VDecl)
 Tells whether given variable is a SYCL explicit SIMD extension's "private global" variable - global variable in the private address space. More...
 
ExprResult BuildUniqueStableIdExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, Expr *E)
 
ExprResult ActOnUniqueStableIdExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, Expr *E)
 
ExprResult BuildUniqueStableNameExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
 
ExprResult ActOnUniqueStableNameExpr (SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
 
- Public Member Functions inherited from clang::SemaBase
 SemaBase (Sema &S)
 
ASTContextgetASTContext () const
 
DiagnosticsEnginegetDiagnostics () const
 
const LangOptionsgetLangOpts () const
 
void addFDToReachableFromSyclDevice (const FunctionDecl *Callee, const FunctionDecl *Caller)
 
bool isFDReachableFromSyclDevice (const FunctionDecl *Callee, const FunctionDecl *Caller)
 
SemaDiagnosticBuilder Diag (SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
 Emit a diagnostic. More...
 
SemaDiagnosticBuilder Diag (SourceLocation Loc, const PartialDiagnostic &PD, bool DeferHint=false)
 Emit a partial diagnostic. More...
 

Static Public Member Functions

template<typename AttrTy >
static bool isTypeDecoratedWithDeclAttribute (QualType Ty)
 
static bool isSyclType (QualType Ty, SYCLTypeAttr::SYCLType TypeName)
 Check whether Ty corresponds to a SYCL type of name TypeName. More...
 

Additional Inherited Members

- Public Attributes inherited from clang::SemaBase
SemaSemaRef
 

Detailed Description

Definition at line 216 of file SemaSYCL.h.

Member Enumeration Documentation

◆ SYCLRestrictKind

Enumerator
KernelGlobalVariable 
KernelRTTI 
KernelNonConstStaticDataVariable 
KernelCallVirtualFunction 
KernelUseExceptions 
KernelCallRecursiveFunction 
KernelCallFunctionPointer 
KernelAllocateStorage 
KernelUseAssembly 
KernelCallDllimportFunction 
KernelCallVariadicFunction 
KernelCallUndefinedFunction 
KernelConstStaticVariable 

Definition at line 299 of file SemaSYCL.h.

Constructor & Destructor Documentation

◆ SemaSYCL()

SemaSYCL::SemaSYCL ( Sema S)

Definition at line 396 of file SemaSYCL.cpp.

Member Function Documentation

◆ ActOnSYCLBuiltinBaseTypeExpr()

ExprResult SemaSYCL::ActOnSYCLBuiltinBaseTypeExpr ( ParsedType  PT,
Expr Idx 
)

Get a value based on the type of the given base number so that callers can wrap it in a decltype() to get the actual type of the base class.

Definition at line 246 of file SemaSYCL.cpp.

References clang::TypeLoc::getBeginLoc(), and clang::TypeSourceInfo::getTypeLoc().

◆ ActOnSYCLBuiltinFieldTypeExpr()

ExprResult SemaSYCL::ActOnSYCLBuiltinFieldTypeExpr ( ParsedType  PT,
Expr Idx 
)

Get a value based on the type of the given field number so that callers can wrap it in a decltype() to get the actual type of the field.

Definition at line 140 of file SemaSYCL.cpp.

References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().

◆ ActOnSYCLBuiltinNumBasesExpr()

ExprResult SemaSYCL::ActOnSYCLBuiltinNumBasesExpr ( ParsedType  PT)

Get the number of base classes within the parsed type.

Definition at line 219 of file SemaSYCL.cpp.

References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().

◆ ActOnSYCLBuiltinNumFieldsExpr()

ExprResult SemaSYCL::ActOnSYCLBuiltinNumFieldsExpr ( ParsedType  PT)

Get the number of fields or captures within the parsed type.

Definition at line 113 of file SemaSYCL.cpp.

References clang::TypeLoc::getBeginLoc(), clang::Sema::GetTypeFromParser(), and clang::TypeSourceInfo::getTypeLoc().

◆ ActOnUniqueStableIdExpr()

ExprResult SemaSYCL::ActOnUniqueStableIdExpr ( SourceLocation  OpLoc,
SourceLocation  LParen,
SourceLocation  RParen,
Expr E 
)

Definition at line 6587 of file SemaSYCL.cpp.

References BuildUniqueStableIdExpr().

◆ ActOnUniqueStableNameExpr()

ExprResult SemaSYCL::ActOnUniqueStableNameExpr ( SourceLocation  OpLoc,
SourceLocation  LParen,
SourceLocation  RParen,
ParsedType  ParsedTy 
)

◆ addSyclDeviceDecl()

void clang::SemaSYCL::addSyclDeviceDecl ( Decl d)
inline

Definition at line 275 of file SemaSYCL.h.

◆ addSyclOpenCLKernel()

void clang::SemaSYCL::addSyclOpenCLKernel ( const FunctionDecl SyclKernel,
FunctionDecl OpenCLKernel 
)
inline

Definition at line 270 of file SemaSYCL.h.

◆ addSyclVarDecl()

void clang::SemaSYCL::addSyclVarDecl ( VarDecl VD)
inline

◆ BuildSYCLBuiltinBaseTypeExpr()

ExprResult SemaSYCL::BuildSYCLBuiltinBaseTypeExpr ( SourceLocation  Loc,
QualType  SourceTy,
Expr Idx 
)

◆ BuildSYCLBuiltinFieldTypeExpr()

ExprResult SemaSYCL::BuildSYCLBuiltinFieldTypeExpr ( SourceLocation  Loc,
QualType  SourceTy,
Expr Idx 
)

◆ BuildSYCLBuiltinNumBasesExpr()

ExprResult SemaSYCL::BuildSYCLBuiltinNumBasesExpr ( SourceLocation  Loc,
QualType  SourceTy 
)

◆ BuildSYCLBuiltinNumFieldsExpr()

ExprResult SemaSYCL::BuildSYCLBuiltinNumFieldsExpr ( SourceLocation  Loc,
QualType  SourceTy 
)

◆ BuildUniqueStableIdExpr()

ExprResult SemaSYCL::BuildUniqueStableIdExpr ( SourceLocation  OpLoc,
SourceLocation  LParen,
SourceLocation  RParen,
Expr E 
)

◆ BuildUniqueStableNameExpr()

ExprResult SemaSYCL::BuildUniqueStableNameExpr ( SourceLocation  OpLoc,
SourceLocation  LParen,
SourceLocation  RParen,
TypeSourceInfo TSI 
)

◆ checkAllowedSYCLInitializer()

bool SemaSYCL::checkAllowedSYCLInitializer ( VarDecl VD)

◆ checkSYCLDeviceVarDecl()

void SemaSYCL::checkSYCLDeviceVarDecl ( VarDecl Var)

◆ CheckSYCLKernelCall()

void SemaSYCL::CheckSYCLKernelCall ( FunctionDecl CallerFunc,
ArrayRef< const Expr * >  Args 
)

◆ ConstructOpenCLKernel()

void SemaSYCL::ConstructOpenCLKernel ( FunctionDecl KernelCallerFunc,
MangleContext MC 
)

◆ copySYCLKernelAttrs()

void SemaSYCL::copySYCLKernelAttrs ( CXXMethodDecl CallOperator)

◆ deepTypeCheckForDevice()

void SemaSYCL::deepTypeCheckForDevice ( SourceLocation  UsedAt,
llvm::DenseSet< QualType Visited,
ValueDecl DeclToCheck 
)

◆ DiagIfDeviceCode()

Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device code".

  • If CurLexicalContext is a kernel function or it is known that the function will be emitted for the device, emits the diagnostics immediately.
  • If CurLexicalContext is a function and we are compiling for the device, but we don't know that this function will be codegen'ed for device yet, creates a diagnostic which is emitted if and when we realize that the function will be codegen'ed.

Example usage:

Diagnose __float128 type usage only from SYCL device code if the current target doesn't support it if (!S.Context.getTargetInfo().hasFloat128Type() && S.getLangOpts().SYCLIsDevice) DiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";

Definition at line 5361 of file SemaSYCL.cpp.

References clang::Sema::Emitted, clang::Sema::getCurLexicalContext(), clang::Sema::getEmissionReason(), clang::Sema::getEmissionStatus(), clang::SemaBase::getLangOpts(), clang::SemaBase::SemaDiagnosticBuilder::K_Deferred, clang::SemaBase::SemaDiagnosticBuilder::K_ImmediateWithCallStack, clang::SemaBase::SemaDiagnosticBuilder::K_Nop, Loc, clang::SemaBase::None, and clang::SemaBase::SemaRef.

Referenced by deepTypeCheckForDevice().

◆ finalizeSYCLDelayedAnalysis()

void SemaSYCL::finalizeSYCLDelayedAnalysis ( const FunctionDecl Caller,
const FunctionDecl Callee,
SourceLocation  Loc,
DeviceDiagnosticReason  Reason 
)

◆ getSyclIntegrationFooter()

SYCLIntegrationFooter& clang::SemaSYCL::getSyclIntegrationFooter ( )
inline

◆ getSyclIntegrationHeader()

SYCLIntegrationHeader& clang::SemaSYCL::getSyclIntegrationHeader ( )
inline

Lazily creates and returns SYCL integration header instance.

Definition at line 279 of file SemaSYCL.h.

Referenced by clang::Sema::ActOnEndOfTranslationUnitFragment(), ConstructFreeFunctionKernel(), ConstructOpenCLKernel(), and SetSYCLKernelNames().

◆ hasSyclIntegrationFooter()

bool clang::SemaSYCL::hasSyclIntegrationFooter ( )
inline

Definition at line 297 of file SemaSYCL.h.

◆ hasSyclIntegrationHeader()

bool clang::SemaSYCL::hasSyclIntegrationHeader ( )
inline

Definition at line 296 of file SemaSYCL.h.

◆ isDeclAllowedInSYCLDeviceCode()

bool SemaSYCL::isDeclAllowedInSYCLDeviceCode ( const Decl D)

◆ isSYCLEsimdPrivateGlobal()

bool clang::SemaSYCL::isSYCLEsimdPrivateGlobal ( VarDecl VDecl)
inline

Tells whether given variable is a SYCL explicit SIMD extension's "private global" variable - global variable in the private address space.

Definition at line 356 of file SemaSYCL.h.

References clang::QualType::getAddressSpace(), clang::SemaBase::getLangOpts(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::VarDecl::hasGlobalStorage(), and clang::sycl_private.

◆ isSyclType()

bool SemaSYCL::isSyclType ( QualType  Ty,
SYCLTypeAttr::SYCLType  TypeName 
)
static

◆ isTypeDecoratedWithDeclAttribute()

template<typename AttrTy >
static bool clang::SemaSYCL::isTypeDecoratedWithDeclAttribute ( QualType  Ty)
inlinestatic

◆ MarkDevices()

void SemaSYCL::MarkDevices ( )

◆ ProcessFreeFunction()

void SemaSYCL::ProcessFreeFunction ( FunctionDecl FD)

Definition at line 5334 of file SemaSYCL.cpp.

References ConstructFreeFunctionKernel(), and isFreeFunction().

◆ SetSYCLKernelNames()

void SemaSYCL::SetSYCLKernelNames ( )

◆ syclDeviceDecls()

llvm::SetVector<Decl *>& clang::SemaSYCL::syclDeviceDecls ( )
inline

Definition at line 276 of file SemaSYCL.h.

Referenced by MarkDevices().


The documentation for this class was generated from the following files: