[LLVMdev] How to codegen an LLVM-IR that has dynamic arrays in it?

Owen Anderson resistor at mac.com
Mon Feb 17 18:19:27 PST 2014


Call malloc()?

—Owen

On Feb 17, 2014, at 5:29 PM, Paul Vario <paul.paul.mit at gmail.com> wrote:

> Hi Fellows, 
> 
>         Is there a way to allocate dynamic array within an LLVM IR file from my code generator? Say., how to create an array type with a size determined through a global variable. Symbolically, something like below:
> 
>                     Value *sz = Mod->getOrInsertGlobal("SIZE", Int32Ty);
>                     Type *ArrayTy = ArrayType::get(FloatTy, sz)
>                     AllocaInst *AI = CreateAlloca(ArrayTy, 0, "");
> 
> 
> Thanks,
> Paul        
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list