[PATCH] D117890: [LangRef] Require elementtype attribute for gc.statepoint intrinsic

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 21 06:52:13 PST 2022


nikic created this revision.
nikic added reviewers: opaque-pointers, reames.
Herald added a subscriber: jdoerfert.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The gc.statepoint intrinsic currently determines the target function type based on the pointer element type of the argument. In order to support opaque pointers, require that the argument is annotated with an `elementtype` attribute.

This is just the LangRef change, this will require followup changes to update tests, the IR verifier and the statepoint code.

Here's an example of the change:

  ; Before:
    %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @return_i1, i32 0, i32 0, i32 0, i32 0)
  ; After:
    %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)
  ; After with opaque pointers:
    %safepoint_token = tail call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0(i64 0, i32 0, ptr elementtype(i1 ()) @return_i1, i32 0, i32 0, i32 0, i32 0)


https://reviews.llvm.org/D117890

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -12251,7 +12251,7 @@
 
       declare token
         @llvm.experimental.gc.statepoint(i64 <id>, i32 <num patch bytes>,
-                       func_type <target>,
+                       func_type* elementtype(func_type) <target>,
                        i64 <#call args>, i64 <flags>,
                        ... (call parameters),
                        i64 0, i64 0)
@@ -12287,11 +12287,12 @@
 sequence after patching is expected to represent an operation
 equivalent to a call or invoke to 'target'.
 
-The 'target' operand is the function actually being called.  The
-target can be specified as either a symbolic LLVM function, or as an
-arbitrary Value of appropriate function type.  Note that the function
-type must match the signature of the callee and the types of the 'call
-parameters' arguments.
+The 'target' operand is the function actually being called. The operand
+must have an :ref:`elementtype <attr_elementtype>` attribute specifying
+the function type of the target. The target can be specified as either
+a symbolic LLVM function, or as an arbitrary Value of pointer type. Note
+that the function type must match the signature of the callee and the
+types of the 'call parameters' arguments.
 
 The '#call args' operand is the number of arguments to the actual
 call.  It must exactly match the number of arguments passed in the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117890.401975.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220121/98b9e4d8/attachment.bin>


More information about the llvm-commits mailing list