[flang-commits] [flang] 6951cec - [flang] Allow all OSes in fir::CodeGenSpecifics::get
Fangrui Song via flang-commits
flang-commits at lists.llvm.org
Mon Oct 24 22:45:34 PDT 2022
Author: Fangrui Song
Date: 2022-10-24T22:45:28-07:00
New Revision: 6951cec6ce70e4135ea7b42f3855de14bcd3702b
URL: https://github.com/llvm/llvm-project/commit/6951cec6ce70e4135ea7b42f3855de14bcd3702b
DIFF: https://github.com/llvm/llvm-project/commit/6951cec6ce70e4135ea7b42f3855de14bcd3702b.diff
LOG: [flang] Allow all OSes in fir::CodeGenSpecifics::get
This allows all ELF operating systems to use target specifics tuned for Linux,
since they use mostly the same ABIs. If some triples are to excluded, it's
better done at the driver layer.
Reviewed By: emaste
Differential Revision: https://reviews.llvm.org/D135100
Added:
Modified:
flang/lib/Optimizer/CodeGen/Target.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/CodeGen/Target.cpp b/flang/lib/Optimizer/CodeGen/Target.cpp
index e22096357f528..17cf3caf8e557 100644
--- a/flang/lib/Optimizer/CodeGen/Target.cpp
+++ b/flang/lib/Optimizer/CodeGen/Target.cpp
@@ -343,72 +343,23 @@ fir::CodeGenSpecifics::get(mlir::MLIRContext *ctx, llvm::Triple &&trp,
default:
break;
case llvm::Triple::ArchType::x86:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- case llvm::Triple::OSType::Darwin:
- case llvm::Triple::OSType::MacOSX:
- case llvm::Triple::OSType::Solaris:
- case llvm::Triple::OSType::Win32:
- return std::make_unique<TargetI386>(ctx, std::move(trp),
- std::move(kindMap));
- }
- break;
+ return std::make_unique<TargetI386>(ctx, std::move(trp),
+ std::move(kindMap));
case llvm::Triple::ArchType::x86_64:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- case llvm::Triple::OSType::Darwin:
- case llvm::Triple::OSType::MacOSX:
- case llvm::Triple::OSType::Solaris:
- case llvm::Triple::OSType::Win32:
- return std::make_unique<TargetX86_64>(ctx, std::move(trp),
- std::move(kindMap));
- }
- break;
+ return std::make_unique<TargetX86_64>(ctx, std::move(trp),
+ std::move(kindMap));
case llvm::Triple::ArchType::aarch64:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- case llvm::Triple::OSType::Darwin:
- case llvm::Triple::OSType::MacOSX:
- case llvm::Triple::OSType::Win32:
- return std::make_unique<TargetAArch64>(ctx, std::move(trp),
- std::move(kindMap));
- }
- break;
+ return std::make_unique<TargetAArch64>(ctx, std::move(trp),
+ std::move(kindMap));
case llvm::Triple::ArchType::ppc64le:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- return std::make_unique<TargetPPC64le>(ctx, std::move(trp),
- std::move(kindMap));
- }
- break;
- case llvm::Triple::ArchType::sparc:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- case llvm::Triple::OSType::Solaris:
- return std::make_unique<TargetSparc>(ctx, std::move(trp),
+ return std::make_unique<TargetPPC64le>(ctx, std::move(trp),
std::move(kindMap));
- }
- break;
+ case llvm::Triple::ArchType::sparc:
+ return std::make_unique<TargetSparc>(ctx, std::move(trp),
+ std::move(kindMap));
case llvm::Triple::ArchType::sparcv9:
- switch (trp.getOS()) {
- default:
- break;
- case llvm::Triple::OSType::Linux:
- case llvm::Triple::OSType::Solaris:
- return std::make_unique<TargetSparcV9>(ctx, std::move(trp),
- std::move(kindMap));
- }
- break;
+ return std::make_unique<TargetSparcV9>(ctx, std::move(trp),
+ std::move(kindMap));
}
TODO(mlir::UnknownLoc::get(ctx), "target not implemented");
}
More information about the flang-commits
mailing list