[PATCH] D15635: AsmPrinter: Produce PC-relative cstexprs when possible.

Joe Groff via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 20:18:47 PST 2015


jckarter created this revision.
jckarter added a reviewer: lhames.
jckarter added a subscriber: llvm-commits.

When a constant expr is relative to the constant `foo` currently being emitted, transform it from the form `bar-foo+n` to `bar-.+m`. MC will naively assemble the former version into a subtractor relocation, which isn't always supported, for instance in most ELF platforms. PC-relative relocations with offsets are more widely supported and better tested in most linkers.

http://reviews.llvm.org/D15635

Files:
  lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  test/MC/COFF/cross-section-relative.ll
  test/MC/ELF/cstexpr-pcrel.ll
  test/MC/MachO/AArch64/cstexpr-gotpcrel.ll
  test/MC/MachO/ARM/cstexpr-gotpcrel.ll
  test/MC/MachO/cstexpr-gotpcrel-32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15635.43207.patch
Type: text/x-patch
Size: 11227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151218/f2537f65/attachment.bin>


More information about the llvm-commits mailing list