[LLVMdev] AllocaInst issue

Iaroslav Markov ymarkov at cs.stonybrook.edu
Thu Aug 16 16:19:44 PDT 2012


Hello,

I have the following problem: I need to allocate an array. I know it's size - it's constant (ConstExpr), but my problem is that I know it only during the runtime (i.e for every variable I'm trying to allocate an array equal to size of a variable). As I understand I can't do it, since it's possible to initialize ArrayType only if I know it's size in integer units. Since I'm not able to initialize type, I can't pass it to AllocaInst. Are there any ways to solve this issue? 

Of course, I can solve this issue by insertion of a cycle that will allocate an array element-by-element, but it doesn't seems as a good way.

Best,
Yaroslav.



More information about the llvm-dev mailing list