summaryrefslogtreecommitdiff
path: root/src/theory/strings
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/theory/strings
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/theory/strings')
-rw-r--r--src/theory/strings/regexp_entail.cpp2
-rw-r--r--src/theory/strings/sequences_rewriter.cpp12
-rw-r--r--src/theory/strings/strings_entail.cpp4
-rw-r--r--src/theory/strings/strings_rewriter.cpp2
4 files changed, 10 insertions, 10 deletions
diff --git a/src/theory/strings/regexp_entail.cpp b/src/theory/strings/regexp_entail.cpp
index cc4027aad..04e0fe2e5 100644
--- a/src/theory/strings/regexp_entail.cpp
+++ b/src/theory/strings/regexp_entail.cpp
@@ -639,7 +639,7 @@ Node RegExpEntail::getFixedLengthForRegexp(Node n)
}
else if (n.getKind() == REGEXP_CONCAT)
{
- NodeBuilder<> nb(PLUS);
+ NodeBuilder nb(PLUS);
for (const Node& nc : n)
{
Node flc = getFixedLengthForRegexp(nc);
diff --git a/src/theory/strings/sequences_rewriter.cpp b/src/theory/strings/sequences_rewriter.cpp
index 302f7dc0b..a7bbb68e3 100644
--- a/src/theory/strings/sequences_rewriter.cpp
+++ b/src/theory/strings/sequences_rewriter.cpp
@@ -1184,7 +1184,7 @@ Node SequencesRewriter::rewriteMembership(TNode node)
Node one = nm->mkConst(Rational(1));
if (flr == one)
{
- NodeBuilder<> nb(AND);
+ NodeBuilder nb(AND);
for (const Node& xc : x)
{
nb << nm->mkNode(STRING_IN_REGEXP, xc, r);
@@ -1926,7 +1926,7 @@ Node SequencesRewriter::rewriteContains(Node node)
{
std::vector<Node> vec = Word::getChars(node[0]);
Node emp = Word::mkEmptyWord(t.getType());
- NodeBuilder<> nb(OR);
+ NodeBuilder nb(OR);
nb << emp.eqNode(t);
for (const Node& c : vec)
{
@@ -1970,7 +1970,7 @@ Node SequencesRewriter::rewriteContains(Node node)
{
std::vector<Node> nc1;
utils::getConcat(node[0], nc1);
- NodeBuilder<> nb(OR);
+ NodeBuilder nb(OR);
for (const Node& ncc : nc1)
{
nb << nm->mkNode(STRING_STRCTN, ncc, node[1]);
@@ -2057,7 +2057,7 @@ Node SequencesRewriter::rewriteContains(Node node)
if (nc2.size() > 1)
{
Node emp = Word::mkEmptyWord(stype);
- NodeBuilder<> nb2(kind::AND);
+ NodeBuilder nb2(kind::AND);
for (const Node& n2 : nc2)
{
if (n2 == n)
@@ -3283,7 +3283,7 @@ Node SequencesRewriter::canonicalStrForSymbolicLength(Node len, TypeNode stype)
else if (len.getKind() == PLUS)
{
// x + y -> norm(x) + norm(y)
- NodeBuilder<> concatBuilder(STRING_CONCAT);
+ NodeBuilder concatBuilder(STRING_CONCAT);
for (const auto& n : len)
{
Node sn = canonicalStrForSymbolicLength(n, stype);
@@ -3312,7 +3312,7 @@ Node SequencesRewriter::canonicalStrForSymbolicLength(Node len, TypeNode stype)
}
std::vector<Node> nRepChildren;
utils::getConcat(nRep, nRepChildren);
- NodeBuilder<> concatBuilder(STRING_CONCAT);
+ NodeBuilder concatBuilder(STRING_CONCAT);
for (size_t i = 0, reps = intReps.getUnsignedInt(); i < reps; i++)
{
concatBuilder.append(nRepChildren);
diff --git a/src/theory/strings/strings_entail.cpp b/src/theory/strings/strings_entail.cpp
index 54af1ddcd..62e81d132 100644
--- a/src/theory/strings/strings_entail.cpp
+++ b/src/theory/strings/strings_entail.cpp
@@ -842,7 +842,7 @@ Node StringsEntail::getMultisetApproximation(Node a)
}
else if (a.getKind() == STRING_CONCAT)
{
- NodeBuilder<> nb(STRING_CONCAT);
+ NodeBuilder nb(STRING_CONCAT);
for (const Node& ac : a)
{
nb << getMultisetApproximation(ac);
@@ -974,7 +974,7 @@ Node StringsEntail::inferEqsFromContains(Node x, Node y)
cs.push_back(yiLen[0]);
}
- NodeBuilder<> nb(AND);
+ NodeBuilder nb(AND);
// (= x (str.++ y1' ... ym'))
if (!cs.empty())
{
diff --git a/src/theory/strings/strings_rewriter.cpp b/src/theory/strings/strings_rewriter.cpp
index 1a7ca7f6a..2a3da149c 100644
--- a/src/theory/strings/strings_rewriter.cpp
+++ b/src/theory/strings/strings_rewriter.cpp
@@ -179,7 +179,7 @@ Node StringsRewriter::rewriteStrConvert(Node node)
}
else if (node[0].getKind() == STRING_CONCAT)
{
- NodeBuilder<> concatBuilder(STRING_CONCAT);
+ NodeBuilder concatBuilder(STRING_CONCAT);
for (const Node& nc : node[0])
{
concatBuilder << nm->mkNode(nk, nc);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback