This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about compiling consideration(GNUPro, GCC for SPARC)? Thanks


Hi all:
     Does anyone know a little detail about how the compiler works? Thanks a
lot.

As in Sparc there are %lx, %ix, %ox, %gx,
eg.

"in example.c"
int k;
int fun1(int a)
{ int a,b,c,d;
  b = 2;
  c = a+b;
  k = c*2;
  d = 3*a;
  a = a+b+c+d;
  a +=k;
  return a;
}

void main()
{ int e,f,g,h;
  e = 2;
  f = fun1(e);
  g = fun1(f);
  h =  fun_ass(e);
}

in "example.S"
fun_ass:
	add %o0, 1, %o0
                mov  12, %g0
                retl
                nop

Q1. when compiled what type of register will (%lx, %ox, %gx, %ix) be used
for any local variable or gloable variable in the function written in "C"?

Q2. In the function written in Assembly language %g0 has been used, so do I
need to restore %g0 to the original value before exit this function? (note:
no new register window opened here), If any register has been modified does
it need to be restored before exiting?

Q3. what type of register can I use freely in assembly code without backup
its original value?

Q4. In the ABI docs it says some registers are call-clobbered or
call-preserved, what's the exact meaning of that?


look forward to hearing from you

Thanks a lot.





-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]