[llvm] [IR] Introduce captures attribute (PR #116990)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 03:35:40 PST 2025
================
@@ -1379,6 +1379,42 @@ Currently, only the following parameter attributes are defined:
function, returning a pointer to allocated storage disjoint from the
storage for any other object accessible to the caller.
+``captures(...)``
+ This attributes restrict the ways in which the callee may capture the
+ pointer. This is not a valid attribute for return values. This attribute
+ applies only to the particular copy of the pointer passed in this argument.
+
+ The arguments of ``captures`` is a list of captured pointer components,
+ which may be ``none``, or a combination of:
+
+ - ``address``: The integral address of the pointer.
+ - ``address_is_null`` (subset of ``address``): Whether the address is null.
+ - ``provenance``: The ability to access the pointer for both read and write
----------------
nikic wrote:
My thinking here was that LLVM doesn't really have a notion of write-only memory. Memory can be read-only or read-write, but not write-only. Our writeonly attribute, after recent clarifications, allows reads as long as they are unobservable. So I think write_provenance always has to be combined with read_provenance, which is why I went with plain provenance including both.
https://github.com/llvm/llvm-project/pull/116990
More information about the llvm-commits
mailing list