@@ -355,6 +355,39 @@ exprt aval_bval(const bitnot_exprt &expr)
355
355
return combine_aval_bval (aval, op_bval, lower_to_aval_bval (expr.type ()));
356
356
}
357
357
358
+ exprt aval_bval_bitwise (const multi_ary_exprt &expr)
359
+ {
360
+ auto &type = expr.type ();
361
+ PRECONDITION (is_four_valued (type));
362
+ PRECONDITION (!expr.operands ().empty ());
363
+
364
+ for (auto &op : expr.operands ())
365
+ PRECONDITION (is_aval_bval (op));
366
+
367
+ // x/z is done bit-wise.
368
+ // Any bit involving x/z is x.
369
+
370
+ // bval
371
+ exprt::operandst bval_disjuncts;
372
+
373
+ for (auto &op : expr.operands ())
374
+ bval_disjuncts.push_back (bval (op));
375
+
376
+ auto bval = bitor_exprt{bval_disjuncts, bval_disjuncts.front ().type ()};
377
+
378
+ // aval
379
+ exprt::operandst aval_conjuncts;
380
+
381
+ for (auto &op : expr.operands ())
382
+ aval_conjuncts.push_back (aval (op));
383
+
384
+ exprt aval = bitand_exprt{
385
+ multi_ary_exprt{expr.id (), aval_conjuncts, aval_conjuncts.front ().type ()},
386
+ bitnot_exprt{bval}}; // 0/1 case
387
+
388
+ return combine_aval_bval (aval, bval, lower_to_aval_bval (expr.type ()));
389
+ }
390
+
358
391
exprt aval_bval (const power_exprt &expr)
359
392
{
360
393
PRECONDITION (is_four_valued (expr.type ()));
0 commit comments