diff options
author | Samuel Benzaquen <sbenza@google.com> | 2014-09-29 18:43:20 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2014-09-29 18:43:20 +0000 |
commit | ee110341fbb11d004d4ccd7bfb40706b727553b7 (patch) | |
tree | e76af747583b84ae9c4d4d345567b8309c610be3 /clang/lib/ASTMatchers/ASTMatchFinder.cpp | |
parent | 8a0bad0bfcf12ad3f08bfe1598d77e841184ae5b (diff) | |
download | bcm5719-llvm-ee110341fbb11d004d4ccd7bfb40706b727553b7.tar.gz bcm5719-llvm-ee110341fbb11d004d4ccd7bfb40706b727553b7.zip |
Refactor Matcher<T> and DynTypedMatcher to reduce overhead of casts.
Summary:
This change introduces DynMatcherInterface and changes the internal
representation of DynTypedMatcher and Matcher<T> to use a generic
interface instead.
It removes unnecessary indirections and virtual function calls when
converting matchers by implicit and dynamic casts.
DynTypedMatcher now remembers the stricter type in the chain of casts
and checks it before calling into DynMatcherInterface.
This change improves our clang-tidy related benchmark by ~14%.
Also, it opens the door for more optimizations of this kind that are
coming in future changes.
As a side effect of removing these template instantiations, it also
speeds up compilation of Dynamic/Registry.cpp by ~17% and reduces the number of
symbols generated by ~30%.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5485
llvm-svn: 218616
Diffstat (limited to 'clang/lib/ASTMatchers/ASTMatchFinder.cpp')
-rw-r--r-- | clang/lib/ASTMatchers/ASTMatchFinder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchFinder.cpp b/clang/lib/ASTMatchers/ASTMatchFinder.cpp index 47f45bc3ad9..685b17e9129 100644 --- a/clang/lib/ASTMatchers/ASTMatchFinder.cpp +++ b/clang/lib/ASTMatchers/ASTMatchFinder.cpp @@ -53,7 +53,7 @@ static const unsigned MaxMemoizationEntries = 10000; // FIXME: Benchmark whether memoization of non-pointer typed nodes // provides enough benefit for the additional amount of code. struct MatchKey { - uint64_t MatcherID; + DynTypedMatcher::MatcherIDType MatcherID; ast_type_traits::DynTypedNode Node; BoundNodesTreeBuilder BoundNodes; |