1 //===----- SemaRISCV.h ---- RISC-V 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 RISC-V. 10 /// 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_CLANG_SEMA_SEMARISCV_H 14 #define LLVM_CLANG_SEMA_SEMARISCV_H 15 16 #include "clang/AST/ASTFwd.h" 17 #include "clang/AST/Type.h" 18 #include "clang/Basic/SourceLocation.h" 19 #include "clang/Sema/SemaBase.h" 20 #include "llvm/ADT/StringMap.h" 21 #include "llvm/ADT/StringRef.h" 22 #include <memory> 23 24 namespace clang { 25 namespace sema { 26 class RISCVIntrinsicManager; 27 } // namespace sema 28 29 class ParsedAttr; 30 class TargetInfo; 31 32 class SemaRISCV : public SemaBase { 33 public: 34 SemaRISCV(Sema &S); 35 36 bool CheckLMUL(CallExpr *TheCall, unsigned ArgNum); 37 bool CheckBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, 38 CallExpr *TheCall); 39 void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D, 40 const llvm::StringMap<bool> &FeatureMap); 41 42 bool isValidRVVBitcast(QualType srcType, QualType destType); 43 44 void handleInterruptAttr(Decl *D, const ParsedAttr &AL); 45 bool isAliasValid(unsigned BuiltinID, llvm::StringRef AliasName); 46 bool isValidFMVExtension(StringRef Ext); 47 48 /// Indicate RISC-V vector builtin functions enabled or not. 49 bool DeclareRVVBuiltins = false; 50 51 /// Indicate RISC-V SiFive vector builtin functions enabled or not. 52 bool DeclareSiFiveVectorBuiltins = false; 53 54 std::unique_ptr<sema::RISCVIntrinsicManager> IntrinsicManager; 55 }; 56 57 std::unique_ptr<sema::RISCVIntrinsicManager> 58 CreateRISCVIntrinsicManager(Sema &S); 59 } // namespace clang 60 61 #endif // LLVM_CLANG_SEMA_SEMARISCV_H 62