1 //===----- SemaARM.h ------- ARM 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 ARM. 10 /// 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_CLANG_SEMA_SEMAARM_H 14 #define LLVM_CLANG_SEMA_SEMAARM_H 15 16 #include "clang/AST/DeclBase.h" 17 #include "clang/AST/Expr.h" 18 #include "clang/Basic/TargetInfo.h" 19 #include "clang/Sema/SemaBase.h" 20 #include "llvm/ADT/StringRef.h" 21 #include <tuple> 22 23 namespace llvm { 24 template <typename T, unsigned N> class SmallVector; 25 } // namespace llvm 26 27 namespace clang { 28 class ParsedAttr; 29 class TargetInfo; 30 31 class SemaARM : public SemaBase { 32 public: 33 SemaARM(Sema &S); 34 35 enum ArmStreamingType { 36 ArmNonStreaming, /// Intrinsic is only available in normal mode 37 ArmStreaming, /// Intrinsic is only available in Streaming-SVE mode. 38 ArmStreamingCompatible, /// Intrinsic is available both in normal and 39 /// Streaming-SVE mode. 40 VerifyRuntimeMode /// Intrinsic is available in normal mode with 41 /// SVE flags, or in Streaming-SVE mode with SME 42 /// flags. Do Sema checks for the runtime mode. 43 }; 44 45 bool CheckImmediateArg(CallExpr *TheCall, unsigned CheckTy, unsigned ArgIdx, 46 unsigned EltBitWidth, unsigned VecBitWidth); 47 bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall, 48 unsigned MaxWidth); 49 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 50 CallExpr *TheCall); 51 bool PerformNeonImmChecks( 52 CallExpr *TheCall, 53 SmallVectorImpl<std::tuple<int, int, int, int>> &ImmChecks, 54 int OverloadType = -1); 55 bool 56 PerformSVEImmChecks(CallExpr *TheCall, 57 SmallVectorImpl<std::tuple<int, int, int>> &ImmChecks); 58 bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); 59 bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); 60 bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); 61 bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 62 CallExpr *TheCall); 63 bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg, 64 bool WantCDE); 65 bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 66 CallExpr *TheCall); 67 68 bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 69 CallExpr *TheCall); 70 bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum, 71 unsigned ExpectedFieldNum, bool AllowName); 72 bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall); 73 74 bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName); 75 bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName); 76 bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName); 77 bool SmeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName); 78 void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL); 79 void handleNewAttr(Decl *D, const ParsedAttr &AL); 80 void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL); 81 void handleInterruptAttr(Decl *D, const ParsedAttr &AL); 82 83 void CheckSMEFunctionDefAttributes(const FunctionDecl *FD); 84 }; 85 86 SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD); 87 88 } // namespace clang 89 90 #endif // LLVM_CLANG_SEMA_SEMAARM_H 91