[PATCH] D89613: make the AsmPrinterHandler array public

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 09:40:05 PST 2020


dstenb added a comment.

In D89613#2376068 <https://reviews.llvm.org/D89613#2376068>, @vtjnash wrote:

> The `.cfi_startproc` directive is part of the unwind information (eh_frame), and is not debug info, so that seems like a possible bugfix even? I'd expect that observation to be consistent with the goal of this PR, though I didn't see specifically where that pass was being affected in a cursory glance back through the PR.

But the `.cfi_startproc` directive may not only be for eh_frame, but can also be used for only emitting DWARF unwind information?

In a case like this:

  int main() {
    return 0;
  }



  clang --target=ppc main.c -S -gline-tables-only -mllvm -disable-debug-info-print=true

We will now emit CFI directives that only relevant for debug information:

   main:                                   # @main
   .Lfunc_begin0:
  +       .file   1 "/repo/edasten/llvm-project/llvm" "main.c"
  +       .loc    1 1 0                           # main.c:1:0
  +       .cfi_sections .debug_frame
  +       .cfi_startproc
   # %bb.0:                                # %entry
          stwu 1, -16(1)
          stw 31, 12(1)
  +       .cfi_def_cfa_offset 16
  +       .cfi_offset r31, -4
          mr      31, 1
  +       .cfi_def_cfa_register r31
          li 3, 0
          stw 3, 8(31)
  +.Ltmp0:
  +       .loc    1 2 3 prologue_end              # main.c:2:3
          lwz 31, 12(1)
          addi 1, 1, 16
          blr
  +.Ltmp1:
   .Lfunc_end0:
          .size   main, .Lfunc_end0-.Lfunc_begin0
  +       .cfi_endproc
                                           # -- End function
          .ident  "clang version 12.0.0"
          .section        ".note.GNU-stack","", at progbits
          .addrsig
  +       .section        .debug_line,"", at progbits
  +.Lline_table_start0:

Also `.file` and `.loc` directives, and a `.debug_line` section are emitted. I think that this should be considered as breaking the (although hidden) `-disable-debug-info-print` flag.

> The line of code you specifically mentioned was only added relatively recently, in 2018 (https://reviews.llvm.org/D53885), and made that behavior a bit odd. (The change causes FastISel to emit debug information if any DWARF information is present, even if there will not be a consumer of that information with no AsmPrinter in the pipeline)




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89613/new/

https://reviews.llvm.org/D89613



More information about the llvm-commits mailing list