xref: /freebsd/contrib/llvm-project/clang/include/clang/Sema/SemaARM.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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/SmallVector.h"
21  #include <tuple>
22  
23  namespace clang {
24  class ParsedAttr;
25  
26  class SemaARM : public SemaBase {
27  public:
28    SemaARM(Sema &S);
29  
30    enum ArmStreamingType {
31      ArmNonStreaming, /// Intrinsic is only available in normal mode
32      ArmStreaming,    /// Intrinsic is only available in Streaming-SVE mode.
33      ArmStreamingCompatible, /// Intrinsic is available both in normal and
34                              /// Streaming-SVE mode.
35      VerifyRuntimeMode       /// Intrinsic is available in normal mode with
36                              /// SVE flags, or in Streaming-SVE mode with SME
37                              /// flags. Do Sema checks for the runtime mode.
38    };
39  
40    bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
41                                      unsigned MaxWidth);
42    bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
43                                      CallExpr *TheCall);
44    bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
45    bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
46    bool
47    ParseSVEImmChecks(CallExpr *TheCall,
48                      llvm::SmallVector<std::tuple<int, int, int>, 3> &ImmChecks);
49    bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
50    bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
51                                     CallExpr *TheCall);
52    bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
53                                      bool WantCDE);
54    bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
55                                     CallExpr *TheCall);
56  
57    bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
58                                         CallExpr *TheCall);
59    bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum,
60                              unsigned ExpectedFieldNum, bool AllowName);
61    bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
62  
63    bool MveAliasValid(unsigned BuiltinID, StringRef AliasName);
64    bool CdeAliasValid(unsigned BuiltinID, StringRef AliasName);
65    bool SveAliasValid(unsigned BuiltinID, StringRef AliasName);
66    bool SmeAliasValid(unsigned BuiltinID, StringRef AliasName);
67    void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL);
68    void handleNewAttr(Decl *D, const ParsedAttr &AL);
69    void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL);
70    void handleInterruptAttr(Decl *D, const ParsedAttr &AL);
71  };
72  
73  SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD);
74  
75  } // namespace clang
76  
77  #endif // LLVM_CLANG_SEMA_SEMAARM_H
78