This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/40657] allocate local variables with fewer instructions



------- Comment #4 from steven at gcc dot gnu dot org  2009-07-06 10:43 -------
Ah, heh, so you're saying that pushing/popping registers you don't have to save
may be a size optimization? That's an interesting idea.

But how to do this in GCC...  The "push {lr}" is never even in the RTL.  Output
with same options + "-dAP":

foo:
        push    {lr}
        @ basic block 2
@(insn/f 20 2 21 t.c:3 (set (reg/f:SI 13 sp)
@        (plus:SI (reg/f:SI 13 sp)
@            (const_int -12 [0xfffffffffffffff4]))) 5 {*thumb1_addsi3} (nil))
@ 0x0000
        sub     sp, sp, #12     @ 20    *thumb1_addsi3/7        [length = 2]
@(insn 6 21 7 t.c:5 (set (reg:SI 0 r0)
@        (plus:SI (reg/f:SI 13 sp)
@            (const_int 4 [0x4]))) 5 {*thumb1_addsi3} (expr_list:REG_EQUAL
(plus:SI (reg/f:SI 13 sp)
@            (const_int 4 [0x4]))
@        (nil)))
@ 0x0002
        add     r0, sp, #4      @ 6     *thumb1_addsi3/6        [length = 2]
@(call_insn 7 6 13 t.c:5 (parallel [
@            (call (mem:SI (symbol_ref:SI ("bar") [flags 0x41] <function_decl
0x2000000000545200 bar>) [0 S4 A32])
@                (const_int 0 [0x0]))
@            (use (const_int 0 [0x0]))
@            (clobber (reg:SI 14 lr))
@        ]) 253 {*call_insn} (expr_list:REG_DEAD (reg:SI 0 r0)
@        (nil))
@    (expr_list:REG_DEP_TRUE (use (reg:SI 0 r0))
@        (nil)))
@ 0x0004
        bl      bar     @ 7     *call_insn      [length = 4]
@(insn 13 7 22 t.c:7 (set (reg/i:SI 0 r0)
@        (mem/c/i:SI (plus:SI (reg/f:SI 13 sp)
@                (const_int 4 [0x4])) [2 x+0 S4 A32])) 167 {*thumb1_movsi_insn}
(nil))
@ 0x0008
        ldr     r0, [sp, #4]    @ 13    *thumb1_movsi_insn/7    [length = 2]
@(insn 23 22 16 t.c:7 (set (reg/f:SI 13 sp)
@        (plus:SI (reg/f:SI 13 sp)
@            (const_int 12 [0xc]))) 5 {*thumb1_addsi3} (nil))
@ 0x000a
        add     sp, sp, #12     @ 23    *thumb1_addsi3/7        [length = 2]
@(insn 24 16 25 t.c:7 (unspec:SI [
@            (reg/f:SI 13 sp)
@        ] 6) 339 {prologue_use} (nil))
@ 0x000c
        @ sp needed for prologue        @ 24    prologue_use    [length = 0]
@(jump_insn 25 24 26 t.c:7 (unspec_volatile [
@            (return)
@        ] 1) 321 {*epilogue_insns} (nil))
@ 0x000c
        pop     {pc}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40657


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]