} //end of arithless
-bool containsArrayOps(const ASTNode& n, ASTNodeSet& visited)
+bool containsArrayOps(const ASTNode& n, hash_set<int> & visited)
{
- if (visited.find(n) != visited.end())
- return false;
- if (n.GetType() == ARRAY_TYPE)
- return true;
+ if (n.GetIndexWidth() > 0)
+ return true;
+
+ if (n.Degree() ==0)
+ return false;
+
+ if (visited.find(n.GetNodeNum()) != visited.end())
+ return false;
+
+ visited.insert(n.GetNodeNum());
for (int i =0; i < n.Degree();i++)
if (containsArrayOps(n[i],visited))
return true;
- visited.insert(n);
return false;
}
-bool containsArrayOps(const ASTNode&n)
-{
- ASTNodeSet visited;
- return containsArrayOps(n, visited);
-}
+ bool
+ containsArrayOps(const ASTNode&n)
+ {
+ hash_set<int> visited;
+ return containsArrayOps(n, visited);
+ }
bool isCommutative(const Kind k) {
switch (k) {
ASTNode elsRead = nf->CreateTerm(READ, width, els, readIndex);
assert(BVTypeCheck(elsRead));
- /* We try to call TransformArrayRead only if necessary, because it
+ /* We try to call TransformTerm only if necessary, because it
* introduces a new symbol for each read. The amount of work we
* need to do later is based on the square of the number of symbols.
*/