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 {
"mips1"}, {
"mips2"}, {
"mips3"}, {
"mips4"}, {
"mips5"},
49 {
"mips32"}, {
"mips32r2"}, {
"mips32r3"}, {
"mips32r5"}, {
"mips32r6"},
50 {
"mips64"}, {
"mips64r2"}, {
"mips64r3"}, {
"mips64r5"}, {
"mips64r6"},
51 {
"octeon"}, {
"p5600"}};
79 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS32");
84 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS64");
87 const std::string ISARev = llvm::StringSwitch<std::string>(
getCPU())
88 .Cases(
"mips32",
"mips64",
"1")
89 .Cases(
"mips32r2",
"mips64r2",
"2")
90 .Cases(
"mips32r3",
"mips64r3",
"3")
91 .Cases(
"mips32r5",
"mips64r5",
"5")
92 .Cases(
"mips32r6",
"mips64r6",
"6")
101 }
else if (
ABI ==
"n32") {
105 }
else if (
ABI ==
"n64") {
110 llvm_unreachable(
"Invalid ABI.");
114 if (CanUseBSDABICalls)
122 Builder.
defineMacro(
"__mips_hard_float", Twine(1));
125 Builder.
defineMacro(
"__mips_soft_float", Twine(1));
130 Builder.
defineMacro(
"__mips_single_float", Twine(1));
134 Twine(32 / (
HasFP64 || IsSingleFloat ? 1 : 2)));
172 Builder.
defineMacro(
"_MIPS_ARCH",
"\"" + CPU +
"\"");
173 Builder.
defineMacro(
"_MIPS_ARCH_" + StringRef(CPU).upper());
177 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
178 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
179 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
185 if (
ABI ==
"n32" ||
ABI ==
"n64")
186 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
190 return llvm::StringSwitch<bool>(Feature)
203 if (
getTriple().isMIPS64() && IsMicromips && (
ABI ==
"n32" ||
ABI ==
"n64")) {
204 Diags.
Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
210 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
216 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
224 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
233 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.
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
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.
static constexpr llvm::StringLiteral ValidCPUNames[]
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".