On Jun 3, 2011, at 11:59 AM, Jonathan Turner wrote:

> This patch expands to even more PCH abbreviations for serialization.  The 
> major change here is now DeclaratorDecl children serialize the TypeSourceInfo 
> last, which allows us to capture it as an array, as it's the last element 
> serialized.
> 
> This gives some major improvements to ParmVarDecl serialization, where it was 
> once only abbreviated a single-digit percentage of the time, now it's 
> abbreviated more than 90% of the time for ObjC headers tested, and more than 
> 50% of the time for C++ headers test.
> 
> With this I also added support for abbreviating EnumDecl, ObjCIvarDecl, 
> TypedefDecl, VarDecl and FieldDecl.
> 
> For ObjC headers like Cocoa and WebKit, this brings our total size reduction 
> to ~6.5%.  For C++ headers like string and iostream, the reduction is in the 
> 5.5 to 6.5% range.

That's great!

> I removed support for EnumConstantDecl from the previous patch, as it was 
> pushing the number of abbreviations into the next bit size, which had a net 
> loss.

Okay.

> I also cleaned up the naming a bit to be more uniform.


Index: lib/Serialization/ASTWriterDecl.cpp
===================================================================
--- lib/Serialization/ASTWriterDecl.cpp (revision 132563)
+++ lib/Serialization/ASTWriterDecl.cpp (working copy)
@@ -124,6 +124,13 @@
 void ASTDeclWriter::Visit(Decl *D) {
   DeclVisitor<ASTDeclWriter>::Visit(D);
 
+  // Source locations require array (variable-length) abbreviations.  The
+  // abbreviation infrastructure requires that arrays are encoded last, so
+  // we handle it here in the case of those clases derived from DeclaratorDecl

Typo "clases"

@@ -169,6 +176,20 @@
 void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
   VisitTypeDecl(D);
   Writer.AddTypeSourceInfo(D->getTypeSourceInfo(), Record);
+
+  if (!D->hasAttrs() &&
+      !D->isImplicit() &&
+      !D->isUsed(false) &&
+      D->getPCHLevel() == 0 &&
+      D->RedeclLink.getNext() == D &&
+      !D->isInvalidDecl() &&
+      !D->isReferenced() &&
+      D->getAccess() == AS_none &&
+      D->getDeclName().getNameKind() == DeclarationName::Identifier &&
+      D->getTypeSourceInfo())
+
+    AbbrevToUse = Writer.getDeclTypedefAbbrev();

Do we actually need the D->getTypeSourceInfo() check here? It seems unnecessary.

Also: that extra blank line before the AbbrevToUse assignment looks weird.

@@ -205,6 +226,22 @@
   Record.push_back(D->isScopedUsingClassTag());
   Record.push_back(D->isFixed());
   Writer.AddDeclRef(D->getInstantiatedFromMemberEnum(), Record);
+
+  if (!D->hasAttrs() &&
+      !D->isImplicit() &&
+      !D->isUsed(false) &&
+      D->getPCHLevel() == 0 &&
+      !D->hasExtInfo() &&
+      D->RedeclLink.getNext() == D &&
+      !D->isInvalidDecl() &&
+      !D->isReferenced() &&
+      D->getAccess() == AS_none &&
+      !CXXRecordDecl::classofKind(D->getKind()) &&
+      !D->getIntegerTypeSourceInfo() &&
+      D->getDeclName().getNameKind() == DeclarationName::Identifier)
+
+    AbbrevToUse = Writer.getDeclEnumAbbrev();

Same comment about the extra line (there are a few other cases of this).

With those little cleanups, this patch looks good! If you haven't done so 
already, please request commit access as described here:

        http://llvm.org/docs/DeveloperPolicy.html#commitaccess

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to