18 #include "llvm/ADT/StringSwitch.h" 20 using namespace clang;
24 #define BUILTIN(ID, TYPE, ATTRS) \ 25 {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, 26 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) \ 27 {#ID, TYPE, ATTRS, HEADER, ALL_LANGUAGES, nullptr}, 28 #include "clang/Basic/BuiltinsMips.def" 32 return llvm::StringSwitch<bool>(CPU)
37 .Case(
"mips64r2",
true)
38 .Case(
"mips64r3",
true)
39 .Case(
"mips64r5",
true)
40 .Case(
"mips64r6",
true)
47 {
"mips1"}, {
"mips2"}, {
"mips3"}, {
"mips4"}, {
"mips5"},
48 {
"mips32"}, {
"mips32r2"}, {
"mips32r3"}, {
"mips32r5"}, {
"mips32r6"},
49 {
"mips64"}, {
"mips64r2"}, {
"mips64r3"}, {
"mips64r5"}, {
"mips64r6"},
50 {
"octeon"}, {
"p5600"}};
62 return llvm::StringSwitch<unsigned>(
getCPU())
63 .Cases(
"mips32",
"mips64", 1)
64 .Cases(
"mips32r2",
"mips64r2", 2)
65 .Cases(
"mips32r3",
"mips64r3", 3)
66 .Cases(
"mips32r5",
"mips64r5", 5)
67 .Cases(
"mips32r6",
"mips64r6", 6)
88 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS32");
93 Builder.
defineMacro(
"_MIPS_ISA",
"_MIPS_ISA_MIPS64");
96 const std::string ISARev = std::to_string(
getISARev());
105 }
else if (
ABI ==
"n32") {
109 }
else if (
ABI ==
"n64") {
114 llvm_unreachable(
"Invalid ABI.");
118 if (CanUseBSDABICalls)
126 Builder.
defineMacro(
"__mips_hard_float", Twine(1));
129 Builder.
defineMacro(
"__mips_soft_float", Twine(1));
134 Builder.
defineMacro(
"__mips_single_float", Twine(1));
189 Builder.
defineMacro(
"_MIPS_ARCH",
"\"" + CPU +
"\"");
190 Builder.
defineMacro(
"_MIPS_ARCH_" + StringRef(CPU).upper());
194 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
195 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
196 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
202 if (
ABI ==
"n32" ||
ABI ==
"n64")
203 Builder.
defineMacro(
"__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
207 return llvm::StringSwitch<bool>(Feature)
219 return llvm::StringSwitch<unsigned>(
ABI)
228 if (
getTriple().isMIPS64() && IsMicromips && (
ABI ==
"n32" ||
ABI ==
"n64")) {
229 Diags.
Report(diag::err_target_unsupported_cpu_for_micromips) << CPU;
235 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
241 Diags.
Report(diag::err_target_unsupported_abi) <<
ABI << CPU;
249 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
258 Diags.
Report(diag::err_target_unsupported_abi_for_triple)
265 Diags.
Report(diag::err_unsupported_abi_for_opt) <<
"-mfpxx" <<
"o32";
271 (
ABI ==
"n32" ||
ABI ==
"n64")) {
272 Diags.
Report(diag::err_opt_not_valid_with_opt) <<
"-mfpxx" << CPU;
277 CPU ==
"mips64r6")) {
278 Diags.
Report(diag::err_opt_not_valid_with_opt) <<
"-mfp32" << CPU;
282 if (
FPMode ==
FP64 && (CPU ==
"mips1" || CPU ==
"mips2" ||
284 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.
unsigned getUnwindWordWidth() const override
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".