Implement target_clones multiversioning
authorErich Keane <erich.keane@intel.com>
Fri, 5 Nov 2021 13:25:34 +0000 (06:25 -0700)
committerErich Keane <erich.keane@intel.com>
Thu, 11 Nov 2021 19:11:16 +0000 (11:11 -0800)
commit9deab60ae710f8c4cc810cd680edfb64c803f42d
tree95b99e10e7db68dd224fcd6f75337dcbc7c14ef2
parent42102bce98e527f994a7bc68b2255d9e0462f6eb
Implement target_clones multiversioning

As discussed here: https://lwn.net/Articles/691932/

GCC6.0 adds target_clones multiversioning. This functionality is
an odd cross between the cpu_dispatch and 'target' MV, but is compatible
with neither.

This attribute allows you to list all options, then emits a separately
optimized version of each function per-option (similar to the
cpu_specific attribute). It automatically generates a resolver, just
like the other two.

The mangling however, is... ODD to say the least. The mangling format
is:
<normal_mangling>.<option string>.<option ordinal>.

Differential Revision:https://reviews.llvm.org/D51650
18 files changed:
clang/include/clang/AST/Decl.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/Decl.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/attr-target-clones.c [new file with mode: 0644]
clang/test/CodeGenCXX/attr-target-clones.cpp [new file with mode: 0644]
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-cpuspecific.c
clang/test/Sema/attr-target-clones.c [new file with mode: 0644]
clang/test/SemaCXX/attr-target-clones.cpp [new file with mode: 0644]