[PATCH] D13976: [AST] Store Decl* and Stmt* directly into the ParentMap.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 22 03:36:57 PDT 2015


bkramer created this revision.
bkramer added reviewers: klimek, djasper.
bkramer added a subscriber: cfe-commits.

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.

http://reviews.llvm.org/D13976

Files:
  include/clang/AST/ASTContext.h
  lib/AST/ASTContext.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13976.38105.patch
Type: text/x-patch
Size: 6100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151022/b5089468/attachment-0001.bin>


More information about the cfe-commits mailing list