forked from OSchip/llvm-project
366ba73018
Introduce the following optimizations in DeclarationName(Table): 1. Store common kinds inline in DeclarationName instead of DeclarationNameExtra. Currently the kind of C++ constructor, destructor, conversion function and overloaded operator names is stored in DeclarationNameExtra. Instead store it inline in DeclarationName. To do this align IdentifierInfo, CXXSpecialName, DeclarationNameExtra and CXXOperatorIdName to 8 bytes so that we can use the lower 3 bits of DeclarationName::Ptr. This is already the case on 64 bits archs anyway. This also allow us to remove DeclarationNameExtra from CXXSpecialName and CXXOperatorIdName, which shave off a pointer from CXXSpecialName. 2. Synchronize the enumerations DeclarationName::NameKind, DeclarationName::StoredNameKind and Selector::IdentifierInfoFlag. This makes DeclarationName::getNameKind much more efficient since we can replace the switch table by a single comparison and an addition. 3. Put the overloaded operator names inline in DeclarationNameTable to remove an indirection. This increase the size of DeclarationNameTable a little bit but this is not important since it is only used in ASTContext, and never copied nor moved from. This also get rid of the last dynamic allocation in DeclarationNameTable. Altogether these optimizations cut the run time of parsing all of Boost by about 0.8%. While we are at it, do the following NFC modifications: 1. Put the internal classes CXXSpecialName, CXXDeductionGuideNameExtra, CXXOperatorIdName, CXXLiteralOperatorIdName and DeclarationNameExtra in a namespace detail since these classes are only meant to be used by DeclarationName and DeclarationNameTable. Make this more explicit by making the members of these classes private and friending DeclarationName(Table). 2. Make DeclarationName::getFETokenInfo a non-template since every users are using it to get a void *. It was supposed to be used with a type to avoid a subsequent static_cast. 3. Change the internal functions DeclarationName::getAs* to castAs* since when we use them we already know the correct kind. This has no external impact since all of these are private. Reviewed By: erichkeane, rjmccall Differential Revision: https://reviews.llvm.org/D52267 llvm-svn: 342729 |
||
---|---|---|
.. | ||
Targets | ||
Attributes.cpp | ||
Builtins.cpp | ||
CMakeLists.txt | ||
CharInfo.cpp | ||
Cuda.cpp | ||
Diagnostic.cpp | ||
DiagnosticIDs.cpp | ||
DiagnosticOptions.cpp | ||
FileManager.cpp | ||
FileSystemStatCache.cpp | ||
FixedPoint.cpp | ||
IdentifierTable.cpp | ||
LangOptions.cpp | ||
MemoryBufferCache.cpp | ||
Module.cpp | ||
ObjCRuntime.cpp | ||
OpenMPKinds.cpp | ||
OperatorPrecedence.cpp | ||
SanitizerBlacklist.cpp | ||
SanitizerSpecialCaseList.cpp | ||
Sanitizers.cpp | ||
SourceLocation.cpp | ||
SourceManager.cpp | ||
TargetInfo.cpp | ||
Targets.cpp | ||
Targets.h | ||
TokenKinds.cpp | ||
Version.cpp | ||
VirtualFileSystem.cpp | ||
Warnings.cpp | ||
XRayInstr.cpp | ||
XRayLists.cpp |