From: Joerg Sonnenberger Date: Wed, 19 Feb 2014 22:16:19 +0000 (+0000) Subject: Use a switch for the architecture specific logic in X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=791ab30643dcb91f6d02b10665d42c22002b2b64;p=clang Use a switch for the architecture specific logic in netbsd::Assemble::ConstructJob. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201725 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 532c863414..217db28eed 100644 --- a/lib/Driver/Tools.cpp +++ b/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,