aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-04-30 18:35:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-04-30 18:35:43 +0000
commitf24a151d645abc89f94aa58ad59f3131502041b1 (patch)
treefe4ec012a6a63047c9e4a39ab604969356f28f45
parent769d0cc72b1831785596d0e76f327bdb887823be (diff)
Implement -fno-dwarf2-cfi-asm.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130616 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Driver/CC1Options.td1
-rw-r--r--include/clang/Driver/Options.td2
-rw-r--r--include/clang/Frontend/CodeGenOptions.h2
-rw-r--r--lib/CodeGen/BackendUtil.cpp2
-rw-r--r--lib/Driver/Tools.cpp6
-rw-r--r--lib/Frontend/CompilerInvocation.cpp3
6 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td
index 55d061bb1f..d243bf989f 100644
--- a/include/clang/Driver/CC1Options.td
+++ b/include/clang/Driver/CC1Options.td
@@ -113,6 +113,7 @@ def dwarf_debug_flags : Separate<"-dwarf-debug-flags">,
def fforbid_guard_variables : Flag<"-fforbid-guard-variables">,
HelpText<"Emit an error if a C++ static local initializer would need a guard variable">;
def g : Flag<"-g">, HelpText<"Generate source level debug information">;
+def fno_dwarf2_cfi_asm : Flag<"-fno-dwarf2-cfi-asm">, HelpText<"Don't use the cfi directives">;
def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">,
HelpText<"Generate runtime checks for undefined behavior.">;
def flimit_debug_info : Flag<"-flimit-debug-info">,
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 96e1c54813..38f0c57af7 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -280,6 +280,8 @@ def fdiagnostics_show_name : Flag<"-fdiagnostics-show-name">, Group<f_Group>;
def fdiagnostics_show_note_include_stack : Flag<"-fdiagnostics-show-note-include-stack">, Group<f_Group>;
def fdiagnostics_show_category_EQ : Joined<"-fdiagnostics-show-category=">, Group<f_clang_Group>;
def fdollars_in_identifiers : Flag<"-fdollars-in-identifiers">, Group<f_Group>;
+def fdwarf2_cfi_asm : Flag<"-fdwarf2-cfi-asm">, Group<f_Group>;
+def fno_dwarf2_cfi_asm : Flag<"-fno-dwarf2-cfi-asm">, Group<f_Group>;
def felide_constructors : Flag<"-felide-constructors">, Group<f_Group>;
def feliminate_unused_debug_symbols : Flag<"-feliminate-unused-debug-symbols">, Group<f_Group>;
def femit_all_decls : Flag<"-femit-all-decls">, Group<f_Group>;
diff --git a/include/clang/Frontend/CodeGenOptions.h b/include/clang/Frontend/CodeGenOptions.h
index 4e17bdce0f..8bef6a3e0d 100644
--- a/include/clang/Frontend/CodeGenOptions.h
+++ b/include/clang/Frontend/CodeGenOptions.h
@@ -68,6 +68,7 @@ public:
/// generated.
unsigned MergeAllConstants : 1; /// Merge identical constants.
unsigned NoCommon : 1; /// Set when -fno-common or C++ is enabled.
+ unsigned NoDwarf2CFIAsm : 1; /// Set when -fno-dwarf2-cfi-asm is enabled.
unsigned NoImplicitFloat : 1; /// Set when -mno-implicit-float is enabled.
unsigned NoInfsFPMath : 1; /// Assume FP arguments, results not +-Inf.
unsigned NoNaNsFPMath : 1; /// Assume FP arguments, results not NaN.
@@ -148,6 +149,7 @@ public:
LessPreciseFPMAD = 0;
MergeAllConstants = 1;
NoCommon = 0;
+ NoDwarf2CFIAsm = 0;
NoImplicitFloat = 0;
NoInfsFPMath = 0;
NoNaNsFPMath = 0;
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index 497ccc54ee..1264473dab 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/lib/CodeGen/BackendUtil.cpp
@@ -280,6 +280,8 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
TM->setMCRelaxAll(true);
if (CodeGenOpts.SaveTempLabels)
TM->setMCSaveTempLabels(true);
+ if (CodeGenOpts.NoDwarf2CFIAsm)
+ TM->setMCUseCFI(false);
// Create the code generator passes.
PassManager *PM = getCodeGenPasses();
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 2c805923c5..099a9a1c47 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1375,6 +1375,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fno-gnu-keywords");
}
+ if (Arg *A = Args.getLastArg(options::OPT_fdwarf2_cfi_asm,
+ options::OPT_fno_dwarf2_cfi_asm)) {
+ if (A->getOption().matches(options::OPT_fno_dwarf2_cfi_asm))
+ CmdArgs.push_back("-fno-dwarf2-cfi-asm");
+ }
+
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_)) {
CmdArgs.push_back("-ftemplate-depth");
CmdArgs.push_back(A->getValue(Args));
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 21a80fee71..1d4cd15ac4 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -203,6 +203,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
Res.push_back("-mrelax-all");
if (Opts.SaveTempLabels)
Res.push_back("-msave-temp-labels");
+ if (Opts.NoDwarf2CFIAsm)
+ Res.push_back("-fno-dwarf2-cfi-asm");
if (Opts.SoftFloat)
Res.push_back("-msoft-float");
if (Opts.UnwindTables)
@@ -955,6 +957,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.RelaxAll = Args.hasArg(OPT_mrelax_all);
Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer);
Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels);
+ Opts.NoDwarf2CFIAsm = Args.hasArg(OPT_fno_dwarf2_cfi_asm);
Opts.SoftFloat = Args.hasArg(OPT_msoft_float);
Opts.UnsafeFPMath = Args.hasArg(OPT_cl_unsafe_math_optimizations) ||
Args.hasArg(OPT_cl_fast_relaxed_math);