1 //===----- SemaAMDGPU.h --- AMDGPU target-specific routines ---*- C++ -*---===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 /// \file 9 /// This file declares semantic analysis functions specific to AMDGPU. 10 /// 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_CLANG_SEMA_SEMAAMDGPU_H 14 #define LLVM_CLANG_SEMA_SEMAAMDGPU_H 15 16 #include "clang/AST/Attr.h" 17 #include "clang/AST/DeclBase.h" 18 #include "clang/AST/Expr.h" 19 #include "clang/Basic/AttributeCommonInfo.h" 20 #include "clang/Sema/ParsedAttr.h" 21 #include "clang/Sema/SemaBase.h" 22 23 namespace clang { 24 class SemaAMDGPU : public SemaBase { 25 public: 26 SemaAMDGPU(Sema &S); 27 28 bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); 29 30 /// Create an AMDGPUWavesPerEUAttr attribute. 31 AMDGPUFlatWorkGroupSizeAttr * 32 CreateAMDGPUFlatWorkGroupSizeAttr(const AttributeCommonInfo &CI, Expr *Min, 33 Expr *Max); 34 35 /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size 36 /// attribute to a particular declaration. 37 void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, 38 Expr *Min, Expr *Max); 39 40 /// Create an AMDGPUWavesPerEUAttr attribute. 41 AMDGPUWavesPerEUAttr * 42 CreateAMDGPUWavesPerEUAttr(const AttributeCommonInfo &CI, Expr *Min, 43 Expr *Max); 44 45 /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a 46 /// particular declaration. 47 void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, 48 Expr *Min, Expr *Max); 49 50 /// Create an AMDGPUMaxNumWorkGroupsAttr attribute. 51 AMDGPUMaxNumWorkGroupsAttr * 52 CreateAMDGPUMaxNumWorkGroupsAttr(const AttributeCommonInfo &CI, Expr *XExpr, 53 Expr *YExpr, Expr *ZExpr); 54 55 /// addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups 56 /// attribute to a particular declaration. 57 void addAMDGPUMaxNumWorkGroupsAttr(Decl *D, const AttributeCommonInfo &CI, 58 Expr *XExpr, Expr *YExpr, Expr *ZExpr); 59 60 void handleAMDGPUWavesPerEUAttr(Decl *D, const ParsedAttr &AL); 61 void handleAMDGPUNumSGPRAttr(Decl *D, const ParsedAttr &AL); 62 void handleAMDGPUNumVGPRAttr(Decl *D, const ParsedAttr &AL); 63 void handleAMDGPUMaxNumWorkGroupsAttr(Decl *D, const ParsedAttr &AL); 64 void handleAMDGPUFlatWorkGroupSizeAttr(Decl *D, const ParsedAttr &AL); 65 }; 66 } // namespace clang 67 68 #endif // LLVM_CLANG_SEMA_SEMAAMDGPU_H 69