[LLVMdev] Question About the LLVM IR unnamed values!
Jin Huang
54jin.huang at gmail.com
Tue Jan 14 00:09:57 PST 2014
Hi.
I found that, in all the LLVM IR I get from the source C file. the unnamed
values all created by the "load" instruction. eg:
; Function Attrs: nounwind uwtable
define i32 @add(i32 %x, i32 %y) #0 {
entry:
%x.addr = alloca i32, align 4
%y.addr = alloca i32, align 4
%c = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
store i32 %y, i32* %y.addr, align 4
* %0 = load i32* %x.addr, align 4*
* %1 = load i32* %y.addr, align 4*
%add = add nsw i32 %0, %1
store i32 %add, i32* %c, align 4
%2 = load i32* %c, align 4
ret i32 %2
}
; Function Attrs: nounwind uwtable
define i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%a = alloca i32, align 4
%b = alloca i32, align 4
%d = alloca i32, align 4
%f = alloca i32, align 4
%g = alloca i32, align 4
%e = alloca i32, align 4
store i32 0, i32* %retval
store i32 8, i32* %a, align 4
store i32 9, i32* %b, align 4
* %0 = load i32* %a, align 4*
* %1 = load i32* %b, align 4*
%add = add nsw i32 %0, %1
store i32 %add, i32* %d, align 4
* %2 = load i32* %a, align 4*
* %3 = load i32* %d, align 4*
%add1 = add nsw i32 %2, %3
store i32 %add1, i32* %f, align 4
* %4 = load i32* %f, align 4*
* %5 = load i32* %b, align 4*
%add2 = add nsw i32 %4, %5
store i32 %add2, i32* %g, align 4
* %6 = load i32* %d, align 4*
* %7 = load i32* %b, align 4*
%call = call i32 @add(i32 %6, i32 %7)
store i32 %call, i32* %e, align 4
%call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str, i32 0, i32 0), i32* %a)
%call4 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str1, i32 0, i32 0), i32* %b)
%call5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str2, i32 0, i32 0), i32* %e)
%call6 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str, i32 0, i32 0), i32* %d)
%call7 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str, i32 0, i32 0), i32* %g)
%call8 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([14 x
i8]* @.str, i32 0, i32 0), i32* %f)
ret i32 0
}
the "add" instructions all have names like "%add", "%add1",etc.But the
"load" instruction all use "%n".
is that means the unnamed instructions like "%0 %1" all created by the
"load" instructions? is there any other type instructions can create
unnamed values?
Thanks!
--
Kind Regards!
-Jin Huang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140114/2c8e3ca2/attachment.html>
More information about the llvm-dev
mailing list