Skip to content

Commit

Permalink
Revert "[PS4/PS5][Driver][DWARF] Always emit .debug_aranges for SCE t… (
Browse files Browse the repository at this point in the history
llvm#99711)

…uning (llvm#99629)"

This reverts commit 22eb290.
  • Loading branch information
playstation-edd authored Jul 19, 2024
1 parent 9e74f66 commit 84658fb
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 57 deletions.
7 changes: 5 additions & 2 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4659,8 +4659,11 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,

// -gdwarf-aranges turns on the emission of the aranges section in the
// backend.
if (const Arg *A = Args.getLastArg(options::OPT_gdwarf_aranges);
A && checkDebugInfoOption(A, Args, D, TC)) {
// Always enabled for SCE tuning.
bool NeedAranges = DebuggerTuning == llvm::DebuggerKind::SCE;
if (const Arg *A = Args.getLastArg(options::OPT_gdwarf_aranges))
NeedAranges = checkDebugInfoOption(A, Args, D, TC) || NeedAranges;
if (NeedAranges) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-generate-arange-section");
}
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/Driver/ToolChains/PS4CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
};

if (UseLTO) {
// We default to creating the arange section, but LTO does not. Enable it
// here.
AddCodeGenFlag("-generate-arange-section");

// This tells LTO to perform JustMyCode instrumentation.
if (UseJMC)
AddCodeGenFlag("-enable-jmc-instrument");
Expand Down Expand Up @@ -268,6 +272,10 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
};

if (UseLTO) {
// We default to creating the arange section, but LTO does not. Enable it
// here.
AddCodeGenFlag("-generate-arange-section");

// This tells LTO to perform JustMyCode instrumentation.
if (UseJMC)
AddCodeGenFlag("-enable-jmc-instrument");
Expand Down
21 changes: 11 additions & 10 deletions clang/test/Driver/debug-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,27 @@
// RUN: %clang_cl -### -c -Z7 -target x86_64-windows-msvc -- %s 2>&1 \
// RUN: | FileCheck -check-prefix=G_NOTUNING %s

// On the PS4/PS5, -g defaults to -gno-column-info. We default to always
// generating the arange section, but keyed off SCE DebuggerTuning being in
// play during codegen, instead of -generate-arange-section.
// On the PS4/PS5, -g defaults to -gno-column-info, and we always generate the
// arange section.
// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
// RUN: | FileCheck -check-prefix=NOG_PS %s
// RUN: %clang -### -c %s -target x86_64-sie-ps5 2>&1 \
// RUN: | FileCheck -check-prefix=NOG_PS %s
/// PS4 will stay on v4 even if the generic default version changes.
// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
// RUN: | FileCheck -check-prefixes=G_DWARF4,G_SCE,NOCI,FWD_TMPL_PARAMS %s
// RUN: | FileCheck -check-prefixes=G_DWARF4,GARANGE,G_SCE,NOCI,FWD_TMPL_PARAMS %s
// RUN: %clang -### -c %s -g -target x86_64-sie-ps5 2>&1 \
// RUN: | FileCheck -check-prefixes=G_DWARF5,G_SCE,NOCI,FWD_TMPL_PARAMS %s
// RUN: | FileCheck -check-prefixes=G_DWARF5,GARANGE,G_SCE,NOCI,FWD_TMPL_PARAMS %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 -### %s -g -flto=thin -target x86_64-scei-ps4 2>&1 \
// RUN: | FileCheck -check-prefix=LDGARANGE %s
// RUN: | FileCheck -check-prefix=SNLDTLTOGARANGE %s
// RUN: %clang -### %s -g -flto=full -target x86_64-scei-ps4 2>&1 \
// RUN: | FileCheck -check-prefix=LDGARANGE %s
// RUN: | FileCheck -check-prefix=SNLDFLTOGARANGE %s
// RUN: %clang -### %s -g -flto -target x86_64-scei-ps5 2>&1 \
// RUN: | FileCheck -check-prefix=LDGARANGE %s
// RUN: | FileCheck -check-prefix=LLDGARANGE %s
// RUN: %clang -### %s -g -target x86_64-scei-ps5 2>&1 \
// RUN: | FileCheck -check-prefix=LDGARANGE %s

Expand Down Expand Up @@ -322,7 +321,8 @@
//
// NOG_PS: "-cc1"
// NOG_PS-NOT: "-dwarf-version=
// NOG_PS-NOT: "-generate-arange-section"
// NOG_PS: "-generate-arange-section"
// NOG_PS-NOT: "-dwarf-version=
//
// G_ERR: error: unknown argument:
//
Expand Down Expand Up @@ -402,7 +402,8 @@
//

// LDGARANGE: {{".*ld.*"}} {{.*}}
// LDGARANGE-NOT: -generate-arange-section"
// LDGARANGE-NOT: "-plugin-opt=-generate-arange-section"
// LLDGARANGE: {{".*lld.*"}} {{.*}} "-plugin-opt=-generate-arange-section"
// SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options= -generate-arange-section"
// SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options= -generate-arange-section"

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/lto-jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin -flto-jobs=5 2> %t
// RUN: FileCheck -check-prefix=CHECK-PS4-LINK-THIN-JOBS-ACTION < %t %s
//
// CHECK-PS4-LINK-THIN-JOBS-ACTION: "-lto-thin-debug-options= -threads=5"
// CHECK-PS4-LINK-THIN-JOBS-ACTION: "-lto-thin-debug-options= -generate-arange-section -threads=5"

// RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=thin -flto-jobs=5 2> %t
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS2-ACTION < %t %s
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Driver/ps4-linker.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// RUN: %clang --target=x86_64-scei-ps4 -flto=full -fjmc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-FULL-LTO,CHECK-LIB %s

// CHECK-NOT: -enable-jmc-instrument
// CHECK-THIN-LTO: "-lto-thin-debug-options= -enable-jmc-instrument"
// CHECK-FULL-LTO: "-lto-debug-options= -enable-jmc-instrument"
// CHECK-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -enable-jmc-instrument"
// CHECK-FULL-LTO: "-lto-debug-options= -generate-arange-section -enable-jmc-instrument"

// Check the default library name.
// CHECK-LIB: "--whole-archive" "-lSceDbgJmc" "--no-whole-archive"
Expand All @@ -16,5 +16,5 @@
// RUN: %clang --target=x86_64-scei-ps4 -flto=thin -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-THIN-LTO %s
// RUN: %clang --target=x86_64-scei-ps4 -flto=full -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-FULL-LTO %s

// CHECK-DIAG-THIN-LTO: "-lto-thin-debug-options= -crash-diagnostics-dir=mydumps"
// CHECK-DIAG-FULL-LTO: "-lto-debug-options= -crash-diagnostics-dir=mydumps"
// CHECK-DIAG-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps"
// CHECK-DIAG-FULL-LTO: "-lto-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps"
5 changes: 1 addition & 4 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)

UseLocSection = !TT.isNVPTX();

// Always emit .debug_aranges for SCE tuning.
UseARangesSection = GenerateARangeSection || tuneForSCE();

HasAppleExtensionAttributes = tuneForLLDB();

// Handle split DWARF.
Expand Down Expand Up @@ -1453,7 +1450,7 @@ void DwarfDebug::endModule() {
emitDebugInfo();

// Emit info into a debug aranges section.
if (UseARangesSection)
if (GenerateARangeSection)
emitDebugARanges();

// Emit info into a debug ranges section.
Expand Down
3 changes: 0 additions & 3 deletions llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,6 @@ class DwarfDebug : public DebugHandlerBase {
///Allow emission of the .debug_loc section.
bool UseLocSection = true;

/// Allow emission of .debug_aranges section
bool UseARangesSection = false;

/// Generate DWARF v4 type units.
bool GenerateTypeUnits;

Expand Down
33 changes: 0 additions & 33 deletions llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.ll

This file was deleted.

0 comments on commit 84658fb

Please sign in to comment.