[all-commits] [llvm/llvm-project] 165f70: [AVR] Don't adjust addresses by 2 for absolute values

Ayke via All-commits all-commits at lists.llvm.org
Wed Feb 26 11:32:33 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 165f707f9d0fb227e30b9a57d8ceb27f55032f90
      https://github.com/llvm/llvm-project/commit/165f707f9d0fb227e30b9a57d8ceb27f55032f90
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
    A llvm/test/MC/AVR/relocations-abs.s

  Log Message:
  -----------
  [AVR] Don't adjust addresses by 2 for absolute values

Adjusting by 2 breaks DWARF output. With this fix, programs start to
compile and produce valid DWARF output.

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


  Commit: 6afc3de42f8f65dfa2e51b0e81e95ef6427be9ac
      https://github.com/llvm/llvm-project/commit/6afc3de42f8f65dfa2e51b0e81e95ef6427be9ac
  Author: Ayke van Laethem <aykevanlaethem at gmail.com>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp
    M llvm/test/CodeGen/AVR/branch-relaxation-long.ll
    M llvm/test/CodeGen/AVR/branch-relaxation.ll
    M llvm/test/CodeGen/AVR/ctlz.ll
    M llvm/test/CodeGen/AVR/cttz.ll
    M llvm/test/CodeGen/AVR/integration/blink.ll
    M llvm/test/CodeGen/AVR/rot.ll
    M llvm/test/CodeGen/AVR/smul-with-overflow.ll
    M llvm/test/CodeGen/AVR/umul-with-overflow.ll

  Log Message:
  -----------
  [AVR] Fix private label prefix

This is a small pet peeve from me. This change makes sure the AVR backend uses
the correct private label prefix (.L) so that private labels are hidden in
avr-objdump.

Example code:

    define i8 @foo(i1 %cond) {
      br i1 %cond, label %then, label %else
    then:
      ret i8 3
    else:
      ret i8 5
    }

When compiling this:
  llc -march=avr -filetype=obj -o test.o test.ll
and then dumping it:
  avr-objdump -d test.o
You would previously get an ugly temporary label:

    00000000 <foo>:
       0:        81 70       andi       r24, 0x01    ; 1
       2:        80 30       cpi        r24, 0x00    ; 0
       4:        f9 f3       breq       .-2          ; 0x4 <foo+0x4>
       6:        83 e0       ldi        r24, 0x03    ; 3
       8:        08 95       ret

    0000000a <LBB0_2>:
       a:        85 e0       ldi        r24, 0x05    ; 5
       c:        08 95       ret

This patch fixes that, the output is now:

    00000000 <foo>:
       0:        81 70       andi       r24, 0x01    ; 1
       2:        80 30       cpi        r24, 0x00    ; 0
       4:        01 f0       breq       .+0          ; 0x6 <foo+0x6>
       6:        83 e0       ldi        r24, 0x03    ; 3
       8:        08 95       ret
       a:        85 e0       ldi        r24, 0x05    ; 5
       c:        08 95       ret

Note that as you can see the breq operand is different. However it is
still the same after linking:

       4:        11 f0       breq       .+4

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


Compare: https://github.com/llvm/llvm-project/compare/56f7de5baae3...6afc3de42f8f


More information about the All-commits mailing list