[LLVMdev] where does %a_addr.0 come from?
maarten faddegon
m.faddegon at student.tudelft.nl
Thu Sep 23 06:26:56 PDT 2010
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
-------------- next part --------------
; ModuleID = 'test.ll'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
define i32 @f(i32 %a) nounwind {
entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%0 = sub nsw i32 %a, 5 ; <i32> [#uses=1]
%1 = icmp sgt i32 %0, 10 ; <i1> [#uses=1]
br i1 %1, label %bb, label %bb1
bb: ; preds = %entry
br label %bb2
bb1: ; preds = %entry
br label %bb2
bb2: ; preds = %bb1, %bb
%a_addr.0 = phi i32 [ 1, %bb ], [ 0, %bb1 ] ; <i32> [#uses=1]
br label %return
return: ; preds = %bb2
ret i32 %a_addr.0
}
define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%0 = call i32 @f(i32 %argc) nounwind ; <i32> [#uses=1]
br label %return
return: ; preds = %entry
ret i32 %0
}
More information about the llvm-dev
mailing list