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