public CGCachedExpr(CGExpr expr, CachedAtom cachedAtom, List <CGCachedExpr> caches) { this.expr = expr; this.cachedAtom = cachedAtom; this.cacheNumber = caches.Count; caches.Add(this); }
public override PathCond AndNot(CachedAtom cond) { if (conds.Contains(cond)) { return FALSE; } else { return Make(AddItem(this.conds, cond.Negate())); } }
public override PathCond AndNot(CachedAtom cond) { if (this.Equals(cond)) { return FALSE; } else { return Conj.Make(this, cond.Negate()); } }
public override PathCond And(CachedAtom cond) { if (this.EqualsNega(cond)) { return FALSE; } else { return Conj.Make(this, cond); } }
public override PathCond And(CachedAtom cond) { return Conj.Make(this, cond); // Alternatively, weed out disjuncts inconsistent with the condition, // using an order-preserving version of this code: // HashSet<PathCond> result = new HashSet<PathCond>(); // result.AddAll(conds); // result.Filter(disj => !(disj is NegAtom && (disj as NegAtom).cond.Equals(cond) // || disj is Conj && (disj as Conj).conds.Contains(new NegAtom(cond)))); // return Conj.Make(Make(result.ToArray(), new Atom(cond)); }
public override PathCond AndNot(CachedAtom cond) { if (conds.Contains(cond)) { return(FALSE); } else { return(Make(AddItem(this.conds, cond.Negate()))); } }
public override PathCond AndNot(CachedAtom cond) { if (this.Equals(cond)) { return(FALSE); } else { return(Conj.Make(this, cond.Negate())); } }
public override PathCond And(CachedAtom cond) { return(Conj.Make(this, cond)); // Alternatively, weed out disjuncts inconsistent with the condition, // using an order-preserving version of this code: // HashSet<PathCond> result = new HashSet<PathCond>(); // result.AddAll(conds); // result.Filter(disj => !(disj is NegAtom && (disj as NegAtom).cond.Equals(cond) // || disj is Conj && (disj as Conj).conds.Contains(new NegAtom(cond)))); // return Conj.Make(Make(result.ToArray(), new Atom(cond)); }
public override void EvalCond(PathCond evalCond, IDictionary <FullCellAddr, PathCond> evalConds, List <CGCachedExpr> caches) { if (es.Length == 3) { CachedAtom atom = new CachedAtom(es[0], caches); es[0].EvalCond(evalCond, evalConds, caches); es[0] = atom.cachedExpr; es[1].EvalCond(evalCond.And(atom), evalConds, caches); es[2].EvalCond(evalCond.AndNot(atom), evalConds, caches); } }
public override void EvalCond(PathCond evalCond, IDictionary<FullCellAddr, PathCond> evalConds, List<CGCachedExpr> caches) { for (int i = 0; i < es.Length; i++) { es[i].EvalCond(evalCond, evalConds, caches); if (SHORTCIRCUIT_EVALCONDS && i != es.Length - 1) { // Take short-circuit evaluation into account for precision CachedAtom atom = new CachedAtom(es[i], caches); evalCond = evalCond.AndNot(atom); es[i] = atom.cachedExpr; } } }
public override void EvalCond(PathCond evalCond, IDictionary<FullCellAddr, PathCond> evalConds, List<CGCachedExpr> caches) { if (es.Length >= 1) { CachedAtom atom = new CachedAtom(es[0], caches); CGCachedExpr cached = atom.cachedExpr; es[0].EvalCond(evalCond, evalConds, caches); es[0] = cached; for (int i = 1; i < es.Length; i++) { CGExpr iConst = CGConst.Make(i); CGExpr cond = new CGEqual(new CGExpr[] {cached, iConst}); es[i].EvalCond(evalCond.And(new CachedAtom(cond, caches)), evalConds, caches); } } }
public override void EvalCond(PathCond evalCond, IDictionary <FullCellAddr, PathCond> evalConds, List <CGCachedExpr> caches) { for (int i = 0; i < es.Length; i++) { es[i].EvalCond(evalCond, evalConds, caches); if (SHORTCIRCUIT_EVALCONDS && i != es.Length - 1) { // Take short-circuit evaluation into account for precision CachedAtom atom = new CachedAtom(es[i], caches); evalCond = evalCond.AndNot(atom); es[i] = atom.cachedExpr; } } }
public override void EvalCond(PathCond evalCond, IDictionary <FullCellAddr, PathCond> evalConds, List <CGCachedExpr> caches) { if (es.Length >= 1) { CachedAtom atom = new CachedAtom(es[0], caches); CGCachedExpr cached = atom.cachedExpr; es[0].EvalCond(evalCond, evalConds, caches); es[0] = cached; for (int i = 1; i < es.Length; i++) { CGExpr iConst = CGConst.Make(i); CGExpr cond = new CGEqual(new CGExpr[] { cached, iConst }); es[i].EvalCond(evalCond.And(new CachedAtom(cond, caches)), evalConds, caches); } } }
private CachedAtom(CachedAtom atom, bool negated) { this.cachedExpr = atom.cachedExpr; this.negated = negated; }
public override void EvalCond(PathCond evalCond, IDictionary<FullCellAddr, PathCond> evalConds, List<CGCachedExpr> caches) { if (es.Length == 3) { CachedAtom atom = new CachedAtom(es[0], caches); es[0].EvalCond(evalCond, evalConds, caches); es[0] = atom.cachedExpr; es[1].EvalCond(evalCond.And(atom), evalConds, caches); es[2].EvalCond(evalCond.AndNot(atom), evalConds, caches); } }
public CGCachedExpr(CGExpr expr, CachedAtom cachedAtom, List<CGCachedExpr> caches) { this.expr = expr; this.cachedAtom = cachedAtom; this.cacheNumber = caches.Count; caches.Add(this); }
public override PathCond AndNot(CachedAtom cond) { return Conj.Make(this, cond.Negate()); }
public abstract PathCond AndNot(CachedAtom expr);
public override bool Equals(PathCond other) { CachedAtom atom = other as CachedAtom; return(atom != null && cachedExpr.Equals(atom.cachedExpr) && negated == atom.negated); }
public override PathCond AndNot(CachedAtom cond) { return(Conj.Make(this, cond.Negate())); }
public bool EqualsNega(PathCond other) { CachedAtom atom = other as CachedAtom; return(atom != null && cachedExpr.Equals(atom.cachedExpr) && negated != atom.negated); }