Date: Sun, 27 Dec 1998 01:47:49 -0300 (ART) From: "Fernando P. Schapachnik" <fpscha@localhost.schapachnik.com.ar> To: bright@hotjobs.com (Alfred Perlstein) Cc: paipai@tin.it, freebsd-sparc@FreeBSD.ORG Subject: Re: Cross compiled code Message-ID: <199812270447.BAA00291@localhost.schapachnik.com.ar> In-Reply-To: <Pine.BSF.4.05.9812220941370.6331-100000@bright.fx.genx.net> from Alfred Perlstein at "Dec 22, 98 09:45:37 am"
next in thread | previous in thread | raw e-mail | index | archive | help
En un mensaje anterior Alfred Perlstein escribió:
> > ----- the original program prova.c (c code) -------
> >
> >
> > main(){
> > int a,b;
> >
> > a = 10;
> > b = 20 + a;
> > }
> >
> > --------------------------------------------
> >
> > compiled with xgcc -S
> >
> > --------------------------------------------
> > .file "prova.c"
> > .section ".text"
> > .align 4
> > .global main
> > .type main,#function
> > .proc 04
> > main:
> > !#PROLOGUE# 0
> > save %sp,-208,%sp ! adjust stack fram
> > !#PROLOGUE# 1
> > mov 10,%o0 ! a = 10
> > st %o0,[%fp+2027] ! this looks fishy 2027 looks a bit high(*)
> > ld [%fp+2027],%o0 ! fishy (*)
> > add %o0,20,%o1 ! a + 20 ->
> > st %o1,[%fp+2023] ! fishy (*)
The compiler is saving a and b in memory because they are atomic
variables and it's asumming something like "every atomic variable must
reside in memory, except when explicitly stated register".
You should try compiling with -O.
Regards and happy new year!
> > .LL1:
> > return %i7+8
> > nop
> > .LLfe1:
> > .size main,.LLfe1-main
> > .ident "GCC: (GNU) egcs-2.91.60 19981201 (egcs-1.1.1 release)"
> >
> > ---------------------------------------------------------------
Fernando P. Schapachnik
fernando@schapachnik.com.ar
/-------------------------------------------\
| Atención: Mensaje generado en entorno |
| libre de productos MicroChot. |
| No contiene HTML, adjuntos en Worst, |
| ni basura similar. Leer con tranquilidad. |
\-------------------------------------------/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812270447.BAA00291>
