
Leverage the method OpenCL uses that adds C intrinsics when the lookup failed. There is no need to define C intrinsics in the header file any more. It could help to avoid the large header file to speed up the compilation of RVV source code. Besides that, only the C intrinsics used by the users will be added into the declaration table. This patch is based on https://reviews.llvm.org/D103228 and inspired by OpenCL implementation. ### Experimental Results #### TL;DR: - Binary size of clang increase ~200k, which is +0.07% for debug build and +0.13% for release build. - Single file compilation speed up ~33x for debug build and ~8.5x for release build - Regression time reduce ~10% (`ninja check-all`, enable all targets) #### Header size change ``` | size | LoC | ------------------------------ Before | 4,434,725 | 69,749 | After | 6,140 | 162 | ``` #### Single File Compilation Time Testcase: ``` #include <riscv_vector.h> vint32m1_t test_vadd_vv_vfloat32m1_t(vint32m1_t op1, vint32m1_t op2, size_t vl) { return vadd(op1, op2, vl); } ``` ##### Debug build: Before: ``` real 0m19.352s user 0m19.252s sys 0m0.092s ``` After: ``` real 0m0.576s user 0m0.552s sys 0m0.024s ``` ~33x speed up for debug build ##### Release build: Before: ``` real 0m0.773s user 0m0.741s sys 0m0.032s ``` After: ``` real 0m0.092s user 0m0.080s sys 0m0.012s ``` ~8.5x speed up for release build #### Regression time Note: the failed case is `tools/llvm-debuginfod-find/debuginfod.test` which is unrelated to this patch. ##### Debug build Before: ``` Testing Time: 1358.38s Skipped : 11 Unsupported : 446 Passed : 75767 Expectedly Failed: 190 Failed : 1 ``` After ``` Testing Time: 1220.29s Skipped : 11 Unsupported : 446 Passed : 75767 Expectedly Failed: 190 Failed : 1 ``` ##### Release build Before: ``` Testing Time: 381.98s Skipped : 12 Unsupported : 1407 Passed : 74765 Expectedly Failed: 176 Failed : 1 ``` After: ``` Testing Time: 346.25s Skipped : 12 Unsupported : 1407 Passed : 74765 Expectedly Failed: 176 Failed : 1 ``` #### Binary size of clang ##### Debug build Before ``` text data bss dec hex filename 335261851 12726004 552812 348540667 14c64efb bin/clang ``` After ``` text data bss dec hex filename 335442803 12798708 552940 348794451 14ca2e53 bin/clang ``` +253K, +0.07% code size ##### Release build Before ``` text data bss dec hex filename 144123975 8374648 483140 152981763 91e5103 bin/clang ``` After ``` text data bss dec hex filename 144255762 8447296 483268 153186326 9217016 bin/clang ``` +204K, +0.13% Authored-by: Kito Cheng <kito.cheng@sifive.com> Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com> Reviewed By: khchen, aaron.ballman Differential Revision: https://reviews.llvm.org/D111617
139 lines
7.1 KiB
C++
139 lines
7.1 KiB
C++
//===- TableGenBackends.h - Declarations for Clang TableGen Backends ------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file contains the declarations for all of the Clang TableGen
|
|
// backends. A "TableGen backend" is just a function. See
|
|
// "$LLVM_ROOT/utils/TableGen/TableGenBackends.h" for more info.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_CLANG_UTILS_TABLEGEN_TABLEGENBACKENDS_H
|
|
#define LLVM_CLANG_UTILS_TABLEGEN_TABLEGENBACKENDS_H
|
|
|
|
#include <string>
|
|
|
|
namespace llvm {
|
|
class raw_ostream;
|
|
class RecordKeeper;
|
|
} // namespace llvm
|
|
|
|
namespace clang {
|
|
|
|
void EmitClangDeclContext(llvm::RecordKeeper &RK, llvm::raw_ostream &OS);
|
|
void EmitClangASTNodes(llvm::RecordKeeper &RK, llvm::raw_ostream &OS,
|
|
const std::string &N, const std::string &S);
|
|
void EmitClangBasicReader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangBasicWriter(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangTypeNodes(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangTypeReader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangTypeWriter(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrParserStringSwitches(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrSubjectMatchRulesParserStringSwitches(
|
|
llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrClass(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrImpl(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrList(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrSubjectMatchRuleList(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrPCHRead(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrPCHWrite(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangAttrHasAttrImpl(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrSpellingListIndex(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrASTVisitor(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrTemplateInstantiate(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrParsedAttrList(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrParsedAttrImpl(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrParsedAttrKinds(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrTextNodeDump(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrNodeTraverse(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangAttrDocTable(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitClangDiagsDefs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS,
|
|
const std::string &Component);
|
|
void EmitClangDiagGroups(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangDiagsIndexName(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
void EmitClangSACheckers(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitClangCommentHTMLTags(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangCommentHTMLTagsProperties(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangCommentHTMLNamedCharacterReferences(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
void EmitClangCommentCommandInfo(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangCommentCommandList(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangOpcodes(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitClangSyntaxNodeList(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangSyntaxNodeClasses(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
void EmitNeon(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitFP16(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitBF16(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitNeonSema(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitNeonTest(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitSveHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitSveBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitSveBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitSveTypeFlags(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitSveRangeChecks(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitMveHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitMveBuiltinDef(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitMveBuiltinSema(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitMveBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitMveBuiltinAliases(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitRVVHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitRVVBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitRVVBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitRVVBuiltinSema(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitCdeHeader(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitCdeBuiltinDef(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitCdeBuiltinSema(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitCdeBuiltinCG(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitCdeBuiltinAliases(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitClangAttrDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangDiagDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
void EmitClangOptDocs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
|
|
|
|
void EmitClangOpenCLBuiltins(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
void EmitClangOpenCLBuiltinTests(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
void EmitClangDataCollectors(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
void EmitTestPragmaAttributeSupportedAttributes(llvm::RecordKeeper &Records,
|
|
llvm::raw_ostream &OS);
|
|
|
|
} // end namespace clang
|
|
|
|
#endif
|