OrderIndex, ScopeIndex;
31assert(FD &&
"AMDGPU builtins should not be used outside of a function");
32llvm::StringMap<bool> CallerFeatureMap;
38 caseAMDGPU::BI__builtin_amdgcn_global_load_lds: {
39 constexpr const intSizeIdx = 2;
45 switch(Size.getSExtValue()) {
58diag::err_amdgcn_global_load_lds_size_invalid_value)
61diag::note_amdgcn_global_load_lds_size_valid_value)
66 caseAMDGPU::BI__builtin_amdgcn_get_fpenv:
67 caseAMDGPU::BI__builtin_amdgcn_set_fpenv:
69 caseAMDGPU::BI__builtin_amdgcn_atomic_inc32:
70 caseAMDGPU::BI__builtin_amdgcn_atomic_inc64:
71 caseAMDGPU::BI__builtin_amdgcn_atomic_dec32:
72 caseAMDGPU::BI__builtin_amdgcn_atomic_dec64:
76 caseAMDGPU::BI__builtin_amdgcn_fence:
80 caseAMDGPU::BI__builtin_amdgcn_mov_dpp:
82 caseAMDGPU::BI__builtin_amdgcn_mov_dpp8:
84 caseAMDGPU::BI__builtin_amdgcn_update_dpp: {
92 autoArgExpr = Arg.
get();
96 return Diag(ArgExpr->getExprLoc(), diag::err_typecheck_expect_int)
97<< ArgExpr->getType();
98 autoOrd = ArgResult.
Val.
getInt().getZExtValue();
102 if(!llvm::isValidAtomicOrderingCABI(Ord))
103 return Diag(ArgExpr->getBeginLoc(),
104diag::warn_atomic_op_has_invalid_memory_order)
105<< 0 << ArgExpr->getSourceRange();
106 switch(
static_cast<llvm::AtomicOrderingCABI
>(Ord)) {
107 casellvm::AtomicOrderingCABI::relaxed:
108 casellvm::AtomicOrderingCABI::consume:
109 if(BuiltinID == AMDGPU::BI__builtin_amdgcn_fence)
110 return Diag(ArgExpr->getBeginLoc(),
111diag::warn_atomic_op_has_invalid_memory_order)
112<< 0 << ArgExpr->getSourceRange();
114 casellvm::AtomicOrderingCABI::acquire:
115 casellvm::AtomicOrderingCABI::release:
116 casellvm::AtomicOrderingCABI::acq_rel:
117 casellvm::AtomicOrderingCABI::seq_cst:
121Arg = TheCall->
getArg(ScopeIndex);
122ArgExpr = Arg.
get();
125 if(!ArgExpr->EvaluateAsConstantExpr(ArgResult1,
getASTContext()))
126 return Diag(ArgExpr->getExprLoc(), diag::err_expr_not_string_literal)
127<< ArgExpr->getType();
133 unsignedNumDataArgs) {
134assert(NumDataArgs <= 2);
139 for(
unsignedI = 0; I != NumDataArgs; ++I) {
140Args[I] = TheCall->
getArg(I);
141ArgTys[I] = Args[I]->
getType();
143 if(!ArgTys[I]->isArithmeticType() || ArgTys[I]->isAnyComplexType()) {
145diag::err_typecheck_cond_expect_int_float)
153 if(
getASTContext().hasSameUnqualifiedType(ArgTys[0], ArgTys[1]))
156 if(((ArgTys[0]->isUnsignedIntegerType() &&
157ArgTys[1]->isSignedIntegerType()) ||
158(ArgTys[0]->isSignedIntegerType() &&
159ArgTys[1]->isUnsignedIntegerType())) &&
165diag::err_typecheck_call_different_arg_types)
166<< ArgTys[0] << ArgTys[1];
172 constAMDGPUFlatWorkGroupSizeAttr &
Attr) {
186 if(
Min== 0 &&
Max!= 0) {
200AMDGPUFlatWorkGroupSizeAttr *
204AMDGPUFlatWorkGroupSizeAttr TmpAttr(Context, CI, MinExpr, MaxExpr);
208return ::new (Context)
209AMDGPUFlatWorkGroupSizeAttr(Context, CI, MinExpr, MaxExpr);
229 constAMDGPUWavesPerEUAttr &
Attr) {
247 if(
Min== 0 &&
Max!= 0) {
261AMDGPUWavesPerEUAttr *
265AMDGPUWavesPerEUAttr TmpAttr(Context, CI, MinExpr, MaxExpr);
270return ::new (Context) AMDGPUWavesPerEUAttr(Context, CI, MinExpr, MaxExpr);
290uint32_t NumSGPR = 0;
300uint32_t NumVGPR = 0;
312 constAMDGPUMaxNumWorkGroupsAttr &
Attr) {
325 Expr*Exprs[3] = {XExpr, YExpr, ZExpr};
326 for(
inti = 0; i < 3; i++) {
345AMDGPUMaxNumWorkGroupsAttr TmpAttr(Context, CI, XExpr, YExpr, ZExpr);
351return ::new (Context)
352AMDGPUMaxNumWorkGroupsAttr(Context, CI, XExpr, YExpr, ZExpr);
This file declares semantic analysis functions specific to AMDGPU.
Enumerates target-specific builtins in their own namespaces within namespace clang.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
Attr - This represents one attribute.
SourceLocation getLocation() const
SourceLocation getLoc() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ParsedAttr - Represents a syntactic attribute.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
Expr * getArgAsExpr(unsigned Arg) const
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
A (possibly-)qualified type.
void handleAMDGPUMaxNumWorkGroupsAttr(Decl *D, const ParsedAttr &AL)
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
void handleAMDGPUFlatWorkGroupSizeAttr(Decl *D, const ParsedAttr &AL)
void handleAMDGPUNumSGPRAttr(Decl *D, const ParsedAttr &AL)
AMDGPUMaxNumWorkGroupsAttr * CreateAMDGPUMaxNumWorkGroupsAttr(const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
Create an AMDGPUMaxNumWorkGroupsAttr attribute.
AMDGPUWavesPerEUAttr * CreateAMDGPUWavesPerEUAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
void handleAMDGPUNumVGPRAttr(Decl *D, const ParsedAttr &AL)
AMDGPUFlatWorkGroupSizeAttr * CreateAMDGPUFlatWorkGroupSizeAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
bool checkMovDPPFunctionCall(CallExpr *TheCall, unsigned NumArgs, unsigned NumDataArgs)
void handleAMDGPUWavesPerEUAttr(Decl *D, const ParsedAttr &AL)
bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
void addAMDGPUMaxNumWorkGroupsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups attribute to a particular declarat...
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ASTContext & getASTContext() const
Sema - This implements semantic analysis and AST building for C.
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool checkUInt32Argument(const AttrInfo &AI, const Expr *Expr, uint32_t &Val, unsigned Idx=UINT_MAX, bool StrictlyUnsigned=false)
If Expr is a valid integer constant, get the value of the integer expression and return success or fa...
bool checkArgCountRange(CallExpr *Call, unsigned MinArgCount, unsigned MaxArgCount)
Checks that a call expression's argument count is in the desired range.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool evaluateRequiredTargetFeatures(llvm::StringRef RequiredFatures, const llvm::StringMap< bool > &TargetFetureMap)
Returns true if the required target features of a builtin function are enabled.
The JSON file list parser is used to communicate input to InstallAPI.
static bool checkAMDGPUMaxNumWorkGroupsArguments(Sema &S, Expr *XExpr, Expr *YExpr, Expr *ZExpr, const AMDGPUMaxNumWorkGroupsAttr &Attr)
static bool checkAMDGPUFlatWorkGroupSizeArguments(Sema &S, Expr *MinExpr, Expr *MaxExpr, const AMDGPUFlatWorkGroupSizeAttr &Attr)
static bool checkAMDGPUWavesPerEUArguments(Sema &S, Expr *MinExpr, Expr *MaxExpr, const AMDGPUWavesPerEUAttr &Attr)
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4