Expr right;
Opcode opcode;
+ public Expr getUpper() {
+ Expr lupper=left.getUpper();
+ if (lupper==null)
+ return null;
+ if (right!=null) {
+ Expr rupper=right.getUpper();
+ if (rupper==null)
+ return null;
+ OpExpr oe=new OpExpr(this.opcode,lupper,rupper);
+ oe.td = ReservedTypeDescriptor.INT;
+ return oe;
+ } else return lupper;
+ }
+
+ public Expr getLower() {
+ Expr llower=left.getLower();
+ if (llower==null)
+ return null;
+ if (right!=null) {
+ Expr rlower=right.getLower();
+ if (rlower==null)
+ return null;
+ OpExpr oe=new OpExpr(this.opcode,llower,rlower);
+ oe.td = ReservedTypeDescriptor.INT;
+ return oe;
+ } else return llower;
+ }
+
+ public boolean isSafe() {
+ if (right==null)
+ return left.isSafe();
+ return left.isSafe()&&right.isSafe();
+ }
+
+ public Set getfunctions() {
+ Set leftfunctions=left.getfunctions();
+ Set rightfunctions=right.getfunctions();
+ if (leftfunctions!=null&&rightfunctions!=null) {
+ HashSet functions=new HashSet();
+ functions.addAll(leftfunctions);
+ functions.addAll(rightfunctions);
+ return functions;
+ }
+ if (leftfunctions!=null)
+ return leftfunctions;
+ return rightfunctions;
+ }
+
public void findmatch(Descriptor d, Set s) {
left.findmatch(d,s);
if (right!=null)
return opcode;
}
-
-
-
public boolean equals(Map remap, Expr e) {
if (e==null||!(e instanceof OpExpr))
return false;
}
public boolean usesDescriptor(Descriptor d) {
- if (opcode==Opcode.GT||opcode==Opcode.GE||opcode==Opcode.LT||
- opcode==Opcode.LE||opcode==Opcode.EQ||opcode==Opcode.NE)
- return left.usesDescriptor(d)||(right!=null&&right.usesDescriptor(d));
- // return right.usesDescriptor(d);
- else
- return left.usesDescriptor(d)||(right!=null&&right.usesDescriptor(d));
+ return left.usesDescriptor(d)||(right!=null&&right.usesDescriptor(d));
}
-
+ public Set useDescriptor(Descriptor d) {
+ HashSet newset=new HashSet();
+ newset.addAll(left.useDescriptor(d));
+ if (right!=null)
+ newset.addAll(right.useDescriptor(d));
+ return newset;
+ }
+
public int[] getRepairs(boolean negated, Termination t) {
if (left instanceof RelationExpr)
return new int[] {AbstractRepair.MODIFYRELATION};
if ((opcode==Opcode.OR)||
(opcode==Opcode.AND)) {
writer.outputline("int "+lm.getSafeSymbol()+"=maybe;");
- writer.outputline("int maybe=0;");
+ writer.outputline("maybe=0;");
}
rd = VarDescriptor.makeNew("rightop");
} else if (opcode == Opcode.AND) {
writer.outputline("int "+rm.getSafeSymbol()+"=maybe;");
writer.outputline("maybe = (" + ld.getSafeSymbol() + " && " + rm.getSafeSymbol() + ") || (" + rd.getSafeSymbol() + " && " + lm.getSafeSymbol() + ") || (" + lm.getSafeSymbol() + " && " + rm.getSafeSymbol() + ");");
- writer.outputline(dest.getSafeSymbol() + " = " + ld.getSafeSymbol() + " && " + rd.getSafeSymbol() + ";");
+ writer.outputline("int "+dest.getSafeSymbol() + " = " + ld.getSafeSymbol() + " && " + rd.getSafeSymbol() + ";");
} else if (opcode == Opcode.OR) {
writer.outputline("int "+rm.getSafeSymbol()+"=maybe;");
writer.outputline("maybe = (!" + ld.getSafeSymbol() + " && " + rm.getSafeSymbol() + ") || (!" + rd.getSafeSymbol() +
" && " + lm.getSafeSymbol() + ") || (" + lm.getSafeSymbol() + " && " + rm.getSafeSymbol() + ");");
- writer.outputline(dest.getSafeSymbol() + " = " + ld.getSafeSymbol() + " || " + rd.getSafeSymbol() +
+ writer.outputline("int "+dest.getSafeSymbol() + " = " + ld.getSafeSymbol() + " || " + rd.getSafeSymbol() +
";");
} else if (opcode != Opcode.NOT) { /* two operands */
assert rd != null;