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 opcode;
}
-
-
-
public boolean equals(Map remap, Expr e) {
if (e==null||!(e instanceof OpExpr))
return false;
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;