} else if (operand instanceof Constant) { Constant con = (Constant) operand;
} else if (refs[0] instanceof Constant) { Constant con = (Constant) refs[0];
	public void generateCode(CodeGenerator cg) {		Variable lhs = getLHS();		Location lhsLoc = lhs.getLocation();		if (lhsLoc instanceof RegisterLocation) {			RegisterLocation regLoc = (RegisterLocation) lhsLoc;			Object lhsReg = regLoc.getRegister();			if (operand instanceof Variable) {				Variable var = (Variable) operand;				Location varLoc = var.getLocation();				if (varLoc instanceof RegisterLocation) {					RegisterLocation vregLoc = (RegisterLocation) varLoc;					cg.generateCodeFor(this, lhsReg, operation, vregLoc.getRegister());				} else if (varLoc instanceof StackLocation) {					StackLocation stackLoc = (StackLocation) varLoc;					cg.generateCodeFor(this, lhsReg, operation, stackLoc.getDisplacement());				} else {					throw new IllegalArgumentException("Unknown location: " + varLoc);				}			} else if (operand instanceof Constant) {				// this probably won't happen, is should be folded earlier				Constant con = (Constant) operand;				cg.generateCodeFor(this, lhsReg, operation, con);			} else {				throw new IllegalArgumentException("Unknown operand: " + operand);			}		} else if (lhsLoc instanceof StackLocation) {			StackLocation lhsStackLoc = (StackLocation) lhsLoc;			int lhsDisp = lhsStackLoc.getDisplacement();			if (operand instanceof Variable) {				Variable var = (Variable) operand;				Location varLoc = var.getLocation();				if (varLoc instanceof RegisterLocation) {					RegisterLocation vregLoc = (RegisterLocation) varLoc;					cg.generateCodeFor(this, lhsDisp, operation, vregLoc.getRegister());				} else if (varLoc instanceof StackLocation) {					StackLocation stackLoc = (StackLocation) varLoc;					cg.generateCodeFor(this, lhsDisp, operation, stackLoc.getDisplacement());				} else {					throw new IllegalArgumentException("Unknown location: " + varLoc);				}			} else if (operand instanceof Constant) {				Constant con = (Constant) operand;				cg.generateCodeFor(this, lhsDisp, operation, con);			} else {				throw new IllegalArgumentException("Unknown operand: " + operand);			}		} else {			throw new IllegalArgumentException("Unknown location: " + lhsLoc);		}	}