[Clang] Add clang attribute `clang_builtin_alias`.
authorHsiangkai Wang <kai.wang@sifive.com>
Fri, 16 Apr 2021 01:21:01 +0000 (09:21 +0800)
committerHsiangkai Wang <kai.wang@sifive.com>
Sun, 25 Apr 2021 00:49:19 +0000 (08:49 +0800)
commit108864397d26ffff39267f417cabc7f248431437
treeeb4e7481ed8a9af80e1054376c777c8a62088c1f
parent5e537ea1d7a937f848ff1c0fc691d5a5afdf2459
[Clang] Add clang attribute `clang_builtin_alias`.

In some cases, we want to provide the alias name for the clang builtins.
For example, the arguments must be constant integers for some RISC-V builtins.
If we use wrapper functions, we could not constrain the arguments be constant
integer. This attribute is used to achieve the purpose.

Besides this, use `clang_builtin_alias` is more efficient than using
wrapper functions. We use this attribute to deal with test time issue
reported in https://bugs.llvm.org/show_bug.cgi?id=49962.

In our downstream testing, it could decrease the testing time from 6.3
seconds to 3.7 seconds for vloxei.c test.

Differential Revision: https://reviews.llvm.org/D100611
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/Decl.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/RISCV/riscv-attr-builtin-alias-err.c [new file with mode: 0644]
clang/test/CodeGen/RISCV/riscv-attr-builtin-alias.c [new file with mode: 0644]
clang/test/Misc/pragma-attribute-supported-attributes-list.test