[llvm] r204888 - inalloca: Fix incorrect example IR and remove LangRef warning

Reid Kleckner reid at kleckner.net
Wed Mar 26 18:32:23 PDT 2014


Author: rnk
Date: Wed Mar 26 20:32:22 2014
New Revision: 204888

URL: http://llvm.org/viewvc/llvm-project?rev=204888&view=rev
Log:
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.

Modified:
    llvm/trunk/docs/InAlloca.rst
    llvm/trunk/docs/LangRef.rst

Modified: llvm/trunk/docs/InAlloca.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/InAlloca.rst?rev=204888&r1=204887&r2=204888&view=diff
==============================================================================
--- llvm/trunk/docs/InAlloca.rst (original)
+++ llvm/trunk/docs/InAlloca.rst Wed Mar 26 20:32:22 2014
@@ -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)
       ...
 

Modified: llvm/trunk/docs/LangRef.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.rst?rev=204888&r1=204887&r2=204888&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.rst (original)
+++ llvm/trunk/docs/LangRef.rst Wed Mar 26 20:32:22 2014
@@ -765,8 +765,6 @@ Currently, only the following parameter
 
 ``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.





More information about the llvm-commits mailing list