diff options
| author | Reid Kleckner <reid@kleckner.net> | 2014-03-27 01:32:22 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2014-03-27 01:32:22 +0000 |
| commit | 24e3f7cceb66f5e156d5a2edf53b91449c5e76fa (patch) | |
| tree | d808342e384450675d74e107b72ade962b5ab076 /llvm/docs | |
| parent | dc4ccaaf666b7be417c3a66cb71ae094a865bc37 (diff) | |
| download | bcm5719-llvm-24e3f7cceb66f5e156d5a2edf53b91449c5e76fa.tar.gz bcm5719-llvm-24e3f7cceb66f5e156d5a2edf53b91449c5e76fa.zip | |
inalloca: Fix incorrect example IR and remove LangRef warning
The LangRef warning wasn't formatting the way I intended it to anyway.
Surprisingly inalloca appears to work, even when optimizations are
enabled. We generate very bad code for it, but we can self-host and run
lots of big tests.
llvm-svn: 204888
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/InAlloca.rst | 27 | ||||
| -rw-r--r-- | llvm/docs/LangRef.rst | 2 |
2 files changed, 13 insertions, 16 deletions
diff --git a/llvm/docs/InAlloca.rst b/llvm/docs/InAlloca.rst index a5df96da772..b3ec86a0540 100644 --- a/llvm/docs/InAlloca.rst +++ b/llvm/docs/InAlloca.rst @@ -31,41 +31,40 @@ Intended Usage ============== The example below is the intended LLVM IR lowering for some C++ code -that passes a default-constructed ``Foo`` object to ``g`` in the 32-bit -Microsoft C++ ABI. +that passes two default-constructed ``Foo`` objects to ``g`` in the +32-bit Microsoft C++ ABI. .. code-block:: c++ // Foo is non-trivial. - struct Foo { int a, b; Foo(); ~Foo(); Foo(const &Foo); }; + struct Foo { int a, b; Foo(); ~Foo(); Foo(const Foo &); }; void g(Foo a, Foo b); void f() { - f(1, Foo(), 3); + g(Foo(), Foo()); } .. code-block:: llvm %struct.Foo = type { i32, i32 } - %callframe.f = type { %struct.Foo, %struct.Foo } - declare void @Foo_ctor(%Foo* %this) - declare void @Foo_dtor(%Foo* %this) - declare void @g(%Foo* inalloca %memargs) + %callframe.f = type <{ %struct.Foo, %struct.Foo }> + declare void @Foo_ctor(%struct.Foo* %this) + declare void @Foo_dtor(%struct.Foo* %this) + declare void @g(<{ %struct.Foo, %struct.Foo }>* inalloca %memargs) define void @f() { entry: %base = call i8* @llvm.stacksave() - %memargs = alloca %callframe.f - %b = getelementptr %callframe.f*, i32 0 - %a = getelementptr %callframe.f*, i32 1 + %memargs = alloca <{ %struct.Foo, %struct.Foo }> + %b = getelementptr <{ %struct.Foo, %struct.Foo }>*, i32 1 call void @Foo_ctor(%struct.Foo* %b) ; If a's ctor throws, we must destruct b. - invoke void @Foo_ctor(%struct.Foo* %arg1) + %a = getelementptr <{ %struct.Foo, %struct.Foo }>*, i32 0 + invoke void @Foo_ctor(%struct.Foo* %a) to label %invoke.cont unwind %invoke.unwind invoke.cont: - store i32 1, i32* %arg0 - call void @g(%callframe.f* inalloca %memargs) + call void @g(<{ %struct.Foo, %struct.Foo }>* inalloca %memargs) call void @llvm.stackrestore(i8* %base) ... diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index dfbb22ffb9f..adf3266b029 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -765,8 +765,6 @@ Currently, only the following parameter attributes are defined: ``inalloca`` -.. Warning:: This feature is unstable and not fully implemented. - The ``inalloca`` argument attribute allows the caller to take the address of outgoing stack arguments. An ``inalloca`` argument must be a pointer to stack memory produced by an ``alloca`` instruction. |

