@@ -52,7 +52,7 @@ static void getRISCFeaturesFromMcpu(const Driver &D, const llvm::Triple &Triple,
52
52
const llvm::opt::ArgList &Args,
53
53
const llvm::opt::Arg *A, StringRef Mcpu,
54
54
std::vector<StringRef> &Features) {
55
- bool Is64Bit = ( Triple.getArch () == llvm::Triple::riscv64 );
55
+ bool Is64Bit = Triple.isRISCV64 ( );
56
56
llvm::RISCV::CPUKind CPUKind = llvm::RISCV::parseCPUKind (Mcpu);
57
57
if (!llvm::RISCV::checkCPUKind (CPUKind, Is64Bit) ||
58
58
!llvm::RISCV::getCPUFeaturesExceptStdExt (CPUKind, Features)) {
@@ -163,9 +163,7 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
163
163
}
164
164
165
165
StringRef riscv::getRISCVABI (const ArgList &Args, const llvm::Triple &Triple) {
166
- assert ((Triple.getArch () == llvm::Triple::riscv32 ||
167
- Triple.getArch () == llvm::Triple::riscv64) &&
168
- " Unexpected triple" );
166
+ assert (Triple.isRISCV () && " Unexpected triple" );
169
167
170
168
// GCC's logic around choosing a default `-mabi=` is complex. If GCC is not
171
169
// configured using `--with-abi=`, then the logic for the default choice is
@@ -213,7 +211,7 @@ StringRef riscv::getRISCVABI(const ArgList &Args, const llvm::Triple &Triple) {
213
211
// We deviate from GCC's defaults here:
214
212
// - On `riscv{XLEN}-unknown-elf` we use the integer calling convention only.
215
213
// - On all other OSs we use the double floating point calling convention.
216
- if (Triple.getArch () == llvm::Triple::riscv32 ) {
214
+ if (Triple.isRISCV32 () ) {
217
215
if (Triple.getOS () == llvm::Triple::UnknownOS)
218
216
return " ilp32" ;
219
217
else
@@ -228,9 +226,7 @@ StringRef riscv::getRISCVABI(const ArgList &Args, const llvm::Triple &Triple) {
228
226
229
227
StringRef riscv::getRISCVArch (const llvm::opt::ArgList &Args,
230
228
const llvm::Triple &Triple) {
231
- assert ((Triple.getArch () == llvm::Triple::riscv32 ||
232
- Triple.getArch () == llvm::Triple::riscv64) &&
233
- " Unexpected triple" );
229
+ assert (Triple.isRISCV () && " Unexpected triple" );
234
230
235
231
// GCC's logic around choosing a default `-march=` is complex. If GCC is not
236
232
// configured using `--with-arch=`, then the logic for the default choice is
@@ -291,7 +287,7 @@ StringRef riscv::getRISCVArch(const llvm::opt::ArgList &Args,
291
287
// We deviate from GCC's defaults here:
292
288
// - On `riscv{XLEN}-unknown-elf` we default to `rv{XLEN}imac`
293
289
// - On all other OSs we use `rv{XLEN}imafdc` (equivalent to `rv{XLEN}gc`)
294
- if (Triple.getArch () == llvm::Triple::riscv32 ) {
290
+ if (Triple.isRISCV32 () ) {
295
291
if (Triple.getOS () == llvm::Triple::UnknownOS)
296
292
return " rv32imac" ;
297
293
else
0 commit comments