hi,
I'm trying to understand the register windows
implementation in xtensa backend.I could not find much theory about
register windows in extensa.I am trying to understand the register
windows implementation by observing the assembly file generated by gcc
for a simple c file.
Following is the c file and generated assembly file
/************hello.c**********/
int foo(int a)
{
int b;
a=a+1;
b=a;
}
void main(void)
{
int a;
int b;
b=a+1;
foo(b);
}
/*************hello.s***************/
.file "hello.c"
.text
.align 4
.global foo
.type foo, @function
foo:
.frame a7, 64
entry sp, 64
mov.n a7, sp
s32i.n a2, a7, 16
l32i.n a3, a7, 16
addi.n a3, a3, 1
s32i.n a3, a7, 16
l32i.n a3, a7, 16
s32i.n a3, a7, 0
retw.n
.size foo, .-foo
.align 4
.global main
.type main, @function
main:
.frame a7, 48
entry sp, 48
mov.n a7, sp
l32i.n a8, a7, 4
addi.n a8, a8, 1
s32i.n a8, a7, 0
l32i.n a10, a7, 0
call8 foo
retw.n
.size main, .-main
.ident "GCC: (GNU) 4.1.0"
/*******************/
Uptill now i've worked with MIPS and intel which use the stack based
argument passing mechnism.So i'm feeling extremly hard to track how
variables are being created and passed to other function in assembly
file.
Would you please give me some explaination about how variables are
being created ,how arguments are being passed and how register window
is being changed for "foo" function.How the argument is being passed
and then retrieved in "foo" function.
In sparc architecture a register window contains three groups of
registers i.e out,in,local.Is there any such kind of division in a
visible window in xtensa.
thanks,
shaz