This is an archive of the discontinued LLVM Phabricator instance.

[AST] Store Decl* and Stmt* directly into the ParentMap.
ClosedPublic

Authored by bkramer on Oct 22 2015, 3:36 AM.

Details

Summary

These are by far the most common types to be parents in the AST so it makes
sense to optimize for them. Put them directly into the value of the map.
This currently saves 32 bytes per parent in the map and a pointer
indirection at the cost of some additional complexity in the code.

Sadly this means we cannot return an ArrayRef from getParents anymore, add
a proxy class that can own a single DynTypedNode and otherwise behaves
exactly the same as ArrayRef.

For example on a random large file (X86ISelLowering.cpp) this reduces the size
of the parent map by 24 MB.

Diff Detail

Event Timeline

bkramer updated this revision to Diff 38105.Oct 22 2015, 3:36 AM
bkramer retitled this revision from to [AST] Store Decl* and Stmt* directly into the ParentMap..
bkramer updated this object.
bkramer added reviewers: klimek, djasper.
bkramer added a subscriber: cfe-commits.
klimek accepted this revision.Oct 22 2015, 4:19 AM
klimek edited edge metadata.

lg

include/clang/AST/ASTContext.h
463

I think "using" is clearer.

464

Show me what ArrayRef<DynTypedNode> looks like written out below :)

This revision is now accepted and ready to land.Oct 22 2015, 4:19 AM
This revision was automatically updated to reflect the committed changes.