summaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2021-04-06 09:33:52 -0700
committerGitHub <noreply@github.com>2021-04-06 16:33:52 +0000
commitcfe1431aaae7366dea1d3124742ee2b2c2a2511e (patch)
tree7c30457bef5857947102636bddc8cc3a05e9e3c5 /src/api
parente92b4504d5930234c852bf0fba8f5663ad4809e7 (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/api')
-rw-r--r--src/api/cpp/cvc5.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/api/cpp/cvc5.cpp b/src/api/cpp/cvc5.cpp
index b965d55a6..49ef2336c 100644
--- a/src/api/cpp/cvc5.cpp
+++ b/src/api/cpp/cvc5.cpp
@@ -46,6 +46,7 @@
#include "expr/metakind.h"
#include "expr/node.h"
#include "expr/node_algorithm.h"
+#include "expr/node_builder.h"
#include "expr/node_manager.h"
#include "expr/sequence.h"
#include "expr/type_node.h"
@@ -3956,7 +3957,7 @@ Term Grammar::purifySygusGTerm(
if (term.d_node->getMetaKind() == kind::metakind::PARAMETERIZED)
{
// it's an indexed operator so we should provide the op
- NodeBuilder<> nb(term.d_node->getKind());
+ NodeBuilder nb(term.d_node->getKind());
nb << term.d_node->getOperator();
nb.append(Term::termVectorToNodes(pchildren));
nret = nb.constructNode();
@@ -4344,7 +4345,7 @@ Term Solver::mkTermHelper(const Op& op, const std::vector<Term>& children) const
const cvc5::Kind int_kind = extToIntKind(op.d_kind);
std::vector<Node> echildren = Term::termVectorToNodes(children);
- NodeBuilder<> nb(int_kind);
+ NodeBuilder nb(int_kind);
nb << *op.d_node;
nb.append(echildren);
Node res = nb.constructNode();
@@ -5543,7 +5544,7 @@ Term Solver::mkTuple(const std::vector<Sort>& sorts,
Sort s = mkTupleSortHelper(sorts);
Datatype dt = s.getDatatype();
- NodeBuilder<> nb(extToIntKind(APPLY_CONSTRUCTOR));
+ NodeBuilder nb(extToIntKind(APPLY_CONSTRUCTOR));
nb << *dt[0].getConstructorTerm().d_node;
nb.append(args);
Node res = nb.constructNode();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback