public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "alga at rgai dot hu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/11824] New: [ARM] Parameter passing via stack could be improved Date: Wed, 06 Aug 2003 08:52:00 -0000 [thread overview] Message-ID: <20030806085250.11824.alga@rgai.hu> (raw) 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}
next reply other threads:[~2003-08-06 8:52 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-08-06 8:52 alga at rgai dot hu [this message] 2003-08-11 12:44 ` [Bug target/11824] " pinskia at gcc dot gnu dot org 2003-08-25 15:56 ` [Bug optimization/11824] " dhazeghi at yahoo dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030806085250.11824.alga@rgai.hu \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).