[PATCH] D41837: Add Function multiversion to the release notes.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 8 15:37:40 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC322043: Document attribute target multiversioning. (authored by erichkeane, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D41837?vs=128982&id=128995#toc

Repository:
  rC Clang

https://reviews.llvm.org/D41837

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/AttrDocs.td


Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -80,6 +80,12 @@
 Attribute Changes in Clang
 --------------------------
 
+- Clang now supports function multiversioning with attribute 'target' on ELF
+  based x86/x86-64 environments by using indirect functions. This implementation
+  has a few minor limitations over the GCC implementation for the sake of AST
+  sanity, however it is otherwise compatible with existing code using this
+  feature for GCC. Consult the documentation for the target attribute for more
+  information.
 - ...
 
 Windows Support
Index: include/clang/Basic/AttrDocs.td
===================================================================
--- include/clang/Basic/AttrDocs.td
+++ include/clang/Basic/AttrDocs.td
@@ -1474,6 +1474,24 @@
 Example "subtarget features" from the x86 backend include: "mmx", "sse", "sse4.2",
 "avx", "xop" and largely correspond to the machine specific options handled by
 the front end.
+
+Additionally, this attribute supports function multiversioning for ELF based
+x86/x86-64 targets, which can be used to create multiple implementations of the
+same function that will be resolved at runtime based on the priority of their
+``target`` attribute strings. A function is considered a multiversioned function
+if either two declarations of the function have different ``target`` attribute
+  strings, or if it has a ``target`` attribute string of ``default``.  For
+  example:
+
+  .. code-block:: c++
+  __attribute__((target("arch=atom")))
+  void foo() {} // will be called on 'atom' processors.
+  __attribute__((target("default")))
+  void foo() {} // will be called on any other processors.
+
+All multiversioned functions must contain a ``default`` (fallback)
+implementation, otherwise usages of the function are considered invalid.
+Additionally, a function may not become multiversioned after its first use.
 }];
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41837.128995.patch
Type: text/x-patch
Size: 1986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180108/b3712e49/attachment.bin>


More information about the cfe-commits mailing list