summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarcin Koscielnicki <koriakin@0x04.net>2016-05-04 23:37:40 +0000
committerMarcin Koscielnicki <koriakin@0x04.net>2016-05-04 23:37:40 +0000
commit49edd29c346fff43705460794a3ea6d4c68b955e (patch)
tree43b6b8d51fc16ebb8712b0f254bfa9d65b14536d /lib
parentce6d6c2e9941ff7307280534ff5570c753236b8f (diff)
downloadclang-49edd29c346fff43705460794a3ea6d4c68b955e.tar.gz
[SystemZ] Add -mbackchain option.
This option, like the corresponding gcc option, is SystemZ-specific and enables storing frame backchain links, as specified in the ABI. Differential Revision: http://reviews.llvm.org/D19891 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CGCall.cpp2
-rw-r--r--lib/Driver/Tools.cpp10
-rw-r--r--lib/Frontend/CompilerInvocation.cpp2
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 50ea7f7cc3..8a26db2116 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1714,6 +1714,8 @@ void CodeGenModule::ConstructAttributeList(
if (CodeGenOpts.StackRealignment)
FuncAttrs.addAttribute("stackrealign");
+ if (CodeGenOpts.Backchain)
+ FuncAttrs.addAttribute("backchain");
// Add target-cpu and target-features attributes to functions. If
// we have a decl for the function and it has a target attribute then
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 1cc1369f33..c688763e69 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1655,6 +1655,12 @@ void Clang::AddSparcTargetArgs(const ArgList &Args,
}
}
+void Clang::AddSystemZTargetArgs(const ArgList &Args,
+ ArgStringList &CmdArgs) const {
+ if (Args.hasFlag(options::OPT_mbackchain, options::OPT_mno_backchain, false))
+ CmdArgs.push_back("-mbackchain");
+}
+
static const char *getSystemZTargetCPU(const ArgList &Args) {
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
return A->getValue();
@@ -4241,6 +4247,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);
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 2091ec4af3..0b154b6743 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -782,6 +782,8 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.CudaGpuBinaryFileNames =
Args.getAllArgValues(OPT_fcuda_include_gpubinary);
+ Opts.Backchain = Args.hasArg(OPT_mbackchain);
+
return Success;
}