[PATCH] D13650: ARM/ELF: Better codegen for global variable addresses.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 07:02:50 PDT 2015


pcc created this revision.
pcc added reviewers: jmolloy, t.p.northover.
pcc added a subscriber: llvm-commits.
Herald added subscribers: danalbert, tberghammer, rengolin, aemerson.

In PIC mode we were previously computing global variable addresses (or GOT
entry addresses) by adding the PC, the PC-relative GOT displacement and
the GOT-relative symbol/GOT entry displacement. Because the latter two
displacements are fixed, we ended up performing one more addition than
necessary.

This change causes us to compute addresses using a single PC-relative
displacement, resulting in a shorter code sequence. This reduces code size
by about 4% in a recent build of Chromium for Android.

As a result of this change we no longer need to compute the GOT base address
in the ARM backend, which allows us to remove the Global Base Reg pass and
SDAG lowering for the GOT.

http://reviews.llvm.org/D13650

Files:
  include/llvm/MC/MCExpr.h
  lib/MC/MCExpr.cpp
  lib/Target/ARM/ARM.h
  lib/Target/ARM/ARMAsmPrinter.cpp
  lib/Target/ARM/ARMBaseInstrInfo.cpp
  lib/Target/ARM/ARMConstantPoolValue.cpp
  lib/Target/ARM/ARMConstantPoolValue.h
  lib/Target/ARM/ARMFastISel.cpp
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ARMISelLowering.h
  lib/Target/ARM/ARMInstrInfo.cpp
  lib/Target/ARM/ARMMachineFunctionInfo.cpp
  lib/Target/ARM/ARMMachineFunctionInfo.h
  lib/Target/ARM/ARMTargetMachine.cpp
  lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
  test/CodeGen/ARM/emutls.ll
  test/CodeGen/ARM/fast-isel-pic.ll
  test/CodeGen/ARM/globals.ll
  test/CodeGen/ARM/load-global.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13650.37105.patch
Type: text/x-patch
Size: 27016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/be920f3a/attachment-0001.bin>


More information about the llvm-commits mailing list