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"}};
63 return llvm::StringSwitch<unsigned>(
getCPU())
64 .Cases(
"mips32",
"mips64", 1)
65 .Cases(
"mips32r2",
"mips64r2", 2)
66 .Cases(
"mips32r3",
"mips64r3", 3)
67 .Cases(
"mips32r5",
"mips64r5", 5)
68 .Cases(
"mips32r6",
"mips64r6", 6)
89 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS32");
94 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS64");
97 const std::string ISARev = std::to_string(
getISARev());
106 }
else if (
ABI ==
"n32") {
110 }
else if (
ABI ==
"n64") {
115 llvm_unreachable(
"Invalid ABI.");
119 if (CanUseBSDABICalls)
127 Builder.
defineMacro(
"__mips_hard_float", Twine(1));
130 Builder.
defineMacro(
"__mips_soft_float", Twine(1));
135 Builder.
defineMacro(
"__mips_single_float", Twine(1));
190 Builder.
defineMacro(
"_MIPS_ARCH",
"\"" + CPU +
"\"");
191 Builder.
defineMacro(
"_MIPS_ARCH_" + StringRef(CPU).upper());
195 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
196 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
197 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
203 if (
ABI ==
"n32" ||
ABI ==
"n64")
204 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
208 return llvm::StringSwitch<bool>(Feature)
221 if (
getTriple().isMIPS64() && IsMicromips && (
ABI ==
"n32" ||
ABI ==
"n64")) {
222 Diags.
Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
228 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
234 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
242 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
251 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
258 Diags.
Report(diag::err_unsupported_abi_for_opt) <<
"-mfpxx" <<
"o32";
264 (
ABI ==
"n32" ||
ABI ==
"n64")) {
265 Diags.
Report(diag::err_opt_not_valid_with_opt) <<
"-mfpxx" << CPU;
270 CPU ==
"mips64r6")) {
271 Diags.
Report(diag::err_opt_not_valid_with_opt) <<
"-mfp32" << CPU;
275 if (
FPMode ==
FP64 && (CPU ==
"mips1" || CPU ==
"mips2" ||
277 Diags.
Report(diag::err_mips_fp64_req) <<
"-mfp64";
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.
unsigned getISARev() const
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...
enum clang::targets::MipsTargetInfo::FPModeEnum FPMode
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".