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/BuiltinsMips.def" 33 return llvm::StringSwitch<bool>(CPU)
38 .Case(
"mips64r2",
true)
39 .Case(
"mips64r3",
true)
40 .Case(
"mips64r5",
true)
41 .Case(
"mips64r6",
true)
48 return llvm::StringSwitch<bool>(Name)
55 .Case(
"mips32r2",
true)
56 .Case(
"mips32r3",
true)
57 .Case(
"mips32r5",
true)
58 .Case(
"mips32r6",
true)
60 .Case(
"mips64r2",
true)
61 .Case(
"mips64r3",
true)
62 .Case(
"mips64r5",
true)
63 .Case(
"mips64r6",
true)
86 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS32");
91 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS64");
94 const std::string ISARev = llvm::StringSwitch<std::string>(
getCPU())
95 .Cases(
"mips32",
"mips64",
"1")
96 .Cases(
"mips32r2",
"mips64r2",
"2")
97 .Cases(
"mips32r3",
"mips64r3",
"3")
98 .Cases(
"mips32r5",
"mips64r5",
"5")
99 .Cases(
"mips32r6",
"mips64r6",
"6")
108 }
else if (
ABI ==
"n32") {
112 }
else if (
ABI ==
"n64") {
117 llvm_unreachable(
"Invalid ABI.");
121 if (CanUseBSDABICalls)
129 Builder.
defineMacro(
"__mips_hard_float", Twine(1));
132 Builder.
defineMacro(
"__mips_soft_float", Twine(1));
137 Builder.
defineMacro(
"__mips_single_float", Twine(1));
141 Twine(32 / (
HasFP64 || IsSingleFloat ? 1 : 2)));
179 Builder.
defineMacro(
"_MIPS_ARCH",
"\"" + CPU +
"\"");
180 Builder.
defineMacro(
"_MIPS_ARCH_" + StringRef(CPU).upper());
184 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
185 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
186 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
192 if (
ABI ==
"n32" ||
ABI ==
"n64")
193 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
197 return llvm::StringSwitch<bool>(Feature)
210 if ((
getTriple().getArch() == llvm::Triple::mips64 ||
211 getTriple().getArch() == llvm::Triple::mips64el) &&
212 IsMicromips && (
ABI ==
"n32" ||
ABI ==
"n64")) {
213 Diags.
Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
219 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
225 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
232 if ((
getTriple().getArch() == llvm::Triple::mips64 ||
233 getTriple().getArch() == llvm::Triple::mips64el) &&
235 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
243 if ((
getTriple().getArch() == llvm::Triple::mips ||
244 getTriple().getArch() == llvm::Triple::mipsel) &&
245 (
ABI ==
"n32" ||
ABI ==
"n64")) {
246 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
void DefineStd(MacroBuilder &Builder, StringRef MacroName, const LangOptions &Opts)
DefineStd - Define a macro name and standard variants.
Defines the clang::MacroBuilder utility class.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
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.
bool validateTarget(DiagnosticsEngine &Diags) const override
Check the target is valid after it is fully initialized.
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
Enumerates target-specific builtins in their own namespaces within namespace clang.
const std::string & getCPU() const
Dataflow Directional Tag Classes.
bool processorSupportsGPR64() const
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
bool isValidCPUName(StringRef Name) const override
brief Determine whether this TargetInfo supports the given CPU name.
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".