public void tox86(Genx86 generator) throws IOException, InvalidCodeException {
    left.register = register;
    right.register = register + 1;

    String leftReg = generator.regName(left.register, left.type);
    String rightReg = generator.regName(right.register, right.type);

    // save
    generator.write(generator.save(register + 1));

    left.tox86(generator);
    right.tox86(generator);
    generator.write(generator.compare(leftReg, rightReg, left.type, right.type));

    switch (operator) {
      case sym.LT:
        lowerThan(generator, leftReg, rightReg, false);
        break;
      case sym.GT:
        greaterThan(generator, leftReg, rightReg, false);
        break;
      case sym.LTE:
        lowerThan(generator, leftReg, rightReg, true);
        break;
      case sym.GTE:
        greaterThan(generator, leftReg, rightReg, true);
        break;
      case sym.SHEQ:
        equal(generator, leftReg, rightReg, false);
        break;
      case sym.DEEQ:
        equal(generator, leftReg, rightReg, true);
        break;
      case sym.NOEQ:
        notEqual(generator, leftReg, rightReg);
    }

    // restore
    generator.write(generator.restore(register + 1));

    generator.write(generator.jump(noLabel));
  }
 public void notEqual(Genx86 generator, String a, String b)
     throws IOException, InvalidCodeException {
   generator.write(generator.jne(yesLabel));
 }
 public void equal(Genx86 generator, String a, String b, boolean deep)
     throws IOException, InvalidCodeException {
   generator.write(generator.je(yesLabel));
 }
 public void greaterThan(Genx86 generator, String a, String b, boolean orEqual)
     throws IOException, InvalidCodeException {
   if (orEqual) generator.write(generator.jge(yesLabel));
   else generator.write(generator.jg(yesLabel));
 }