Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:04

0001 //===----- SemaARM.h ------- ARM target-specific routines -----*- C++ -*---===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 /// This file declares semantic analysis functions specific to ARM.
0010 ///
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_SEMA_SEMAARM_H
0014 #define LLVM_CLANG_SEMA_SEMAARM_H
0015 
0016 #include "clang/AST/DeclBase.h"
0017 #include "clang/AST/Expr.h"
0018 #include "clang/Basic/TargetInfo.h"
0019 #include "clang/Sema/SemaBase.h"
0020 #include "llvm/ADT/StringRef.h"
0021 #include <tuple>
0022 
0023 namespace llvm {
0024 template <typename T, unsigned N> class SmallVector;
0025 } // namespace llvm
0026 
0027 namespace clang {
0028 class ParsedAttr;
0029 class TargetInfo;
0030 
0031 class SemaARM : public SemaBase {
0032 public:
0033   SemaARM(Sema &S);
0034 
0035   enum ArmStreamingType {
0036     ArmNonStreaming, /// Intrinsic is only available in normal mode
0037     ArmStreaming,    /// Intrinsic is only available in Streaming-SVE mode.
0038     ArmStreamingCompatible, /// Intrinsic is available both in normal and
0039                             /// Streaming-SVE mode.
0040     VerifyRuntimeMode       /// Intrinsic is available in normal mode with
0041                             /// SVE flags, or in Streaming-SVE mode with SME
0042                             /// flags. Do Sema checks for the runtime mode.
0043   };
0044 
0045   bool CheckImmediateArg(CallExpr *TheCall, unsigned CheckTy, unsigned ArgIdx,
0046                          unsigned EltBitWidth, unsigned VecBitWidth);
0047   bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
0048                                     unsigned MaxWidth);
0049   bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
0050                                     CallExpr *TheCall);
0051   bool PerformNeonImmChecks(
0052       CallExpr *TheCall,
0053       SmallVectorImpl<std::tuple<int, int, int, int>> &ImmChecks,
0054       int OverloadType = -1);
0055   bool
0056   PerformSVEImmChecks(CallExpr *TheCall,
0057                       SmallVectorImpl<std::tuple<int, int, int>> &ImmChecks);
0058   bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
0059   bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
0060   bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
0061   bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
0062                                    CallExpr *TheCall);
0063   bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
0064                                     bool WantCDE);
0065   bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
0066                                    CallExpr *TheCall);
0067 
0068   bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
0069                                        CallExpr *TheCall);
0070   bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum,
0071                             unsigned ExpectedFieldNum, bool AllowName);
0072   bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
0073 
0074   bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
0075   bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
0076   bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
0077   bool SmeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
0078   void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL);
0079   void handleNewAttr(Decl *D, const ParsedAttr &AL);
0080   void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL);
0081   void handleInterruptAttr(Decl *D, const ParsedAttr &AL);
0082 
0083   void CheckSMEFunctionDefAttributes(const FunctionDecl *FD);
0084 };
0085 
0086 SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD);
0087 
0088 } // namespace clang
0089 
0090 #endif // LLVM_CLANG_SEMA_SEMAARM_H