[LLVMdev] Instructions having variable names as operands
Chris Lattner
sabre at nondot.org
Tue Dec 19 22:31:43 PST 2006
On Wed, 20 Dec 2006, Seung Jae Lee wrote:
> Dear Mr. Lattner:
> Thank you for kind information.
> I am still a little confused, though.
>
> In your example,
> %X = add int %Y, %Z
> is generated to
> add EAX, EBX
>
> I think EAX and EBX are the register names of X86.
> But, I should emit variable names instead of register names.
>
> For my example in the source code,
> int k;
> k = i + j;
> should be emit like this:
> reg k
> add i,j;k
> (If register names are still used, this can be shown like this:
> reg EAX
> add EAX,EBX;EAX
> Isn't it?
> )
> Would you mind telling me w.r.t this?
> Thank you very much.
How does your "instruction set" handle code like:
int foo() {
int X = 1; // X1
if (somecond) {
int X = 2; // X2
return X;
}
return X;
}
Surely you don't have full source language scoping rules. If you want
this, you need to look at debug info.
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list