19 #include "llvm/ADT/StringSwitch.h" 21 using namespace clang;
25 #define BUILTIN(ID, TYPE, ATTRS) \ 26 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, 27 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \ 28 {#ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES, nullptr}, 29 #include "clang/Basic/BuiltinsWebAssembly.def" 33 {
"mvp"}, {
"bleeding-edge"}, {
"generic"}};
35 bool WebAssemblyTargetInfo::hasFeature(StringRef Feature)
const {
36 return llvm::StringSwitch<bool>(Feature)
37 .Case(
"simd128", SIMDLevel >= SIMD128)
38 .Case(
"nontrapping-fptoint", HasNontrappingFPToInt)
39 .Case(
"sign-ext", HasSignExt)
40 .Case(
"exception-handling", HasExceptionHandling)
44 bool WebAssemblyTargetInfo::isValidCPUName(StringRef Name)
const {
48 void WebAssemblyTargetInfo::fillValidCPUList(
56 if (SIMDLevel >= SIMD128)
60 bool WebAssemblyTargetInfo::handleTargetFeatures(
62 for (
const auto &Feature : Features) {
63 if (Feature ==
"+simd128") {
64 SIMDLevel =
std::max(SIMDLevel, SIMD128);
67 if (Feature ==
"-simd128") {
68 SIMDLevel =
std::min(SIMDLevel, SIMDEnum(SIMD128 - 1));
71 if (Feature ==
"+nontrapping-fptoint") {
72 HasNontrappingFPToInt =
true;
75 if (Feature ==
"-nontrapping-fptoint") {
76 HasNontrappingFPToInt =
false;
79 if (Feature ==
"+sign-ext") {
83 if (Feature ==
"-sign-ext") {
87 if (Feature ==
"+exception-handling") {
88 HasExceptionHandling =
true;
91 if (Feature ==
"-exception-handling") {
92 HasExceptionHandling =
false;
96 Diags.
Report(diag::err_opt_not_valid_with_opt)
97 << Feature <<
"-target-feature";
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Concrete class used by the front-end to report problems and issues.
Defines the Diagnostic-related interfaces.
Enumerates target-specific builtins in their own namespaces within namespace clang.
Dataflow Directional Tag Classes.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
static constexpr llvm::StringLiteral ValidCPUNames[]
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
__DEVICE__ int max(int __a, int __b)
void defineCPUMacros(MacroBuilder &Builder, StringRef CPUName, bool Tuning)
__DEVICE__ int min(int __a, int __b)
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
Defines enum values for all the target-independent builtin functions.