Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.
Rationale:
We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).
It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:
Two tables:
*** Selector/Identifier Stats:
# Selectors/Identifiers: 51635
Bytes allocated: 1999824
One table:
*** Identifier Table Stats:
# Identifiers: 49500
Bytes allocated: 1990316
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42139 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 3742702..42024b1 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1308,8 +1308,8 @@
methodName += ":";
}
methodName[len] = '\0';
- SelectorInfo &SelName = Context.getSelectorInfo(&methodName[0],
- &methodName[0]+len);
+ IdentifierInfo &SelName = Context.Idents.get(&methodName[0],
+ &methodName[0]+len);
llvm::SmallVector<ParmVarDecl*, 16> Params;
for (unsigned i = 0; i < NumKeywords; i++) {
@@ -1340,8 +1340,8 @@
IdentifierInfo *SelectorName, AttributeList *AttrList,
tok::ObjCKeywordKind MethodDeclKind) {
const char *methodName = SelectorName->getName();
- SelectorInfo &SelName = Context.getSelectorInfo(methodName,
- methodName+strlen(methodName));
+ IdentifierInfo &SelName = Context.Idents.get(methodName,
+ methodName+strlen(methodName));
QualType resultDeclType = QualType::getFromOpaquePtr(ReturnType);
ObjcMethodDecl* ObjcMethod = new ObjcMethodDecl(MethodLoc,
SelName, resultDeclType, 0, -1,