/**
  * Branching code generation for == operation.
  *
  * @param output the code emitter (basically an abstraction for producing the .class file).
  * @param targetLabel target for generated branch instruction.
  * @param onTrue should we branch on true?
  */
 public void codegen(CLEmitter output, String targetLabel, boolean onTrue) {
   lhs.codegen(output);
   rhs.codegen(output);
   if (lhs.type().isReference()) {
     output.addBranchInstruction(onTrue ? IF_ACMPEQ : IF_ACMPNE, targetLabel);
   } else {
     output.addBranchInstruction(onTrue ? IF_ICMPEQ : IF_ICMPNE, targetLabel);
   }
 }
 /**
  * Generate code for the case where we actually want a boolean value (true or false) computed onto
  * the stack, eg for assignment to a boolean variable.
  *
  * @param output the code emitter (basically an abstraction for producing the .class file).
  */
 public void codegen(CLEmitter output) {
   String elseLabel = output.createLabel();
   String endIfLabel = output.createLabel();
   this.codegen(output, elseLabel, false);
   output.addNoArgInstruction(ICONST_1); // true
   output.addBranchInstruction(GOTO, endIfLabel);
   output.addLabel(elseLabel);
   output.addNoArgInstruction(ICONST_0); // false
   output.addLabel(endIfLabel);
 }