clang 24.0.0git
SemaARM.h
Go to the documentation of this file.
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"
19#include "clang/Sema/SemaBase.h"
20#include "llvm/ADT/StringRef.h"
21#include <tuple>
22
23namespace llvm {
24template <typename T, unsigned N> class SmallVector;
25} // namespace llvm
26
27namespace clang {
28class ParsedAttr;
29class TargetInfo;
30
31class SemaARM : public SemaBase {
32public:
33 SemaARM(Sema &S);
34
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(const TargetInfo &TI, unsigned BuiltinID,
48 CallExpr *TheCall);
49 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
50 CallExpr *TheCall);
52 CallExpr *TheCall,
53 SmallVectorImpl<std::tuple<int, int, int, int>> &ImmChecks,
54 int OverloadType = -1);
55 bool
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 bool BuiltinARMAtomicStoreHintCall(unsigned BuiltinID, CallExpr *TheCall);
74
75 bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
76 bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
77 bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
78 bool SmeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName);
79 void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL);
80 void handleNewAttr(Decl *D, const ParsedAttr &AL);
81 void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL);
82 void handleInterruptAttr(Decl *D, const ParsedAttr &AL);
83 void handleInterruptSaveFPAttr(Decl *D, const ParsedAttr &AL);
84
86
87 /// Return true if the given types are an SVE builtin and a VectorType that
88 /// is a fixed-length representation of the SVE builtin for a specific
89 /// vector-length.
90 bool areCompatibleSveTypes(QualType FirstType, QualType SecondType);
91
92 /// Return true if the given vector types are lax-compatible SVE vector types,
93 /// false otherwise.
94 bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType);
95
96 bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc,
97 SmallString<64> &NewParam);
100 SmallVectorImpl<SmallString<64>> &NewParams);
102 const FunctionDecl *FD,
103 const llvm::StringMap<bool> &FeatureMap);
104};
105
107
108} // namespace clang
109
110#endif // LLVM_CLANG_SEMA_SEMAARM_H
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2987
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
This represents one expression.
Definition Expr.h:113
Represents a function declaration or definition.
Definition Decl.h:2059
ParsedAttr - Represents a syntactic attribute.
Definition ParsedAttr.h:119
A (possibly-)qualified type.
Definition TypeBase.h:938
void CheckSMEFunctionDefAttributes(const FunctionDecl *FD)
Definition SemaARM.cpp:1595
bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:1159
bool BuiltinARMAtomicStoreHintCall(unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:326
void handleInterruptSaveFPAttr(Decl *D, const ParsedAttr &AL)
Definition SemaARM.cpp:1570
bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:774
bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg, bool WantCDE)
Definition SemaARM.cpp:958
bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:815
bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:844
bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:942
bool PerformNeonImmChecks(CallExpr *TheCall, SmallVectorImpl< std::tuple< int, int, int, int > > &ImmChecks, int OverloadType=-1)
Definition SemaARM.cpp:645
bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:933
void handleInterruptAttr(Decl *D, const ParsedAttr &AL)
Definition SemaARM.cpp:1538
bool PerformSVEImmChecks(CallExpr *TheCall, SmallVectorImpl< std::tuple< int, int, int > > &ImmChecks)
Definition SemaARM.cpp:664
void handleBuiltinAliasAttr(Decl *D, const ParsedAttr &AL)
Definition SemaARM.cpp:1423
@ ArmStreaming
Intrinsic is only available in normal mode.
Definition SemaARM.h:37
@ VerifyRuntimeMode
Intrinsic is available both in normal and Streaming-SVE mode.
Definition SemaARM.h:40
@ ArmStreamingCompatible
Intrinsic is only available in Streaming-SVE mode.
Definition SemaARM.h:38
void handleNewAttr(Decl *D, const ParsedAttr &AL)
Definition SemaARM.cpp:1470
bool CheckARMBuiltinExclusiveCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:983
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
Definition SemaARM.cpp:1665
bool checkTargetVersionAttr(const StringRef Param, const SourceLocation Loc, SmallString< 64 > &NewParam)
Definition SemaARM.cpp:1793
bool checkSVETypeSupport(QualType Ty, SourceLocation Loc, const FunctionDecl *FD, const llvm::StringMap< bool > &FeatureMap)
Definition SemaARM.cpp:1913
bool SveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
Definition SemaARM.cpp:1409
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
Definition SemaARM.cpp:1710
bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall)
Definition SemaARM.cpp:1242
bool MveAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
Definition SemaARM.cpp:1396
bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall)
BuiltinARMMemoryTaggingCall - Handle calls of memory tagging extensions.
Definition SemaARM.cpp:27
void handleCmseNSEntryAttr(Decl *D, const ParsedAttr &AL)
Definition SemaARM.cpp:1523
bool CheckImmediateArg(CallExpr *TheCall, unsigned CheckTy, unsigned ArgIdx, unsigned EltBitWidth, unsigned VecBitWidth)
Definition SemaARM.cpp:503
bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum, unsigned ExpectedFieldNum, bool AllowName)
BuiltinARMSpecialReg - Handle a check if argument ArgNum of CallExpr TheCall is an ARM/AArch64 specia...
Definition SemaARM.cpp:196
bool SmeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
Definition SemaARM.cpp:1416
bool checkTargetClonesAttr(SmallVectorImpl< StringRef > &Params, SmallVectorImpl< SourceLocation > &Locs, SmallVectorImpl< SmallString< 64 > > &NewParams)
Definition SemaARM.cpp:1827
bool CdeAliasValid(unsigned BuiltinID, llvm::StringRef AliasName)
Definition SemaARM.cpp:1404
SemaARM(Sema &S)
Definition SemaARM.cpp:24
SemaBase(Sema &S)
Definition SemaBase.cpp:7
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:863
Encodes a location in the source.
Exposes information about the current target.
Definition TargetInfo.h:226
Defines the clang::TargetInfo interface.
Top level wrappers for InstallAPI frontend operations.
SemaARM::ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD)
Definition SemaARM.cpp:677
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30