[PATCH] D82316: [LangRef] Add `frozen` attribute to documentation

Gui Andrade via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 10:13:09 PDT 2020


guiand created this revision.
guiand added reviewers: jdoerfert, aqjune, efriedma, eugenis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

[LangRef] Introduce `frozen` attribute for never-poison function params

LLVM currently does not require function parameters or return values
to be fully initialized, and does not care if they are poison. This can
be useful if the frontend ABI makes no such demands, but may prevent
helpful backend transformations in case they do. Specifically, the C
and C++ languages require all scalar function operands to be fully
determined.

Introducing this attribute is of particular use to MemorySanitizer
today, although other transformations may benefit from it as well.
We can modify MemorySanitizer instrumentation to provide modest (17%)
space savings where `frozen` is present.

This commit only adds the attribute to the Language Reference, and
the actual implementation of the attribute will follow in a separate
commit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82316

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


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -1252,6 +1252,12 @@
     only valid on intrinsic declarations and cannot be applied to a
     call site or arbitrary function.
 
+``"frozen"``
+    This attribute indicates that every bit of the parameter is required by
+    the ABI to be initialized and never poison. Values that would violate this
+    requirement include structures with padding bits, unions with active
+    members smaller than their size, and scalars which were never initialized.
+
 .. _gc:
 
 Garbage Collector Strategy Names
@@ -3656,6 +3662,8 @@
 -  The condition operand of a :ref:`br <i_br>` instruction.
 -  The callee operand of a :ref:`call <i_call>` or :ref:`invoke <i_invoke>`
    instruction.
+-  Arguments and return values of function calls, when those operands
+   are marked with the ``frozen`` attribute.
 
 Here are some examples:
 
Index: llvm/docs/BitCodeFormat.rst
===================================================================
--- llvm/docs/BitCodeFormat.rst
+++ llvm/docs/BitCodeFormat.rst
@@ -1058,7 +1058,16 @@
 * code 56: ``nocf_check``
 * code 57: ``optforfuzzing``
 * code 58: ``shadowcallstack``
+* code 59: ``speculative_load_hardening``
+* code 60: ``immarg``
+* code 61: ``willreturn``
+* code 62: ``nofree``
+* code 63: ``nosync``
 * code 64: ``sanitize_memtag``
+* code 65: ``preallocated``
+* code 66: ``no_merge``
+* code 67: ``null_pointer_is_valid``
+* code 68: ``frozen``
 
 .. note::
   The ``allocsize`` attribute has a special encoding for its arguments. Its two


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82316.272481.patch
Type: text/x-patch
Size: 1635 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/4910867f/attachment-0001.bin>


More information about the llvm-commits mailing list