[llvm] Add the 'initializes' attribute langref and support (PR #84803)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 18:57:05 PDT 2024
================
@@ -1621,6 +1621,26 @@ Currently, only the following parameter attributes are defined:
``readonly`` or a ``memory`` attribute that does not contain
``argmem: write``.
+``initializes((Lo1, Hi1), ...)``
+ This attribute indicates that the function initializes the ranges of the
+ pointer parameter's memory, ``[%p+LoN, %p+HiN)``. Initialization of memory
+ means the first memory access is a non-volatile, non-atomic write. The
+ write must happen before the function returns. If the function unwinds,
+ the write may not happen.
+
+ This attribute only holds for the memory accessed via this pointer
+ parameter. Other arbitrary accesses to the same memory via other pointers
+ are allowed.
+
+ The ``writable`` or ``dereferenceable`` attribute does not imply the
+ ``initializes`` attribute. The ``initializes`` does not imply ``writeonly``
+ since ``initializes`` allows reading from the pointer after writing.
+
+ This attribute is a list of constant ranges in ascending order with no
+ overlapping or consecutive list elements. ``LoN/HiN`` are 64-bit ints, and
----------------
nikic wrote:
```suggestion
overlapping or consecutive list elements. ``LoN/HiN`` are 64-bit integers, and
```
Though I wonder whether the integers shouldn't match the pointer index type rather than being hardcoded to 64-bits...
https://github.com/llvm/llvm-project/pull/84803
More information about the llvm-commits
mailing list