[LLVMdev] What pattern of front end language can be tranalated into

Duncan Sands baldrick at free.fr
Fri Apr 12 00:28:47 PDT 2013


Hi Jonathan,

On 12/04/13 08:41, gamma_chen wrote:
> 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 4
>
> define 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.



More information about the llvm-dev mailing list