* useless trampoline address alignment
@ 1997-12-19 2:14 Philippe De Muyter
1997-12-28 12:00 ` Jeffrey A Law
0 siblings, 1 reply; 2+ messages in thread
From: Philippe De Muyter @ 1997-12-19 2:14 UTC (permalink / raw)
To: egcs mailing list
Testing trampolines, I have found some strange code generated to get the
address of the nested function. The code aligns an address that should
be generated correctly aligned. This is on m68k-motorola-sysv, but I surmise
it is target-independent. (this is with egcs-971127, but I am waiting
for the .cexp/14 chars filename problem fix before downloading a newer version)
Philippe De Muyter
Here is the testcase :
f()
{
int h(){}
char g[4096];
int i(){}
a(h);
a(i);
}
and the assembler code (m68k); look at <<<<<<<<<'s :
file "trampo.c"
gcc2_compiled%:
text
even
h_%2:
link.w %fp,&-4
mov.l %a0,-4(%fp)
unlk %fp
rts
even
i_%5:
link.w %fp,&-4
mov.l %a0,-4(%fp)
unlk %fp
rts
even
global f
f:
link.w %fp,&-4124
mov.l %a3,-(%sp)
mov.l %a2,-(%sp)
lea -4123(%fp),%a3 <<<<<<<<< ???
lea -4122(%fp),%a0 <<<<<<<<< That's the trampoline's address
mov.w &8316,(%a0)
mov.l %fp,2(%a0)
mov.w &20217,6(%a0)
mov.l &i_%5,8(%a0)
lea -4108(%fp),%a0
mov.w &8316,(%a0)
mov.l %fp,2(%a0)
mov.w &20217,6(%a0)
mov.l &h_%2,8(%a0)
pea -4108(%fp)
lea a,%a2
jsr (%a2)
mov.l %a3,%d0 <<<<<<<<<< ???
addq.l &1,%d0 <<<<<<<<<< ???
mov.l &-2,%d1 <<<<<<<<<< ???
and.l %d0,%d1 <<<<<<<<<< ???
mov.l %d1,-(%sp) <<<<<<<<<< Should be : pea -4122(%fp)
jsr (%a2)
mov.l -4132(%fp),%a2
mov.l -4128(%fp),%a3
unlk %fp
rts
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: useless trampoline address alignment
1997-12-19 2:14 useless trampoline address alignment Philippe De Muyter
@ 1997-12-28 12:00 ` Jeffrey A Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1997-12-28 12:00 UTC (permalink / raw)
To: Philippe De Muyter; +Cc: egcs mailing list
In message < 199712191014.LAA10079@mail.macqel.be >you write:
> Testing trampolines, I have found some strange code generated to get the
> address of the nested function. The code aligns an address that should
> be generated correctly aligned. This is on m68k-motorola-sysv, but I surmi se
> it is target-independent.
I think the code is just trying to be overly generic, and as a result
isn't as efficient as it could be on some machines like the m68k.
I believe the alignment is necessary for targets that do not define
a template (do we have any such targets?)
I don't think this is a very serious problem, so I'm not going to
dive further into it. However, if you want to try and optimize away
the useless rounding instructions I wouldn't object.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-12-28 12:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-19 2:14 useless trampoline address alignment Philippe De Muyter
1997-12-28 12:00 ` Jeffrey A Law
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).