Implement Function Multiversioning for Non-ELF Systems.
authorErich Keane <erich.keane@intel.com>
Thu, 25 Oct 2018 18:57:19 +0000 (18:57 +0000)
committerErich Keane <erich.keane@intel.com>
Thu, 25 Oct 2018 18:57:19 +0000 (18:57 +0000)
commit19a8adc9bd2785698c1d5429503fd406d95b6c53
tree79e0cbe7c653251b6a98179bbd759bdd3887acc9
parent4a825e7b29f4bc1f3543a8b94106e5006be8e833
Implement Function Multiversioning for Non-ELF Systems.

Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the
resolver function directly to forward the call to the proper function.
This is not nearly as efficient as IFuncs of course, but is still quite
useful for large functions specifically developed for certain
processors.

This is unfortunately still limited to x86, since it depends on
__builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins.

The naming for the resolver/forwarding function for cpu-dispatch was
taken from ICC's implementation, which uses the unmodified name for this
(no mangling additions).  This is possible, since cpu-dispatch uses '.A'
for the 'default' version.

In 'target' multiversioning, this function keeps the '.resolver'
extension in order to keep the default function keeping the default
mangling.

Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284

Differential Revision: https://reviews.llvm.org/D53586

llvm-svn: 345298
20 files changed:
clang/include/clang/AST/Decl.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/TargetInfo.h
clang/lib/AST/Decl.cpp
clang/lib/Basic/Targets/X86.h
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGen/attr-cpuspecific.c
clang/test/CodeGen/attr-target-mv-func-ptrs.c
clang/test/CodeGen/attr-target-mv-va-args.c
clang/test/CodeGen/attr-target-mv.c
clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp
clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp [new file with mode: 0644]
clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
clang/test/CodeGenCXX/attr-target-mv-overloads.cpp
clang/test/Sema/attr-target-mv-bad-target.c