[LLVMdev] Can a name in LLVM assembly language hold two types of value at the same time

Nick Lewycky nicholas at mxc.ca
Wed Sep 6 20:24:48 PDT 2006


Zhongxing Xu wrote:
> After line 8, %tmp holds a pointer to stack, whose type is int*
> After line 12, %tmp holds a pointer to heap, whose type is sbyte*

Yes, the same name can be used for two different variables of two
different types. It's an annoying quirk, but otherwise harmless. When
reading such code, just keep an eye on the type of each instruction so
that you don't get the two confused.

In your case, there are three variables with the same name: one int*
defined on line 8, one sbyte* on line 12 and one int on line 17. The
sbyte* is only used on line 13 and the int is only used in line 18. The
others are all the int* variable.

Nick Lewycky



More information about the llvm-dev mailing list