Skip to content

Commit

Permalink
[DEBUG_INFO, NVPTX] Do not emit .debug_loc section.
Browse files Browse the repository at this point in the history
Summary:
.debug_loc section is not supported for NVPTX target. If there is an
object whose location can change during its lifetime, we do not generate
debug location info for this variable.

Reviewers: echristo

Subscribers: jholewinski, JDevlieghere, llvm-commits

Differential Revision: https://reviews.llvm.org/D48730

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335976 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
alexey-bataev committed Jun 29, 2018
1 parent 3b81d99 commit 6882f03
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 53 deletions.
5 changes: 5 additions & 0 deletions lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
else
UseInlineStrings = DwarfInlinedStrings == Enable;

UseLocSection = !TT.isNVPTX();

HasAppleExtensionAttributes = tuneForLLDB();

// Handle split DWARF.
Expand Down Expand Up @@ -1196,6 +1198,9 @@ void DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU,
RegVar->initializeDbgValue(MInsn);
continue;
}
// Do not emit location lists if .debug_loc secton is disabled.
if (!useLocSection())
continue;

// Handle multiple DBG_VALUE instructions describing one variable.
DebugLocStream::ListBuilder List(DebugLocs, TheCU, *Asm, *RegVar, *MInsn);
Expand Down
8 changes: 7 additions & 1 deletion lib/CodeGen/AsmPrinter/DwarfDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ class DwarfDebug : public DebugHandlerBase {
/// temp symbols inside DWARF sections.
bool UseSectionsAsReferences = false;

///Allow emission of the .debug_loc section.
bool UseLocSection = true;

/// DWARF5 Experimental Options
/// @{
AccelTableKind TheAccelTableKind;
Expand Down Expand Up @@ -526,7 +529,7 @@ class DwarfDebug : public DebugHandlerBase {
/// Returns whether to use inline strings.
bool useInlineStrings() const { return UseInlineStrings; }

/// Returns whether GNU oub sections should be emitted.
/// Returns whether GNU pub sections should be emitted.
bool usePubSections() const { return UsePubSections; }

/// Returns whether ranges section should be emitted.
Expand All @@ -537,6 +540,9 @@ class DwarfDebug : public DebugHandlerBase {
return UseSectionsAsReferences;
}

/// Returns whether .debug_loc section should be emitted.
bool useLocSection() const { return UseLocSection; }

// Experimental DWARF5 features.

/// Returns what kind (if any) of accelerator tables to emit.
Expand Down
64 changes: 12 additions & 52 deletions test/DebugInfo/NVPTX/debug-loc-offset.ll
Original file line number Diff line number Diff line change
Expand Up @@ -127,40 +127,6 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
!33 = !DILocation(line: 11, scope: !32)
!34 = !DILocation(line: 12, scope: !14)


; CHECK: // .section .debug_loc
; CHECK: // {
; CHECK: Ldebug_loc0:
; CHECK: // .b64 Lfunc_begin0-Lfunc_begin0
; CHECK: // .b64 Ltmp0-Lfunc_begin0
; CHECK: // .b8 2 // Loc expr size
; CHECK: // .b8 0
; CHECK: // .b8 17 // DW_OP_consts
; CHECK: // .b8 0 // 0
; CHECK: // .b64 Ltmp0-Lfunc_begin0
; CHECK: // .b64 Lfunc_end0-Lfunc_begin0
; CHECK: // .b8 2 // Loc expr size
; CHECK: // .b8 0
; CHECK: // .b8 17 // DW_OP_consts
; CHECK: // .b8 1 // 1
; CHECK: // .b64 0
; CHECK: // .b64 0
; CHECK: Ldebug_loc1:
; CHECK: // .b64 Ltmp2-Lfunc_begin1
; CHECK: // .b64 Ltmp2-Lfunc_begin1
; CHECK: // .b8 2 // Loc expr size
; CHECK: // .b8 0
; CHECK: // .b8 17 // DW_OP_consts
; CHECK: // .b8 2 // 2
; CHECK: // .b64 Ltmp2-Lfunc_begin1
; CHECK: // .b64 Lfunc_end1-Lfunc_begin1
; CHECK: // .b8 2 // Loc expr size
; CHECK: // .b8 0
; CHECK: // .b8 17 // DW_OP_consts
; CHECK: // .b8 3 // 3
; CHECK: // .b64 0
; CHECK: // .b64 0
; CHECK: // }
; CHECK: // .section .debug_abbrev
; CHECK: // {
; CHECK: // .b8 1 // Abbreviation Code
Expand Down Expand Up @@ -214,8 +180,6 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 4 // Abbreviation Code
; CHECK: // .b8 52 // DW_TAG_variable
; CHECK: // .b8 0 // DW_CHILDREN_no
; CHECK: // .b8 2 // DW_AT_location
; CHECK: // .b8 6 // DW_FORM_data4
; CHECK: // .b8 3 // DW_AT_name
; CHECK: // .b8 8 // DW_FORM_string
; CHECK: // .b8 58 // DW_AT_decl_file
Expand Down Expand Up @@ -251,8 +215,6 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 6 // Abbreviation Code
; CHECK: // .b8 5 // DW_TAG_formal_parameter
; CHECK: // .b8 0 // DW_CHILDREN_no
; CHECK: // .b8 2 // DW_AT_location
; CHECK: // .b8 6 // DW_FORM_data4
; CHECK: // .b8 3 // DW_AT_name
; CHECK: // .b8 8 // DW_FORM_string
; CHECK: // .b8 58 // DW_AT_decl_file
Expand All @@ -278,12 +240,12 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // }
; CHECK: // .section .debug_info
; CHECK: // {
; CHECK: // .b32 152 // Length of Unit
; CHECK: // .b32 148 // Length of Unit
; CHECK: // .b8 2 // DWARF version number
; CHECK: // .b8 0
; CHECK: // .b32 .debug_abbrev // Offset Into Abbrev. Section
; CHECK: // .b8 8 // Address Size (in bytes)
; CHECK: // .b8 1 // Abbrev [1] 0xb:0x91 DW_TAG_compile_unit
; CHECK: // .b8 1 // Abbrev [1] 0xb:0x8d DW_TAG_compile_unit
; CHECK: // .b8 99 // DW_AT_producer
; CHECK: // .b8 108
; CHECK: // .b8 97
Expand Down Expand Up @@ -359,7 +321,7 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 65 // DW_AT_name
; CHECK: // .b8 0
; CHECK: // .b8 1 // DW_AT_declaration
; CHECK: // .b8 3 // Abbrev [3] 0x68:0x33 DW_TAG_subprogram
; CHECK: // .b8 3 // Abbrev [3] 0x68:0x2f DW_TAG_subprogram
; CHECK: // .b64 Lfunc_begin1 // DW_AT_low_pc
; CHECK: // .b64 Lfunc_end1 // DW_AT_high_pc
; CHECK: // .b8 95 // DW_AT_MIPS_linkage_name
Expand All @@ -378,21 +340,20 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 2 // DW_AT_decl_file
; CHECK: // .b8 6 // DW_AT_decl_line
; CHECK: // .b8 1 // DW_AT_external
; CHECK: // .b8 4 // Abbrev [4] 0x89:0x11 DW_TAG_variable
; CHECK: // .b32 Ldebug_loc1 // DW_AT_location
; CHECK: // .b8 4 // Abbrev [4] 0x89:0xd DW_TAG_variable
; CHECK: // .b8 122 // DW_AT_name
; CHECK: // .b8 0
; CHECK: // .b8 2 // DW_AT_decl_file
; CHECK: // .b8 7 // DW_AT_decl_line
; CHECK: // .b64 .debug_info+306 // DW_AT_type
; CHECK: // .b64 .debug_info+298 // DW_AT_type
; CHECK: // .b8 0 // End Of Children Mark
; CHECK: // .b8 0 // End Of Children Mark
; CHECK: // .b32 154 // Length of Unit
; CHECK: // .b32 150 // Length of Unit
; CHECK: // .b8 2 // DWARF version number
; CHECK: // .b8 0
; CHECK: // .b32 .debug_abbrev // Offset Into Abbrev. Section
; CHECK: // .b8 8 // Address Size (in bytes)
; CHECK: // .b8 1 // Abbrev [1] 0xb:0x93 DW_TAG_compile_unit
; CHECK: // .b8 1 // Abbrev [1] 0xb:0x8f DW_TAG_compile_unit
; CHECK: // .b8 99 // DW_AT_producer
; CHECK: // .b8 108
; CHECK: // .b8 97
Expand Down Expand Up @@ -464,7 +425,7 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 0
; CHECK: // .b64 Lfunc_begin0 // DW_AT_low_pc
; CHECK: // .b64 Lfunc_end0 // DW_AT_high_pc
; CHECK: // .b8 5 // Abbrev [5] 0x64:0x32 DW_TAG_subprogram
; CHECK: // .b8 5 // Abbrev [5] 0x64:0x2e DW_TAG_subprogram
; CHECK: // .b64 Lfunc_begin0 // DW_AT_low_pc
; CHECK: // .b64 Lfunc_end0 // DW_AT_high_pc
; CHECK: // .b8 95 // DW_AT_MIPS_linkage_name
Expand All @@ -481,17 +442,16 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK: // .b8 0
; CHECK: // .b8 1 // DW_AT_decl_file
; CHECK: // .b8 1 // DW_AT_decl_line
; CHECK: // .b32 150 // DW_AT_type
; CHECK: // .b32 146 // DW_AT_type
; CHECK: // .b8 1 // DW_AT_external
; CHECK: // .b8 6 // Abbrev [6] 0x88:0xd DW_TAG_formal_parameter
; CHECK: // .b32 Ldebug_loc0 // DW_AT_location
; CHECK: // .b8 6 // Abbrev [6] 0x88:0x9 DW_TAG_formal_parameter
; CHECK: // .b8 98 // DW_AT_name
; CHECK: // .b8 0
; CHECK: // .b8 1 // DW_AT_decl_file
; CHECK: // .b8 1 // DW_AT_decl_line
; CHECK: // .b32 150 // DW_AT_type
; CHECK: // .b32 146 // DW_AT_type
; CHECK: // .b8 0 // End Of Children Mark
; CHECK: // .b8 7 // Abbrev [7] 0x96:0x7 DW_TAG_base_type
; CHECK: // .b8 7 // Abbrev [7] 0x92:0x7 DW_TAG_base_type
; CHECK: // .b8 105 // DW_AT_name
; CHECK: // .b8 110
; CHECK: // .b8 116
Expand Down

0 comments on commit 6882f03

Please sign in to comment.