]> granicus.if.org Git - clang/commit
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)
commita906279b790de9af53a7c3f61642327e13e291e2
treec17091f6356093b5c3b82eb9d9e847c6fcbd8ddc
parent0425753f8fcc83dcfa2fa53aecc86cd2c72cd902
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345298 91177308-0d34-0410-b5e6-96231b3b80d8
20 files changed:
include/clang/AST/Decl.h
include/clang/Basic/Attr.td
include/clang/Basic/TargetInfo.h
lib/AST/Decl.cpp
lib/Basic/Targets/X86.h
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
test/CodeGen/attr-cpuspecific.c
test/CodeGen/attr-target-mv-func-ptrs.c
test/CodeGen/attr-target-mv-va-args.c
test/CodeGen/attr-target-mv.c
test/CodeGenCXX/attr-target-mv-diff-ns.cpp
test/CodeGenCXX/attr-target-mv-func-ptrs.cpp
test/CodeGenCXX/attr-target-mv-inalloca.cpp [new file with mode: 0644]
test/CodeGenCXX/attr-target-mv-member-funcs.cpp
test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp
test/CodeGenCXX/attr-target-mv-overloads.cpp
test/Sema/attr-target-mv-bad-target.c