SubEliminate,
SltEliminate,
SleEliminate,
- UleEliminate,
+ UleEliminate,
CompEliminate,
RepeatEliminate,
RotateLeftEliminate,
/// ground term evaluation
EvalEquals,
- EvalConcat,
+ EvalConcat,
EvalAnd,
EvalOr,
EvalXor,
EvalUlt,
EvalUltBv,
EvalUle,
- EvalExtract,
+ EvalExtract,
EvalSignExtend,
EvalRotateLeft,
EvalRotateRight,
ExtractMultLeadingBit,
NegIdemp,
UdivPow2,
+ UdivZero,
UdivOne,
- UdivSelf,
UremPow2,
UremOne,
UremSelf,
ShiftZero,
UltOne,
- SltZero,
+ SltZero,
ZeroUlt,
MergeSignExtend,
-
+
/// normalization rules
ExtractBitwise,
ExtractNot,
NegSub,
NegPlus,
NotConcat,
- NotAnd, // not sure why this would help (not done)
- NotOr, // not sure why this would help (not done)
- NotXor, // not sure why this would help (not done)
+ NotAnd, // not sure why this would help (not done)
+ NotOr, // not sure why this would help (not done)
+ NotXor, // not sure why this would help (not done)
FlattenAssocCommut,
FlattenAssocCommutNoDuplicates,
PlusCombineLikeTerms,
IsPowerOfTwo
};
-
inline std::ostream& operator << (std::ostream& out, RewriteRuleId ruleId) {
switch (ruleId) {
case EmptyRule: out << "EmptyRule"; return out;
case ExtractMultLeadingBit : out << "ExtractMultLeadingBit"; return out;
case NegIdemp : out << "NegIdemp"; return out;
case UdivPow2 : out << "UdivPow2"; return out;
+ case UdivZero:
+ out << "UdivZero";
+ return out;
case UdivOne : out << "UdivOne"; return out;
- case UdivSelf : out << "UdivSelf"; return out;
case UremPow2 : out << "UremPow2"; return out;
case UremOne : out << "UremOne"; return out;
case UremSelf : out << "UremSelf"; return out;
RewriteRule<ExtractMultLeadingBit> rule88;
RewriteRule<NegIdemp> rule91;
RewriteRule<UdivPow2> rule92;
- RewriteRule<UdivOne> rule93;
- RewriteRule<UdivSelf> rule94;
+ RewriteRule<UdivZero> rule93;
+ RewriteRule<UdivOne> rule94;
RewriteRule<UremPow2> rule95;
RewriteRule<UremOne> rule96;
RewriteRule<UremSelf> rule97;
}
/**
- * UdivOne
+ * UdivZero
*
- * (a udiv 1) ==> a
+ * (a udiv 0) ==> 111...1
*/
-template<> inline
-bool RewriteRule<UdivOne>::applies(TNode node) {
+template <>
+inline bool RewriteRule<UdivZero>::applies(TNode node) {
return (node.getKind() == kind::BITVECTOR_UDIV_TOTAL &&
- node[1] == utils::mkConst(utils::getSize(node), 1));
+ node[1] == utils::mkConst(utils::getSize(node), 0));
}
-template<> inline
-Node RewriteRule<UdivOne>::apply(TNode node) {
- Debug("bv-rewrite") << "RewriteRule<UdivOne>(" << node << ")" << std::endl;
- return node[0];
+template <>
+inline Node RewriteRule<UdivZero>::apply(TNode node) {
+ Debug("bv-rewrite") << "RewriteRule<UdivZero>(" << node << ")" << std::endl;
+ return utils::mkOnes(utils::getSize(node));
}
/**
- * UdivSelf
+ * UdivOne
*
- * (a udiv a) ==> 1
+ * (a udiv 1) ==> a
*/
-template<> inline
-bool RewriteRule<UdivSelf>::applies(TNode node) {
+template <>
+inline bool RewriteRule<UdivOne>::applies(TNode node) {
return (node.getKind() == kind::BITVECTOR_UDIV_TOTAL &&
- node[0] == node[1]);
+ node[1] == utils::mkConst(utils::getSize(node), 1));
}
-template<> inline
-Node RewriteRule<UdivSelf>::apply(TNode node) {
- Debug("bv-rewrite") << "RewriteRule<UdivSelf>(" << node << ")" << std::endl;
- return utils::mkConst(utils::getSize(node), 1);
+template <>
+inline Node RewriteRule<UdivOne>::apply(TNode node) {
+ Debug("bv-rewrite") << "RewriteRule<UdivOne>(" << node << ")" << std::endl;
+ return node[0];
}
/**
return RewriteResponse(REWRITE_AGAIN_FULL, resultNode);
}
- resultNode = LinearRewriteStrategy
- < RewriteRule<EvalUdiv>,
- RewriteRule<UdivOne>,
- RewriteRule<UdivSelf>
- >::apply(node);
+ resultNode =
+ LinearRewriteStrategy<RewriteRule<EvalUdiv>, RewriteRule<UdivZero>,
+ RewriteRule<UdivOne> >::apply(node);
return RewriteResponse(REWRITE_DONE, resultNode);
}