@@ -395,45 +395,17 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
395395 return { UnsupportedOS, UnsupportedArch };
396396
397397 // Set the "_endian" platform condition.
398- switch (Target.getArch ()) {
399- default : llvm_unreachable (" undefined architecture endianness" );
400- case llvm::Triple::ArchType::arm:
401- case llvm::Triple::ArchType::thumb:
402- case llvm::Triple::ArchType::aarch64:
403- case llvm::Triple::ArchType::aarch64_32:
404- case llvm::Triple::ArchType::ppc64le:
405- case llvm::Triple::ArchType::wasm32:
406- case llvm::Triple::ArchType::x86:
407- case llvm::Triple::ArchType::x86_64:
408- case llvm::Triple::ArchType::riscv64:
398+ if (Target.isLittleEndian ()) {
409399 addPlatformConditionValue (PlatformConditionKind::Endianness, " little" );
410- break ;
411- case llvm::Triple::ArchType::ppc:
412- case llvm::Triple::ArchType::ppc64:
413- case llvm::Triple::ArchType::systemz:
400+ } else {
414401 addPlatformConditionValue (PlatformConditionKind::Endianness, " big" );
415- break ;
416402 }
417403
418404 // Set the "_pointerBitWidth" platform condition.
419- switch (Target.getArch ()) {
420- default : llvm_unreachable (" undefined architecture pointer bit width" );
421- case llvm::Triple::ArchType::arm:
422- case llvm::Triple::ArchType::thumb:
423- case llvm::Triple::ArchType::aarch64_32:
424- case llvm::Triple::ArchType::ppc:
425- case llvm::Triple::ArchType::x86:
426- case llvm::Triple::ArchType::wasm32:
405+ if (Target.isArch32Bit ()) {
427406 addPlatformConditionValue (PlatformConditionKind::PointerBitWidth, " _32" );
428- break ;
429- case llvm::Triple::ArchType::aarch64:
430- case llvm::Triple::ArchType::ppc64:
431- case llvm::Triple::ArchType::ppc64le:
432- case llvm::Triple::ArchType::x86_64:
433- case llvm::Triple::ArchType::systemz:
434- case llvm::Triple::ArchType::riscv64:
407+ } else if (Target.isArch64Bit ()) {
435408 addPlatformConditionValue (PlatformConditionKind::PointerBitWidth, " _64" );
436- break ;
437409 }
438410
439411 // Set the "runtime" platform condition.
0 commit comments