diff options
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 8df0578e7d9..c2a0205b727 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -1217,6 +1217,19 @@ void Clang::AddSparcTargetArgs(const ArgList &Args, } } +static const char *getSystemZTargetCPU(const ArgList &Args) { + if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) + return A->getValue(); + return "z10"; +} + +void Clang::AddSystemZTargetArgs(const ArgList &Args, + ArgStringList &CmdArgs) const { + const char *CPUName = getSystemZTargetCPU(Args); + CmdArgs.push_back("-target-cpu"); + CmdArgs.push_back(CPUName); +} + static const char *getX86TargetCPU(const ArgList &Args, const llvm::Triple &Triple) { if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) { @@ -2454,6 +2467,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, AddSparcTargetArgs(Args, CmdArgs); break; + case llvm::Triple::systemz: + AddSystemZTargetArgs(Args, CmdArgs); + break; + case llvm::Triple::x86: case llvm::Triple::x86_64: AddX86TargetArgs(Args, CmdArgs); @@ -5926,8 +5943,10 @@ void gnutools::Assemble::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-KPIC"); } } else if (getToolChain().getArch() == llvm::Triple::systemz) { - // At the moment we always produce z10 code. - CmdArgs.push_back("-march=z10"); + // Always pass an -march option, since our default of z10 is later + // than the GNU assembler's default. + StringRef CPUName = getSystemZTargetCPU(Args); + CmdArgs.push_back(Args.MakeArgString("-march=" + CPUName)); } Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, |