-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Introduce
SemaRISCV
(#92682)
This patch moves `Sema` functions that are specific for RISC-V into the new `SemaRISCV` class. This continues previous efforts to split `Sema` up. Additional context can be found in #84184. This PR is somewhat different from previous PRs on this topic: 1. Splitting out target-specific functions wasn't previously discussed. It felt quite natural to do, though. 2. I had to make some static function in `SemaChecking.cpp` member functions of `Sema` in order to use them in `SemaRISCV`. 3. I dropped "RISCV" from identifiers, but decided to leave "RVV" (RISC-V "V" vector extensions) intact. I think it's an idiomatic abbreviation at this point, but I'm open to input from contributors in that area. 4. I repurposed `SemaRISCVVectorLookup.cpp` for `SemaRISCV`. I think this was a successful experiment, which both helps the goal of splitting `Sema` up, and shows a way to approach `SemaChecking.cpp`, which I wasn't sure how to approach before. As we move more target-specific function out of there, we'll gradually make the checking "framework" inside `SemaChecking.cpp` public, which is currently a whole bunch of static functions. This would enable us to move more functions outside of `SemaChecking.cpp`.
- Loading branch information
Showing
10 changed files
with
1,104 additions
and
1,051 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//===----- SemaRISCV.h ---- RISC-V target-specific routines ---*- C++ -*---===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// \file | ||
/// This file declares semantic analysis functions specific to RISC-V. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_SEMA_SEMARISCV_H | ||
#define LLVM_CLANG_SEMA_SEMARISCV_H | ||
|
||
#include "clang/AST/DeclBase.h" | ||
#include "clang/AST/Expr.h" | ||
#include "clang/AST/Type.h" | ||
#include "clang/Basic/SourceLocation.h" | ||
#include "clang/Basic/TargetInfo.h" | ||
#include "clang/Sema/RISCVIntrinsicManager.h" | ||
#include "clang/Sema/SemaBase.h" | ||
#include "llvm/ADT/StringMap.h" | ||
#include <memory> | ||
|
||
namespace clang { | ||
class SemaRISCV : public SemaBase { | ||
public: | ||
SemaRISCV(Sema &S); | ||
|
||
bool CheckLMUL(CallExpr *TheCall, unsigned ArgNum); | ||
bool CheckBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, | ||
CallExpr *TheCall); | ||
void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D, | ||
const llvm::StringMap<bool> &FeatureMap); | ||
|
||
bool isValidRVVBitcast(QualType srcType, QualType destType); | ||
|
||
/// Indicate RISC-V vector builtin functions enabled or not. | ||
bool DeclareRVVBuiltins = false; | ||
|
||
/// Indicate RISC-V SiFive vector builtin functions enabled or not. | ||
bool DeclareSiFiveVectorBuiltins = false; | ||
|
||
std::unique_ptr<sema::RISCVIntrinsicManager> IntrinsicManager; | ||
}; | ||
|
||
std::unique_ptr<sema::RISCVIntrinsicManager> | ||
CreateRISCVIntrinsicManager(Sema &S); | ||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_SEMA_SEMARISCV_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.