[PATCH] D40819: Implement Attribute Target MultiVersioning (Improved edition!)
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 4 16:46:55 PST 2017
erichkeane created this revision.
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).
This SEMA design was discussed with @rsmith but additional opinions/preferences
here are greatly appreciated.
Options on how to split this patch up would also be particularly solicited,
since this IS a large patch.
This patch completely superceeds: https://reviews.llvm.org/D38596
https://reviews.llvm.org/D40819
Files:
include/clang/AST/Decl.h
include/clang/Basic/Attr.td
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Basic/TargetInfo.h
include/clang/Basic/X86Target.def
include/clang/Sema/Overload.h
lib/Basic/Targets/X86.cpp
lib/Basic/Targets/X86.h
lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenFunction.h
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
lib/Sema/SemaDecl.cpp
lib/Sema/SemaOverload.cpp
test/CodeGen/attr-target-mv-va-args.c
test/CodeGen/attr-target-mv.c
test/CodeGenCXX/attr-target-mv-constexpr.cpp
test/CodeGenCXX/attr-target-mv-diff-ns.cpp
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.c
test/SemaCXX/attr-target-mv.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40819.125456.patch
Type: text/x-patch
Size: 69006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171205/812174aa/attachment-0001.bin>
More information about the cfe-commits
mailing list