[LLVMdev] Instructions having variable names as operands
Seung Jae Lee
lee225 at uiuc.edu
Wed Dec 20 02:44:06 PST 2006
Dear Mr. Lattner:
You have asked me how my instruction set works.
If I code like this:
int foo1()
{
int x1,x2;
x1 =1;
x2 = foo2(x1);
return x2;
}
int foo2(int k)
{
if(k == 1)
k = 2;
return k;
}
int main ()
{
int j;
j = foo1();
}
This should be emitted like this:
Enter foo1;
reg x2, x1
add 1;x1
Call foo2;x1,x2
Exit foo1; x2
Enter foo2; k
reg temp0:1
cmp k,1;temp0
demultiplex m0;temp0;b1;b0
branch b0
add 2;k
unbranch b0
branch b1
unbranch b1
mux m0
Exit foo2; k
I am not sure about full source language scoping rules you mentioned. Would you mind telling me about that?
Thank you very much.
Seung Jae Lee
More information about the llvm-dev
mailing list