diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-01-17 23:58:17 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-01-17 23:58:17 +0000 |
commit | 3cbfa1617f0d935d68bf519afb5720df066849c2 (patch) | |
tree | bbd9321083451c055f56f050fe08c56d5a35d9f6 /docs | |
parent | 01d9f5972a0d7b0d88f815e6f7424f5f7b5bdb04 (diff) | |
download | llvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.gz llvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.bz2 llvm-3cbfa1617f0d935d68bf519afb5720df066849c2.tar.xz |
Add an inalloca flag to allocas
Summary:
The only current use of this flag is to mark the alloca as dynamic, even
if its in the entry block. The stack adjustment for the alloca can
never be folded into the prologue because the call may clear it and it
has to be allocated at the top of the stack.
Reviewers: majnemer
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2571
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LangRef.rst | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/docs/LangRef.rst b/docs/LangRef.rst index a767700636..8bb834b45e 100644 --- a/docs/LangRef.rst +++ b/docs/LangRef.rst @@ -778,19 +778,16 @@ Currently, only the following parameter attributes are defined: .. Warning:: This feature is unstable and not fully implemented. The ``inalloca`` argument attribute allows the caller to take the - address of all stack-allocated arguments to a ``call`` or ``invoke`` - before it executes. It is similar to ``byval`` in that it is used - to pass arguments by value, but it guarantees that the argument will - not be copied. - - To be :ref:`well formed <wellformed>`, an alloca may be used as an - ``inalloca`` argument at most once. The attribute can only be - applied to the last parameter, and it guarantees that they are - passed in memory. The ``inalloca`` attribute cannot be used in - conjunction with other attributes that affect argument storage, like - ``inreg``, ``nest``, ``sret``, or ``byval``. The ``inalloca`` stack - space is considered to be clobbered by any call that uses it, so any - ``inalloca`` parameters cannot be marked ``readonly``. + address of outgoing stack arguments. An ``inalloca`` argument must + be a pointer to stack memory produced by an ``alloca`` instruction. + The alloca, or argument allocation, must also be tagged with the + inalloca keyword. Only the past argument may have the ``inalloca`` + attribute, and that argument is guaranteed to be passed in memory. + + An argument allocation may be used by a call at most once because + the call may deallocate it. The ``inalloca`` attribute cannot be + used in conjunction with other attributes that affect argument + storage, like ``inreg``, ``nest``, ``sret``, or ``byval``. When the call site is reached, the argument allocation must have been the most recent stack allocation that is still live, or the @@ -4693,7 +4690,7 @@ Syntax: :: - <result> = alloca <type>[, <ty> <NumElements>][, align <alignment>] ; yields {type*}:result + <result> = alloca <type>[, inalloca][, <ty> <NumElements>][, align <alignment>] ; yields {type*}:result Overview: """"""""" |