[PS4] Tidy up some debug-tuning v. triple decision-making.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314558 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Paul Robinson 2017-09-29 21:25:07 +00:00
parent 06fad44fa9
commit 3b862f6745
5 changed files with 24 additions and 17 deletions

View File

@ -200,6 +200,9 @@ def arange_sections : Flag<["-"], "arange_sections">,
def dwarf_ext_refs : Flag<["-"], "dwarf-ext-refs">,
HelpText<"Generate debug info with external references to clang modules"
" or precompiled headers">;
def dwarf_explicit_import : Flag<["-"], "dwarf-explicit-import">,
HelpText<"Generate explicit import from anonymous namespace to containing"
" scope">;
def debug_forward_template_params : Flag<["-"], "debug-forward-template-params">,
HelpText<"Emit complete descriptions of template parameters in forward"
" declarations">;

View File

@ -2816,8 +2816,6 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
ArgStringList &CmdArgs,
codegenoptions::DebugInfoKind &DebugInfoKind,
const Arg *&SplitDWARFArg) {
bool IsPS4CPU = T.isPS4CPU();
if (Args.hasFlag(options::OPT_fdebug_info_for_profiling,
options::OPT_fno_debug_info_for_profiling, false))
CmdArgs.push_back("-fdebug-info-for-profiling");
@ -2900,13 +2898,14 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// And we handle flag -grecord-gcc-switches later with DWARFDebugFlags.
Args.ClaimAllArgs(options::OPT_g_flags_Group);
// Column info is included by default for everything except PS4 and CodeView.
// Column info is included by default for everything except SCE and CodeView.
// Clang doesn't track end columns, just starting columns, which, in theory,
// is fine for CodeView (and PDB). In practice, however, the Microsoft
// debuggers don't handle missing end columns well, so it's better not to
// include any column info.
if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
/*Default=*/ !IsPS4CPU && !(IsWindowsMSVC && EmitCodeView)))
/*Default=*/!(IsWindowsMSVC && EmitCodeView) &&
DebuggerTuning != llvm::DebuggerKind::SCE))
CmdArgs.push_back("-dwarf-column-info");
// FIXME: Move backend command line options to the module.
@ -2957,8 +2956,9 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// -gdwarf-aranges turns on the emission of the aranges section in the
// backend.
// Always enabled on the PS4.
if (Args.hasArg(options::OPT_gdwarf_aranges) || IsPS4CPU) {
// Always enabled for SCE tuning.
if (Args.hasArg(options::OPT_gdwarf_aranges) ||
DebuggerTuning == llvm::DebuggerKind::SCE) {
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-generate-arange-section");
}
@ -2974,6 +2974,10 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
if (DebuggerTuning == llvm::DebuggerKind::SCE)
CmdArgs.push_back("-debug-forward-template-params");
// Do we need to explicitly import anonymous namespaces into the parent scope?
if (DebuggerTuning == llvm::DebuggerKind::SCE)
CmdArgs.push_back("-dwarf-explicit-import");
RenderDebugInfoCompressionArgs(Args, CmdArgs, D);
}

View File

@ -527,7 +527,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs);
Opts.DebugExplicitImport = Triple.isPS4CPU();
Opts.DebugExplicitImport = Args.hasArg(OPT_dwarf_explicit_import);
Opts.DebugFwdTemplateParams = Args.hasArg(OPT_debug_forward_template_params);
for (const auto &Arg : Args.getAllArgValues(OPT_fdebug_prefix_map_EQ))

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-scei-ps4 -O0 %s -o - | FileCheck --check-prefix=PS4 %s
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-unknown-linux-gnu -O0 %s -o - | FileCheck --check-prefix=NON-PS4 %s
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -dwarf-explicit-import -O0 %s -o - | FileCheck --check-prefix=IMPORT %s
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -O0 %s -o - | FileCheck --check-prefix=NOIMPORT %s
namespace
{
@ -17,11 +17,9 @@ namespace
int *b1 = &a1;
int *b2 = &a2;
// PS4: [[NS:![0-9]+]] = !DINamespace
// PS4: [[CU:![0-9]+]] = distinct !DICompileUnit
// PS4: [[NS2:![0-9]+]] = !DINamespace
// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[NS]], file: {{![0-9]+}})
// PS4: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], file: {{![0-9]+}}, line: {{[0-9]+}})
// NON-PS4-NOT: !DIImportedEntity
// IMPORT: [[NS:![0-9]+]] = !DINamespace
// IMPORT: [[CU:![0-9]+]] = distinct !DICompileUnit
// IMPORT: [[NS2:![0-9]+]] = !DINamespace
// IMPORT: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[NS]], file: {{![0-9]+}})
// IMPORT: !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[NS]], entity: [[NS2]], file: {{![0-9]+}}, line: {{[0-9]+}})
// NOIMPORT-NOT: !DIImportedEntity

View File

@ -76,6 +76,8 @@
// RUN: | FileCheck -check-prefix=NOCI %s
// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
// RUN: | FileCheck -check-prefix=CI %s
// RUN: %clang -### -c %s -gsce -target x86_64-unknown-linux 2>&1 \
// RUN: | FileCheck -check-prefix=NOCI %s
// RUN: %clang -### -c -gdwarf-2 %s 2>&1 \
// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s