In the C documentation on linux, malloc is defined to take a size parameter of type size_t. On my 64-bit linux machine, size_t turns out to be a 64-bit type. In LLVM, AllocationInst's require the array size passed to them to be a 32-bit type. Is there a reason that LLVM's intermediate representation restricts the array size to be a 32-bit type?
No, there is no good reason. Like GEP, malloc and alloca should allow the size to be either i32 or i64.
No, there is no good reason. Like GEP, malloc and alloca should allow
the size to be either i32 or i64.
Why not allow any integer type? Wouldn't that make things more uniform?
Yes it would. I was just thinking about keeping consistency with GEP, but I agree that it would be nice to allow any size operand.