[LLVMdev] [ARM] [PIC] optimizing the loading of hidden global variable
Rafael EspĂndola
rafael.espindola at gmail.com
Fri Mar 14 13:48:54 PDT 2014
On 14 March 2014 14:34, Weiming Zhao <weimingz at codeaurora.org> wrote:
> Hi Rafael,
>
> Yes, merging gv prevents linker to do garbage collection. Should it be implemented as a peephole pass? If we do it too early, the distance between GVs are not fixed yet.
Correct. It would be somewhere in CodeGen, I am not exactly sure where.
> PS:
> Below is the GCC output with "extern" hidden:
> ldr r2, .L2
> stmfd sp!, {r3, lr}
> .save {r3, lr}
> .LPIC0:
> add r0, pc, r2
> bl _Z4initPv(PLT)
> ldr r1, .L2+4
> .LPIC1:
> add r0, pc, r1
> bl _Z4initPv(PLT)
> ldr r0, .L2+8
> .LPIC2:
> add r0, pc, r0
> ldmfd sp!, {r3, lr}
> b _Z4initPv(PLT)
> .L3:
> .align 2
> .L2:
> .word g0-(.LPIC0+8)
> .word g1-(.LPIC1+8)
> .word g2-(.LPIC2+8)
That is pretty neat too.
Cheers,
Rafael
More information about the llvm-dev
mailing list