strange move of __asm__
Jeffrey A Law
law@hurl.cygnus.com
Wed Mar 31 23:54:00 GMT 1999
In message < 199903181452.PAA01522@jet.franken.de >you write:
> (WINAPI is a #define for __attribute__((__stdcall__)), TEB is a struct)
>
> It compiles to the following (correct working) assemblercode on i386 on
> "gcc version egcs-2.93.12 19990314 (gcc2 ss-980929 experimental)":
>
> 000000fc <NtCurrentTeb>:
> fc: b8 18 00 00 00 movl $0x18,%eax
> 101: 64 8b 00 movl %fs:(%eax),%eax
> 104: 55 pushl %ebp
> 105: 89 e5 movl %esp,%ebp
> 107: 89 ec movl %ebp,%esp
> 109: 5d popl %ebp
> 10a: c3 ret
>
> egcs has moved the __asm__ outside the stackframe enter/leave. Now,
> should this happen?
There's nothing which prevents it -- movement of instructions is constrained
by data dependency. There are no data dependencies between the asm and the
prologue/epilogue code, so there's nothing to prevent the movement of the
asm.
> And couldn't egcs optimize the framestuff away if nothing is inside it?
If you compile with -fomit-frame-pointer it probably will.
jeff
More information about the Gcc-bugs
mailing list