clang
19.0.0git
|
#include "clang/Sema/SemaSYCL.h"
#include "TreeTransform.h"
#include "clang/AST/AST.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/QualTypeNames.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/TemplateArgumentVisitor.h"
#include "clang/AST/TypeVisitor.h"
#include "clang/Analysis/CallGraph.h"
#include "clang/Basic/Attributes.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <array>
#include <functional>
#include <initializer_list>
Go to the source code of this file.
Classes | |
class | DiagDeviceFunction |
class | DeviceFunctionTracker |
class | SingleDeviceFunctionTracker |
class | KernelBodyTransform |
class | MarkWIScopeFnVisitor |
class | SYCLKernelNameTypeVisitor |
class | SYCLFwdDeclEmitter |
class | SYCLKernelNameTypePrinter |
Macros | |
#define | KF_FOR_EACH(FUNC, Item, Qt) |
#define | KP_FOR_EACH(FUNC, Item, Qt) |
#define | CASE(x) |
Typedefs | |
using | KernelParamKind = SYCLIntegrationHeader::kernel_param_kind_t |
using | ParamDesc = std::tuple< QualType, IdentifierInfo *, TypeSourceInfo * > |
Enumerations | |
enum | target { global_buffer = 2014 , constant_buffer , local , image , host_buffer , host_image , image_array } |
enum | KernelInvocationKind { InvokeUnknown , InvokeSingleTask , InvokeParallelFor , InvokeParallelForWorkGroup } |
Functions | |
static bool | isSyclAccessorType (QualType Ty) |
static bool | isAccessorPropertyType (QualType Ty, SYCLTypeAttr::SYCLType TypeName) |
static bool | isSyclSpecialType (QualType Ty, SemaSYCL &S) |
static bool | IsSyclMathFunc (unsigned BuiltinID) |
static bool | isZeroSizedArray (SemaSYCL &S, QualType Ty) |
static void | checkSYCLType (SemaSYCL &S, QualType Ty, SourceRange Loc, llvm::DenseSet< QualType > Visited, SourceRange UsedAtLoc=SourceRange()) |
static bool | isSYCLKernelBodyFunction (FunctionDecl *FD) |
static bool | isSYCLUndefinedAllowed (const FunctionDecl *Callee, const SourceManager &SrcMgr) |
static void | reportConflictingAttrs (SemaSYCL &S, FunctionDecl *F, const Attr *A1, const Attr *A2) |
static int64_t | getIntExprValue (const Expr *E, ASTContext &Ctx) |
Returns the signed constant integer value represented by given expression. More... | |
static void | collectSYCLAttributes (SemaSYCL &S, FunctionDecl *FD, llvm::SmallVectorImpl< Attr * > &Attrs, bool DirectlyCalled) |
static bool | isDeclaredInSYCLNamespace (const Decl *D) |
This function checks whether given DeclContext contains a topmost namespace with name "sycl". More... | |
static ParamDesc | makeParamDesc (const FieldDecl *Src, QualType Ty) |
Creates a kernel parameter descriptor. More... | |
static ParamDesc | makeParamDesc (const ParmVarDecl *Src, QualType Ty) |
static ParamDesc | makeParamDesc (ASTContext &Ctx, StringRef Name, QualType Ty) |
static void | unsupportedFreeFunctionParamType () |
static bool | isSYCLPrivateMemoryVar (VarDecl *VD) |
static void | addScopeAttrToLocalVars (CXXMethodDecl &F) |
static CXXMethodDecl * | getMethodByName (const CXXRecordDecl *CRD, StringRef MethodName) |
Return method by name. More... | |
static KernelInvocationKind | getKernelInvocationKind (FunctionDecl *KernelCallerFunc) |
static QualType | GetSYCLKernelObjectType (const FunctionDecl *KernelCaller) |
static target | getAccessTarget (QualType FieldTy, const ClassTemplateSpecializationDecl *AccTy) |
static bool | isFreeFunction (SemaSYCL &SemaSYCLRef, const FunctionDecl *FD) |
static std::pair< std::string, std::string > | constructFreeFunctionKernelName (SemaSYCL &SemaSYCLRef, const FunctionDecl *FreeFunc, MangleContext &MC) |
static QualType | calculateKernelNameType (ASTContext &Ctx, const FunctionDecl *KernelCallerFunc) |
static std::pair< std::string, std::string > | constructKernelName (SemaSYCL &S, const FunctionDecl *KernelCallerFunc, MangleContext &MC) |
static bool | isDefaultSPIRArch (ASTContext &Context) |
static ParmVarDecl * | getSyclKernelHandlerArg (FunctionDecl *KernelCallerFunc) |
static bool | isReadOnlyAccessor (const TemplateArgument &AccessModeArg) |
void | ConstructFreeFunctionKernel (SemaSYCL &SemaSYCLRef, FunctionDecl *FD) |
static std::pair< LangOptions::SubGroupSizeType, int64_t > | CalcEffectiveSubGroup (ASTContext &Ctx, const LangOptions &LO, const FunctionDecl *FD) |
static SourceLocation | GetSubGroupLoc (const FunctionDecl *FD) |
static void | CheckSYCL2020SubGroupSizes (SemaSYCL &S, FunctionDecl *SYCLKernel, const FunctionDecl *FD) |
static void | CheckSYCL2020Attributes (SemaSYCL &S, FunctionDecl *SYCLKernel, FunctionDecl *KernelBody, const llvm::SmallPtrSetImpl< FunctionDecl * > &CalledFuncs) |
static void | PropagateAndDiagnoseDeviceAttr (SemaSYCL &S, const SingleDeviceFunctionTracker &Tracker, Attr *A, FunctionDecl *SYCLKernel, FunctionDecl *KernelBody) |
static const char * | paramKind2Str (KernelParamKind K) |
Returns a string ID of given parameter kind - used in header emission. More... | |
static void | OutputStableNameChar (raw_ostream &O, char C) |
static void | OutputStableNameInChars (raw_ostream &O, StringRef Name) |
template<typename BeforeFn , typename AfterFn > | |
static void | PrintNSHelper (BeforeFn Before, AfterFn After, raw_ostream &OS, const DeclContext *DC) |
static void | PrintNamespaces (raw_ostream &OS, const DeclContext *DC) |
static void | PrintNSClosingBraces (raw_ostream &OS, const DeclContext *DC) |
static std::string | EmitShim (raw_ostream &OS, unsigned &ShimCounter, const std::string &LastShim, const NamespaceDecl *AnonNS) |
static void | EmitShims (raw_ostream &OS, unsigned &ShimCounter, const DeclContext *DC, std::string &NameForLastShim, PrintingPolicy &Policy) |
static std::string | EmitShims (raw_ostream &OS, unsigned &ShimCounter, PrintingPolicy &Policy, const VarDecl *VD) |
Variables | |
static constexpr llvm::StringLiteral | InitMethodName = "__init" |
static constexpr llvm::StringLiteral | InitESIMDMethodName = "__init_esimd" |
static constexpr llvm::StringLiteral | InitSpecConstantsBuffer |
static constexpr llvm::StringLiteral | FinalizeMethodName = "__finalize" |
static constexpr llvm::StringLiteral | LibstdcxxFailedAssertion |
constexpr unsigned | MaxKernelArgsSize = 2048 |
#define CASE | ( | x | ) |
#define KF_FOR_EACH | ( | FUNC, | |
Item, | |||
Qt | |||
) |
Definition at line 1253 of file SemaSYCL.cpp.
#define KP_FOR_EACH | ( | FUNC, | |
Item, | |||
Qt | |||
) |
Definition at line 1276 of file SemaSYCL.cpp.
Definition at line 43 of file SemaSYCL.cpp.
using ParamDesc = std::tuple<QualType, IdentifierInfo *, TypeSourceInfo *> |
Definition at line 55 of file SemaSYCL.cpp.
enum KernelInvocationKind |
Enumerator | |
---|---|
InvokeUnknown | |
InvokeSingleTask | |
InvokeParallelFor | |
InvokeParallelForWorkGroup |
Definition at line 57 of file SemaSYCL.cpp.
enum target |
Enumerator | |
---|---|
global_buffer | |
constant_buffer | |
local | |
image | |
host_buffer | |
host_image | |
image_array |
Definition at line 45 of file SemaSYCL.cpp.
|
static |
Definition at line 1006 of file SemaSYCL.cpp.
References clang::Decl::addAttr(), clang::DeclContext::decls(), clang::Decl::getASTContext(), clang::VarDecl::getStorageDuration(), isSYCLPrivateMemoryVar(), and clang::SD_Automatic.
|
static |
Definition at line 5055 of file SemaSYCL.cpp.
References clang::LangOptionsBase::Auto, clang::Decl::getAttr(), getIntExprValue(), clang::LangOptionsBase::Integer, and clang::LangOptionsBase::Primary.
|
static |
Definition at line 1132 of file SemaSYCL.cpp.
References clang::TemplateArgumentList::get(), clang::TemplateArgument::getAsType(), clang::QualType::getCanonicalType(), and clang::FunctionDecl::getTemplateSpecializationArgs().
Referenced by clang::SemaSYCL::CheckSYCLKernelCall(), and clang::SemaSYCL::ConstructOpenCLKernel().
|
static |
Definition at line 5133 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::MarkDevices().
|
static |
Definition at line 5081 of file SemaSYCL.cpp.
|
static |
Definition at line 405 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::checkSYCLDeviceVarDecl().
|
static |
Definition at line 527 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::copySYCLKernelAttrs().
void ConstructFreeFunctionKernel | ( | SemaSYCL & | SemaSYCLRef, |
FunctionDecl * | FD | ||
) |
Definition at line 5032 of file SemaSYCL.cpp.
References clang::Decl::getLocation(), clang::SemaSYCL::getSyclIntegrationFooter(), clang::SemaSYCL::getSyclIntegrationHeader(), clang::ValueDecl::getType(), and clang::FunctionDecl::isInlined().
Referenced by clang::SemaSYCL::ProcessFreeFunction().
|
static |
Definition at line 1110 of file SemaSYCL.cpp.
References clang::MangleContext::mangleName().
Referenced by clang::SemaSYCL::SetSYCLKernelNames().
|
static |
Definition at line 1143 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::ConstructOpenCLKernel(), and clang::SemaSYCL::SetSYCLKernelNames().
|
static |
Definition at line 6347 of file SemaSYCL.cpp.
References clang::Decl::castToDeclContext(), PrintNamespaces(), and PrintNSClosingBraces().
Referenced by EmitShims().
|
static |
Definition at line 6367 of file SemaSYCL.cpp.
References EmitShim(), clang::NamedDecl::getNameAsString(), and clang::DeclContext::isTranslationUnit().
Referenced by EmitShims().
|
static |
Definition at line 6410 of file SemaSYCL.cpp.
References EmitShims(), clang::Decl::getDeclContext(), clang::NamedDecl::getNameForDiagnostic(), and clang::Decl::isInAnonymousNamespace().
|
static |
Definition at line 1064 of file SemaSYCL.cpp.
References clang::ClassTemplateSpecializationDecl::getTemplateArgs(), clang::SemaSYCL::isSyclType(), and local.
|
static |
Returns the signed constant integer value represented by given expression.
Definition at line 522 of file SemaSYCL.cpp.
References clang::Expr::getIntegerConstantExpr().
Referenced by CalcEffectiveSubGroup().
|
static |
Definition at line 1039 of file SemaSYCL.cpp.
References clang::NamedDecl::getName(), InvokeParallelFor, InvokeParallelForWorkGroup, InvokeSingleTask, and InvokeUnknown.
|
static |
Return method by name.
Definition at line 1027 of file SemaSYCL.cpp.
References clang::CXXRecordDecl::methods().
|
static |
Definition at line 5073 of file SemaSYCL.cpp.
References clang::Decl::getAttr().
|
static |
Definition at line 1181 of file SemaSYCL.cpp.
References clang::SemaSYCL::isSyclType(), clang::FunctionDecl::param_end(), and clang::FunctionDecl::parameters().
Referenced by clang::SemaSYCL::ConstructOpenCLKernel().
|
static |
Definition at line 1051 of file SemaSYCL.cpp.
References clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Type::getPointeeType(), clang::ValueDecl::getType(), clang::QualType::getUnqualifiedType(), and clang::Type::isReferenceType().
Referenced by clang::SemaSYCL::CheckSYCLKernelCall(), and clang::SemaSYCL::ConstructOpenCLKernel().
Definition at line 99 of file SemaSYCL.cpp.
References clang::Type::getAsCXXRecordDecl(), Parent, and clang::TypeName.
This function checks whether given DeclContext contains a topmost namespace with name "sycl".
Definition at line 738 of file SemaSYCL.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), and Parent.
|
static |
Definition at line 1174 of file SemaSYCL.cpp.
|
static |
Definition at line 1077 of file SemaSYCL.cpp.
References clang::SemaBase::getASTContext(), clang::FunctionDecl::getReturnType(), clang::Type::isVoidType(), and clang::Decl::specific_attrs().
Referenced by clang::SemaSYCL::ProcessFreeFunction(), and clang::SemaSYCL::SetSYCLKernelNames().
|
static |
Definition at line 1196 of file SemaSYCL.cpp.
References clang::Type::castAs(), clang::TemplateArgument::getAsIntegral(), and clang::TemplateArgument::getIntegralType().
Definition at line 90 of file SemaSYCL.cpp.
References clang::SemaSYCL::isSyclType().
|
static |
Definition at line 487 of file SemaSYCL.cpp.
References clang::FunctionDecl::getOverloadedOperator().
Referenced by clang::SemaSYCL::copySYCLKernelAttrs().
Definition at line 320 of file SemaSYCL.cpp.
Referenced by DiagDeviceFunction::VisitCallExpr().
Definition at line 1002 of file SemaSYCL.cpp.
References clang::ValueDecl::getType(), and clang::SemaSYCL::isSyclType().
Referenced by addScopeAttrToLocalVars().
Definition at line 109 of file SemaSYCL.cpp.
|
static |
Definition at line 491 of file SemaSYCL.cpp.
References clang::SourceManager::isInSystemHeader(), and LibstdcxxFailedAssertion.
Referenced by clang::SemaSYCL::finalizeSYCLDelayedAnalysis().
Definition at line 399 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::deepTypeCheckForDevice().
|
static |
Definition at line 964 of file SemaSYCL.cpp.
Creates a kernel parameter descriptor.
Src | field declaration to construct name from |
Ty | the desired parameter type |
Definition at line 951 of file SemaSYCL.cpp.
References clang::Decl::getASTContext().
|
static |
Definition at line 957 of file SemaSYCL.cpp.
References clang::Decl::getASTContext().
|
static |
Definition at line 5912 of file SemaSYCL.cpp.
|
static |
Definition at line 5921 of file SemaSYCL.cpp.
Referenced by clang::SYCLIntegrationHeader::emit().
|
static |
Returns a string ID of given parameter kind - used in header emission.
Definition at line 5533 of file SemaSYCL.cpp.
References CASE.
Referenced by clang::SYCLIntegrationHeader::emit().
|
static |
Definition at line 6318 of file SemaSYCL.cpp.
References clang::NamedDecl::getName(), clang::NamespaceDecl::isAnonymousNamespace(), clang::NamespaceDecl::isInline(), and PrintNSHelper().
Referenced by EmitShim().
|
static |
Definition at line 6331 of file SemaSYCL.cpp.
References clang::NamedDecl::getName(), clang::if(), clang::NamespaceDecl::isAnonymousNamespace(), clang::NamespaceDecl::isInline(), and PrintNSHelper().
Referenced by EmitShim().
|
static |
Definition at line 6293 of file SemaSYCL.cpp.
References clang::frontend::After, and clang::DeclContext::isTranslationUnit().
Referenced by PrintNamespaces(), and PrintNSClosingBraces().
|
static |
Definition at line 5179 of file SemaSYCL.cpp.
Referenced by clang::SemaSYCL::MarkDevices().
|
static |
Definition at line 513 of file SemaSYCL.cpp.
|
static |
Definition at line 969 of file SemaSYCL.cpp.
|
staticconstexpr |
Definition at line 68 of file SemaSYCL.cpp.
|
staticconstexpr |
Definition at line 65 of file SemaSYCL.cpp.
|
staticconstexpr |
Definition at line 64 of file SemaSYCL.cpp.
|
staticconstexpr |
Definition at line 66 of file SemaSYCL.cpp.
|
staticconstexpr |
Definition at line 69 of file SemaSYCL.cpp.
Referenced by isSYCLUndefinedAllowed().
|
constexpr |
Definition at line 71 of file SemaSYCL.cpp.