#define __CVC4__THEORY__ARRAYS__THEORY_ARRAYS_REWRITER_H
#include "theory/rewriter.h"
-#include "type_enumerator.h"
+#include "theory/type_enumerator.h"
+#include "expr/attribute.h"
namespace CVC4 {
namespace theory {
namespace arrays {
+namespace attr {
+ struct ArrayConstantMostFrequentValueTag { };
+ struct ArrayConstantMostFrequentValueCountTag { };
+}/* CVC4::theory::arrays::attr namespace */
+
+typedef expr::Attribute<attr::ArrayConstantMostFrequentValueCountTag, uint64_t> ArrayConstantMostFrequentValueCountAttr;
+typedef expr::Attribute<attr::ArrayConstantMostFrequentValueTag, Node> ArrayConstantMostFrequentValueAttr;
+
class TheoryArraysRewriter {
static Node normalizeConstant(TNode node) {
bool recompute = false;
if (node[0].getKind() == kind::STORE) {
// TODO: look up most frequent value and count
+ mostFrequentValue = node.getAttribute(ArrayConstantMostFrequentValueAttr());
+ mostFrequentValueCount = node.getAttribute(ArrayConstantMostFrequentValueCountAttr());
if (!replacedValue.isNull() && mostFrequentValue == replacedValue) {
recompute = true;
}
#ifndef __CVC4__THEORY__ARRAYS__THEORY_ARRAYS_TYPE_RULES_H
#define __CVC4__THEORY__ARRAYS__THEORY_ARRAYS_TYPE_RULES_H
+#include "theory/arrays/theory_arrays_rewriter.h" // for array-constant attributes
+
namespace CVC4 {
namespace theory {
namespace arrays {
store = n[0];
if (store.getKind() == kind::STORE) {
// TODO: look up most frequent value and count
+ mostFrequentValue = n.getAttribute(ArrayConstantMostFrequentValueAttr());
+ mostFrequentValueCount = n.getAttribute(ArrayConstantMostFrequentValueCountAttr());
}
// Compute the most frequently written value for n
}
// TODO: store mostFrequentValue and mostFrequentValueCount for this node
+ n.setAttribute(ArrayConstantMostFrequentValueAttr(), mostFrequentValue);
+ n.setAttribute(ArrayConstantMostFrequentValueCountAttr(), mostFrequentValueCount);
return true;
}