diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2021-04-06 09:33:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 16:33:52 +0000 |
commit | cfe1431aaae7366dea1d3124742ee2b2c2a2511e (patch) | |
tree | 7c30457bef5857947102636bddc8cc3a05e9e3c5 /src/theory/quantifiers/quantifiers_rewriter.cpp | |
parent | e92b4504d5930234c852bf0fba8f5663ad4809e7 (diff) |
Remove template argument from `NodeBuilder` (#6290)
Currently, NodeBuilder takes a single template argument: An integer
that determines the expected number of arguments. This argument is used
to determine the size of the d_inlineNvChildSpace array. This array is
used to construct nodes inline. The advantage of this is that we don't
have to allocate a NodeValue on the heap for the node under
construction until we are sure that the node is new. While templating
the array size may save some stack space (or avoid a heap allocation if
we statically know that we a fixed number of children and that number is
greater than 10), it complicates the code and leads to longer compile
times. Thus, this commit removes the template argument and moves some of
the NodeBuilder code to a source file for faster compilation.
CPU build time before change (debug build): 2429.68s
CPU build time after change (debug build): 2228.44s
Signed-off-by: Andres Noetzli noetzli@amazon.com
Diffstat (limited to 'src/theory/quantifiers/quantifiers_rewriter.cpp')
-rw-r--r-- | src/theory/quantifiers/quantifiers_rewriter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/theory/quantifiers/quantifiers_rewriter.cpp b/src/theory/quantifiers/quantifiers_rewriter.cpp index 2c91df7a7..89358c511 100644 --- a/src/theory/quantifiers/quantifiers_rewriter.cpp +++ b/src/theory/quantifiers/quantifiers_rewriter.cpp @@ -104,7 +104,8 @@ bool QuantifiersRewriter::isLiteral( Node n ){ return true; } -void QuantifiersRewriter::addNodeToOrBuilder( Node n, NodeBuilder<>& t ){ +void QuantifiersRewriter::addNodeToOrBuilder(Node n, NodeBuilder& t) +{ if( n.getKind()==OR ){ for( int i=0; i<(int)n.getNumChildren(); i++ ){ t << n[i]; @@ -1596,7 +1597,7 @@ Node QuantifiersRewriter::computeMiniscoping(Node q, QAttributes& qa) BoundVarManager* bvm = nm->getBoundVarManager(); // Break apart the quantifed formula // forall x. P1 ^ ... ^ Pn ---> forall x. P1 ^ ... ^ forall x. Pn - NodeBuilder<> t(kind::AND); + NodeBuilder t(kind::AND); std::vector<Node> argsc; for (size_t i = 0, nchild = body.getNumChildren(); i < nchild; i++) { @@ -1645,8 +1646,8 @@ Node QuantifiersRewriter::computeMiniscoping(Node q, QAttributes& qa) // aggressive miniscoping implies that free variable miniscoping should // be applied first Node newBody = body; - NodeBuilder<> body_split(kind::OR); - NodeBuilder<> tb(kind::OR); + NodeBuilder body_split(kind::OR); + NodeBuilder tb(kind::OR); for (const Node& trm : body) { if (expr::hasSubterm(trm, args)) |