[llvm-dev] why clang compile local to global
liuyu11@ict.ac.cn via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 27 23:09:43 PST 2016
Hello,everyone:
I want to known how to let clang compile my local array to local variables:
I have the code :
int main()
{
int a[3]={1,2,3};
int b=7;
int c=8;
int d=9;
int e=10;
int f=11;
test(b,c,d,e,f,a);
return 0;
}
I use clang command:clang --target=mipsel -emit-llvm -S a.c -o a.ll
The a.ll is:
@main.a = private unnamed_addr constant [3 x i32] [i32 1, i32 2, i32 3], align 4
define i32 @main() #0 {
entry:
%retval = alloca i32, align 4
%a = alloca [3 x i32], align 4
%b = alloca i32, align 4
%c = alloca i32, align 4
%d = alloca i32, align 4
%e = alloca i32, align 4
%f = alloca i32, align 4
store i32 0, i32* %retval
%0 = bitcast [3 x i32]* %a to i8*
call void @llvm.memcpy.p0i8.p0i8.i32(i8* %0, i8* bitcast ([3 x i32]* @main.a to i8*), i32 12, i32 4, i1 false)
store i32 7, i32* %b, align 4
store i32 8, i32* %c, align 4
store i32 9, i32* %d, align 4
store i32 10, i32* %e, align 4
store i32 11, i32* %f, align 4
%1 = load i32, i32* %b, align 4
%2 = load i32, i32* %c, align 4
%3 = load i32, i32* %d, align 4
%4 = load i32, i32* %e, align 4
%5 = load i32, i32* %f, align 4
%arraydecay = getelementptr inbounds [3 x i32], [3 x i32]* %a, i32 0, i32 0
call void @test(i32 signext %1, i32 signext %2, i32 signext %3, i32 signext %4, i32 signext %5, i32* %arraydecay)
ret i32 0;}
I want to known how to compile local array a to a local variable
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161228/ec368366/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bg(12-28-15-08-4(12-28-15-09-26).jpg
Type: image/jpeg
Size: 71938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161228/ec368366/attachment-0001.jpg>
More information about the llvm-dev
mailing list