public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33725] New: Could eliminate argument push for the second const function for same arguments
@ 2007-10-10 12:58 ubizjak at gmail dot com
2007-12-02 22:06 ` [Bug target/33725] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: ubizjak at gmail dot com @ 2007-10-10 12:58 UTC (permalink / raw)
To: gcc-bugs
This testcase:
--cut here--
extern const int foo (int a);
extern const int bar (int a);
int test (int a)
{
return foo (a) + bar (a);
}
--cut here--
compiles to:
test:
subl $12, %esp
movl %ebx, 4(%esp)
movl 16(%esp), %ebx
movl %esi, 8(%esp)
movl %ebx, (%esp) (*)
call foo
movl %ebx, (%esp) (**)
movl %eax, %esi
call bar
movl 4(%esp), %ebx
addl %esi, %eax
movl 8(%esp), %esi
addl $12, %esp
ret
However, since argument is already pushed to the stack for foo(), there is no
need to push it again for the bar() function [foo() is const function]. If gcc
eliminates the second push, a call-clobbered reg could be used to move argument
to (esp), resulting in something like:
test:
subl $12, %esp
movl 16(%esp), %eax
movl %esi, 8(%esp)
movl %eax, (%esp)
call foo
movl %eax, %esi
call bar
addl %esi, %eax
movl 8(%esp), %esi
addl $12, %esp
ret
--
Summary: Could eliminate argument push for the second const
function for same arguments
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ubizjak at gmail dot com
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33725
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/33725] Could eliminate argument push for the second const function for same arguments
2007-10-10 12:58 [Bug c/33725] New: Could eliminate argument push for the second const function for same arguments ubizjak at gmail dot com
@ 2007-12-02 22:06 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-02 22:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-12-02 22:06 -------
I don't think this could be done.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33725
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-02 22:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-10 12:58 [Bug c/33725] New: Could eliminate argument push for the second const function for same arguments ubizjak at gmail dot com
2007-12-02 22:06 ` [Bug target/33725] " 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).