I find this pattern as below from /test/CodeGen/Mips/alloca.ll, and want to know what front end pattern can be translated into this. Anybody know this answer?
%tmp1 = alloca i8, i32 %size, align 4 // has %size variable, not pattern, alloca i8, align 4
define i32 @twoalloca(i32 %size) nounwind {
entry:
…
%tmp1 = alloca i8, i32 %size, align 4
}
Jonathan
|
Hi Jonathan,
I find this pattern as below from
<llvm-source-tree>/test/CodeGen/Mips/alloca.ll, and want to know what front end
pattern can be translated into this. Anybody know this answer?%tmp1 = alloca i8, i32 %size, align 4 // has %size variable, not pattern, alloca
i8, align 4define i32 @twoalloca(i32 %size) nounwind {
entry:
...
%tmp1 = alloca i8, i32 %size, align 4
}
for example, the following code:
void use(char *);
void foo(long size) {
char A[size];
use(A);
}
->
define void @foo(i64 %size) unnamed_addr #0 {
entry:
%0 = alloca i8, i64 %size, align 16
call void @use(i8* %0) #1
ret void
}
declare void @use(i8*)
attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind }
Ciao, Duncan.