Hello,
I’m trying to allocate a multi-dimensional array with LLVM API. I need to generate something like this:
%a = alloca [4 x [2 x [3 x i32]]], align 16
I can allocate a one-dimension array with the CreateAlloca method, but I can’t figure out how to allocate a multi-dimensional one.
CreateAlloca takes a type, which can itself be an ArrayType. What’s probably confusing you is that there’s also a separate ArraySize parameter, but that’s for alloca type, i64 N, align A, which is equivalent to alloca [type x N], align A when N is a constant but also lets you use a non-constant value (in order to implement variable-length arrays) for the outermost dimension.