[LLVMdev] where does %a_addr.0 come from?

Lang Hames lhames at gmail.com
Thu Sep 23 06:56:39 PDT 2010


Elaborating slightly - The mem2reg pass hoists values from memory into
registers. It was responsible for adding %a_addr.0 and the PHI node which
defines it.

- Lang.

On Thu, Sep 23, 2010 at 11:44 PM, Lang Hames <lhames at gmail.com> wrote:

> Hi Maarten,
>
> If you look at the start of basic block 2 (bb2) you'll see the following instruction:
>
>  %a_addr.0 = phi i32 [ 1, %bb ], [ 0, %bb1 ]     ; <i32> [#uses=1]
>
> This is an SSA phi node which assigns a value of either 1 or 0 to %a_addr.0
> depending on whether control reached the PHI node from basic block bb, or
> bb1.
>
> - Lang.
>
> On Thu, Sep 23, 2010 at 11:26 PM, maarten faddegon <
> m.faddegon at student.tudelft.nl> wrote:
>
>> Hi,
>>
>> I am studying SSA and some time ago I asked on this list how to see the
>> phi nodes in the llvm ir output. I learned then to use this command:
>> opt -mem2reg test.ll -S > test_mem2reg.ll
>>
>> However, if you look at the output (attached to this message) there is
>> something I do not understand. At the end of the function @f at line 18,
>> the function returns the variable %a_addr.0. However, this variable is
>> never defined or set. The variable %a is. Is "_addr.0"  a way to get the
>> address of a variable? I could not find anything about this in in LLVM
>> language reference manual.
>> Where does this variable come from?
>>
>>
>> thanks,
>>   Maarten Faddegon
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100923/c9818676/attachment.html>


More information about the llvm-dev mailing list