15 #include "llvm/ADT/StringSwitch.h" 17 using namespace clang;
22 "x0",
"x1",
"x2",
"x3",
"x4",
"x5",
"x6",
"x7",
23 "x8",
"x9",
"x10",
"x11",
"x12",
"x13",
"x14",
"x15",
24 "x16",
"x17",
"x18",
"x19",
"x20",
"x21",
"x22",
"x23",
25 "x24",
"x25",
"x26",
"x27",
"x28",
"x29",
"x30",
"x31"};
26 return llvm::makeArrayRef(GCCRegNames);
31 {{
"zero"},
"x0"}, {{
"ra"},
"x1"}, {{
"sp"},
"x2"}, {{
"gp"},
"x3"},
32 {{
"tp"},
"x4"}, {{
"t0"},
"x5"}, {{
"t1"},
"x6"}, {{
"t2"},
"x7"},
33 {{
"s0"},
"x8"}, {{
"s1"},
"x9"}, {{
"a0"},
"x10"}, {{
"a1"},
"x11"},
34 {{
"a2"},
"x12"}, {{
"a3"},
"x13"}, {{
"a4"},
"x14"}, {{
"a5"},
"x15"},
35 {{
"a6"},
"x16"}, {{
"a7"},
"x17"}, {{
"s2"},
"x18"}, {{
"s3"},
"x19"},
36 {{
"s4"},
"x20"}, {{
"s5"},
"x21"}, {{
"s6"},
"x22"}, {{
"s7"},
"x23"},
37 {{
"s8"},
"x24"}, {{
"s9"},
"x25"}, {{
"s10"},
"x26"}, {{
"s11"},
"x27"},
38 {{
"t3"},
"x28"}, {{
"t4"},
"x29"}, {{
"t5"},
"x30"}, {{
"t6"},
"x31"}};
39 return llvm::makeArrayRef(GCCRegAliases);
74 bool Is64Bit =
getTriple().getArch() == llvm::Triple::riscv64;
75 Builder.
defineMacro(
"__riscv_xlen", Is64Bit ?
"64" :
"32");
79 StringRef ABIName =
getABI();
80 if (ABIName ==
"ilp32f" || ABIName ==
"lp64f")
82 else if (ABIName ==
"ilp32d" || ABIName ==
"lp64d")
84 else if (ABIName ==
"ilp32e")
110 bool Is64Bit =
getTriple().getArch() == llvm::Triple::riscv64;
111 return llvm::StringSwitch<bool>(Feature)
113 .Case(
"riscv32", !Is64Bit)
114 .Case(
"riscv64", Is64Bit)
126 for (
const auto &Feature : Features) {
129 else if (Feature ==
"+a")
131 else if (Feature ==
"+f")
133 else if (Feature ==
"+d")
135 else if (Feature ==
"+c")
Defines the clang::MacroBuilder utility class.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
void setRequiresImmediate(int Min, int Max)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
Concrete class used by the front-end to report problems and issues.
bool handleTargetFeatures(std::vector< std::string > &Features, DiagnosticsEngine &Diags) override
Perform initialization based on the user configured set of features.
static const char *const GCCRegNames[]
StringRef getABI() const override
Get the ABI currently in use.
ArrayRef< const char * > getGCCRegNames() const override
bool hasFeature(StringRef Feature) const override
Return true if has this feature, need to sync with handleTargetFeatures.
Dataflow Directional Tag Classes.
void getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const override
===-— Other target property query methods --------------------——===//
void defineMacro(const Twine &Name, const Twine &Value="1")
Append a #define line for macro of the form "\#define Name Value\n".
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override