public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/11824] [ARM] Parameter passing via stack could be improved
[not found] <bug-11824-4@http.gcc.gnu.org/bugzilla/>
@ 2013-04-20 13:59 ` bpringlemeir at gmail dot com
0 siblings, 0 replies; 5+ messages in thread
From: bpringlemeir at gmail dot com @ 2013-04-20 13:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11824
Bill Pringlemeir <bpringlemeir at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bpringlemeir at gmail dot
| |com
--- Comment #4 from Bill Pringlemeir <bpringlemeir at gmail dot com> 2013-04-20 13:59:19 UTC ---
As far as I understand, the instruction stream is smaller, but there are two
extra memory writes to adjust the stack. This optimization is only important
for '-Os'. Generally, it will slow the code as data writes and code fetches
are generally the same cost and this trades 2 for 1.
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20030806085250.11824.loki@gcc.gnu.org>]
[parent not found: <20030806085250.11824.loki@inf.u-szeged.hu>]
* [Bug target/11824] New: [ARM] Parameter passing via stack could be improved
@ 2003-08-06 8:52 alga at rgai dot hu
2003-08-11 12:44 ` [Bug target/11824] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 5+ messages in thread
From: alga at rgai dot hu @ 2003-08-06 8:52 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11824
Summary: [ARM] Parameter passing via stack could be improved
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: alga at rgai dot hu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-elf
For each function that uses the stack for parameter passing GCC generally
first stores lr and decrements sp, and before returning it increments
sp and loads lr into pc.
If the number of the parameters is not too much, then GCC could perform the
parameter passing in a tricky way (as far as code size is concerned),
i.e. save some arbitrary registers with lr on the stack
(so the sp is modified implicitly).
--- c example ---
// arm-elf-gcc -S -g0 -Os -o param-stack.s param-stack.c
void func (int* a, int* b);
void foo ()
{
int a=6, b=7;
func(&a, &b);
}
--- asm code ---
foo:
mov ip, sp
stmfd sp!, {fp, ip, lr, pc} <- OLD
mov r3, #6
sub fp, ip, #4
sub sp, sp, #8 <- OLD
sub r0, fp, #16
str r3, [fp, #-16]
sub r1, fp, #20
add r3, r3, #1
str r3, [fp, #-20]
bl func
ldmea fp, {fp, sp, pc}
--- possible solution ---
foo:
mov ip, sp
stmfd sp!, {r1, r2, fp, ip, lr, pc} <-NEW
mov r3, #6
sub fp, ip, #4
sub r0, fp, #16
str r3, [fp, #-16]
sub r1, fp, #20
add r3, r3, #1
str r3, [fp, #-20]
bl func
ldmea fp, {fp, sp, pc}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-20 13:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-11824-4@http.gcc.gnu.org/bugzilla/>
2013-04-20 13:59 ` [Bug target/11824] [ARM] Parameter passing via stack could be improved bpringlemeir at gmail dot com
[not found] <20030806085250.11824.loki@gcc.gnu.org>
2005-09-02 11:21 ` steven at gcc dot gnu dot org
2005-09-02 12:39 ` rearnsha at gcc dot gnu dot org
[not found] <20030806085250.11824.loki@inf.u-szeged.hu>
2004-08-12 1:51 ` pinskia at gcc dot gnu dot org
2003-08-06 8:52 [Bug target/11824] New: " alga at rgai dot hu
2003-08-11 12:44 ` [Bug target/11824] " pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).