summaryrefslogtreecommitdiffstats
path: root/include/clang/Basic/TargetInfo.h
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-01-08 21:34:17 +0000
committerErich Keane <erich.keane@intel.com>2018-01-08 21:34:17 +0000
commitd09c994ced99a8f84a58449ea3e15ed0020f87da (patch)
tree886b7b91bb1fa9a285bc7fd7ffc2ffb570efecee /include/clang/Basic/TargetInfo.h
parent2756c43cf8366998ba1fae7741be78a6ef075bb0 (diff)
Implement Attribute Target MultiVersioning
GCC's attribute 'target', in addition to being an optimization hint, also allows function multiversioning. We currently have the former implemented, this is the latter's implementation. This works by enabling functions with the same name/signature to coexist, so that they can all be emitted. Multiversion state is stored in the FunctionDecl itself, and SemaDecl manages the definitions. Note that it ends up having to permit redefinition of functions so that they can all be emitted. Additionally, all versions of the function must be emitted, so this also manages that. Note that this includes some additional rules that GCC does not, since defining something as a MultiVersion function after a usage has been made illegal. The only 'history rewriting' that happens is if a function is emitted before it has been converted to a multiversion'ed function, at which point its name needs to be changed. Function templates and virtual functions are NOT yet supported (not supported in GCC either). Additionally, constructors/destructors are disallowed, but the former is planned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/TargetInfo.h')
-rw-r--r--include/clang/Basic/TargetInfo.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h
index 6ba5877911..fad923c272 100644
--- a/include/clang/Basic/TargetInfo.h
+++ b/include/clang/Basic/TargetInfo.h
@@ -920,10 +920,20 @@ public:
return false;
}
+ /// \brief Identify whether this taret supports multiversioning of functions,
+ /// which requires support for cpu_supports and cpu_is functionality.
+ virtual bool supportsMultiVersioning() const { return false; }
+
// \brief Validate the contents of the __builtin_cpu_supports(const char*)
// argument.
virtual bool validateCpuSupports(StringRef Name) const { return false; }
+ // \brief Return the target-specific priority for features/cpus/vendors so
+ // that they can be properly sorted for checking.
+ virtual unsigned multiVersionSortPriority(StringRef Name) const {
+ return 0;
+ }
+
// \brief Validate the contents of the __builtin_cpu_is(const char*)
// argument.
virtual bool validateCpuIs(StringRef Name) const { return false; }