summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-01-08 23:36:29 +0000
committerErich Keane <erich.keane@intel.com>2018-01-08 23:36:29 +0000
commitace10a20a66eca4c8a46da5751fa6b2b161fe552 (patch)
treea8b7aa326714aae2162a58ed52e05b1581891eec /clang
parentc1ca8065b57a4e45ac460bbe56eae2e033c9fecf (diff)
downloadbcm5719-llvm-ace10a20a66eca4c8a46da5751fa6b2b161fe552.tar.gz
bcm5719-llvm-ace10a20a66eca4c8a46da5751fa6b2b161fe552.zip
Document attribute target multiversioning.
Add attribute target multiversioning to the release notes. Additionally adds multiversioning support to the attribute documentation for 'target'. Differential Revision: https://reviews.llvm.org/D41837 llvm-svn: 322043
Diffstat (limited to 'clang')
-rw-r--r--clang/docs/ReleaseNotes.rst6
-rw-r--r--clang/include/clang/Basic/AttrDocs.td18
2 files changed, 24 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 749fd94282a..b29cd0627d0 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -80,6 +80,12 @@ Clang now supports the ...
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
diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td
index ecff329c4cc..7922a699a9a 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -1474,6 +1474,24 @@ for the function.
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.
}];
}
OpenPOWER on IntegriCloud