Author: probinson Date: Fri Sep 29 14:25:07 2017 New Revision: 314558 URL: http://llvm.org/viewvc/llvm-project?rev=314558&view=rev Log: [PS4] Tidy up some debug-tuning v. triple decision-making.
Modified: cfe/trunk/include/clang/Driver/CC1Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp cfe/trunk/test/Driver/debug-options.c Modified: cfe/trunk/include/clang/Driver/CC1Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=314558&r1=314557&r2=314558&view=diff ============================================================================== --- cfe/trunk/include/clang/Driver/CC1Options.td (original) +++ cfe/trunk/include/clang/Driver/CC1Options.td Fri Sep 29 14:25:07 2017 @@ -200,6 +200,9 @@ def arange_sections : Flag<["-"], "arang 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">; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=314558&r1=314557&r2=314558&view=diff ============================================================================== --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Sep 29 14:25:07 2017 @@ -2816,8 +2816,6 @@ static void RenderDebugOptions(const Too 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 Too // 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 Too // -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 Too 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); } Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=314558&r1=314557&r2=314558&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Sep 29 14:25:07 2017 @@ -527,7 +527,7 @@ static bool ParseCodeGenArgs(CodeGenOpti 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)) Modified: cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp?rev=314558&r1=314557&r2=314558&view=diff ============================================================================== --- cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp (original) +++ cfe/trunk/test/CodeGenCXX/debug-info-anon-namespace.cpp Fri Sep 29 14:25:07 2017 @@ -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 Modified: cfe/trunk/test/Driver/debug-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=314558&r1=314557&r2=314558&view=diff ============================================================================== --- cfe/trunk/test/Driver/debug-options.c (original) +++ cfe/trunk/test/Driver/debug-options.c Fri Sep 29 14:25:07 2017 @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits