[LLVMdev] Clarification on alloca semantics

Justin Holewinski justin.holewinski at gmail.com
Fri Jul 12 09:39:30 PDT 2013


According to the language reference:

*The ‘alloca‘ instruction allocates memory on the stack frame of the
currently executing function, to be automatically released when this
function returns to its caller. The object is always allocated in the
generic address space (address space zero).*


The last sentence specifies where the memory is allocated, but it's not
clear precisely what "allocated in the generic address space" means.  For
architectures with a segmented memory layout, allocating "in" the generic
address space may not make sense.  Instead, you allocate in a specific
address space, and create a "generic" pointer to that allocation.  Is this
a legal interpretation of the language reference?

If so, I would like to make the text in the language reference more
explicit that this is allowed.  If not, I would like to petition to make
this legal.  Something along the lines of:

*The object is allocated in a target-defined memory space and the returned
pointer is always in the generic address space (address space zero).*

-- 

Thanks,

Justin Holewinski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130712/694ec2d1/attachment.html>


More information about the llvm-dev mailing list