summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2014-02-19 22:16:19 +0000
committerJoerg Sonnenberger <joerg@bec.de>2014-02-19 22:16:19 +0000
commit25e18177871f8b1d86258ec9f845f2c333a54fb4 (patch)
tree87787f43b806116823f31a5abbd24f7cb009857f /clang
parentdc97e23b020c116f442a3d96bc39ba56aab60dd4 (diff)
downloadbcm5719-llvm-25e18177871f8b1d86258ec9f845f2c333a54fb4.tar.gz
bcm5719-llvm-25e18177871f8b1d86258ec9f845f2c333a54fb4.zip
Use a switch for the architecture specific logic in
netbsd::Assemble::ConstructJob. llvm-svn: 201725
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Driver/Tools.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 532c863414f..217db28eedf 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -6147,23 +6147,23 @@ void netbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
const char *LinkingOutput) const {
ArgStringList CmdArgs;
- // When building 32-bit code on NetBSD/amd64, we have to explicitly
- // instruct as in the base system to assemble 32-bit code.
- if (getToolChain().getArch() == llvm::Triple::x86)
+ // GNU as needs different flags for creating the correct output format
+ // on architectures with different ABIs or optional feature sets.
+ switch (getToolChain().getArch()) {
+ case llvm::Triple::x86:
CmdArgs.push_back("--32");
-
- // Pass the target CPU to GNU as for ARM, since the source code might
- // not have the correct .cpu annotation.
- if (getToolChain().getArch() == llvm::Triple::arm ||
- getToolChain().getArch() == llvm::Triple::thumb) {
+ break;
+ case llvm::Triple::arm:
+ case llvm::Triple::thumb: {
std::string MArch(arm::getARMTargetCPU(Args, getToolChain().getTriple()));
CmdArgs.push_back(Args.MakeArgString("-mcpu=" + MArch));
+ break;
}
- if (getToolChain().getArch() == llvm::Triple::mips ||
- getToolChain().getArch() == llvm::Triple::mipsel ||
- getToolChain().getArch() == llvm::Triple::mips64 ||
- getToolChain().getArch() == llvm::Triple::mips64el) {
+ case llvm::Triple::mips:
+ case llvm::Triple::mipsel:
+ case llvm::Triple::mips64:
+ case llvm::Triple::mips64el: {
StringRef CPUName;
StringRef ABIName;
getMipsCPUAndABI(Args, getToolChain().getTriple(), CPUName, ABIName);
@@ -6181,6 +6181,10 @@ void netbsd::Assemble::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-EL");
addAssemblerKPIC(Args, CmdArgs);
+ break;
+ }
+ default:
+ break;
}
Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
OpenPOWER on IntegriCloud