[PATCH] D81311: [RFC] LangRef: Define byref parameter attribute

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 08:40:55 PDT 2020


arsenm updated this revision to Diff 271732.
arsenm retitled this revision from "[RFC] LangRef: Define inmem parameter attribute" to "[RFC] LangRef: Define byref parameter attribute".
arsenm added a comment.

Rename to byref. Specify more explicitly this is for the ABI, and should not be inferred.

I'm conflicted on removing the type in favor of a size value. I guess I'll see how much more painful it is to deviate from what byval does when I try to implement this


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81311/new/

https://reviews.llvm.org/D81311

Files:
  llvm/docs/LangRef.rst
  llvm/docs/ReleaseNotes.rst


Index: llvm/docs/ReleaseNotes.rst
===================================================================
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -74,6 +74,9 @@
   information. This information is used to represent Fortran modules debug
   info at IR level.
 
+* Added the ``byref`` attribute to better represent argument passing
+  for the `amdgpu_kernel` calling convention.
+
 Changes to building LLVM
 ------------------------
 
@@ -134,6 +137,9 @@
   retain the old behavior should explicitly request f32 denormal
   flushing.
 
+* The new ``byref`` attribute is now the preferred method for
+  representing aggregate kernel arguments.
+
 Changes to the AVR Target
 -----------------------------
 
Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -1066,6 +1066,30 @@
     site. If the alignment is not specified, then the code generator
     makes a target-specific assumption.
 
+.. _attr_byref:
+
+``byref(<ty>)``
+
+    The ``byref`` argument attribute allows specifying the pointee
+    memory type of an argument. This is similar to ``byval``, but does
+    not imply a copy is made anywhere, or that the argument is passed
+    on the stack. This implies the pointer is dereferenceable up to
+    the storage size of the type.
+
+    It is not generally permissible to introduce a write to an
+    ``byref`` pointer. The pointer may have any address space and may
+    be read only.
+
+    This is not a valid attribute for return values.
+
+    The alignment for an ``byref`` parameter can be explicitly
+    specified by combining it with the ``align`` attribute, similar to
+    ``byval``. If the alignment is not specified, then the code generator
+    makes a target-specific assumption.
+
+     This is intended for representing ABI constraints, and is not
+    intended to be inferred for optimization use.
+
 .. _attr_preallocated:
 
 ``preallocated(<ty>)``


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81311.271732.patch
Type: text/x-patch
Size: 2001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200618/9dee2f5c/attachment.bin>


More information about the cfe-commits mailing list