[llvm-dev] RFC: alloca -- specify address space for allocation

Swaroop Sridhar via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 26 18:46:08 PDT 2015


Currently, the alloca instruction always allocates in the generic address space (0).
This proposal is to extend the semantics of alloca instruction to allow allocation in any specified address space.

Proposed Syntax
<result> = alloca [inalloca] <type> [, <ty> <NumElements>] [, align <alignment>] [, addrspace <num>] ; yields type addrspace(num)*:result

Motivation
Managed language clients typically use address space 1 to represent GC-pointers.
Some managed clients (CLR, in particular) allow construction of GC pointers to stack locations.
For example, MSIL instruction ldloca (ECMA 335, p 370) creates a GC pointer to a stack local.

Creating an addrespace(1)* pointer to a stack location currently involves two steps: the alloca, and an addrspacecast.
Managed code transformations (ex: RewriteStatepointsForGC) do not handle arbitrary address space casting.
So, it is desirable to obtain the addrespace(1)* pointer by construction.

Thanks,
Swaroop.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150827/9debdc4c/attachment-0001.html>


More information about the llvm-dev mailing list