From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26957 invoked by alias); 6 Jul 2009 10:43:16 -0000 Received: (qmail 26925 invoked by uid 48); 6 Jul 2009 10:43:05 -0000 Date: Mon, 06 Jul 2009 10:43:00 -0000 Message-ID: <20090706104305.26924.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/40657] allocate local variables with fewer instructions In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "steven at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg00426.txt.bz2 ------- 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] ) [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