/**
  * Update the value graph to account for a given IfCmp instruction.
  *
  * <p><b>PRECONDITION:</b> <code> IfCmp.conforms(s); </code>
  *
  * @param s the instruction in question
  */
 private void processIfCmp(Instruction s) {
   ValueGraphVertex v = new ValueGraphVertex(s);
   graph.addGraphNode(v);
   nameMap.put(s, v);
   v.setLabel(s.operator(), 3);
   link(v, findOrCreateVertex(bypassMoves(IfCmp.getVal1(s))), 0);
   link(v, findOrCreateVertex(bypassMoves(IfCmp.getVal2(s))), 1);
   link(v, findOrCreateVertex(IfCmp.getCond(s)), 2);
 }
 /**
  * Update the value graph to account for a given GuardedBinary instruction.
  *
  * <p><b>PRECONDITION:</b> <code> GuardedBinary.conforms(s); </code> Careful: we define two
  * Guarded Binaries to be equivalent regardless of whether the guards are equivalent!
  *
  * @param s the instruction in question
  */
 private void processGuardedBinary(Instruction s) {
   // label the vertex corresponding to the result with the operator
   RegisterOperand result = GuardedBinary.getResult(s);
   ValueGraphVertex v = findOrCreateVertex(result.getRegister());
   v.setLabel(s.operator(), 2);
   // link node v to the two operands it uses
   // first link the first val
   Operand val = GuardedBinary.getVal1(s);
   val = bypassMoves(val);
   link(v, findOrCreateVertex(val), 0);
   Operand val2 = GuardedBinary.getVal2(s);
   val2 = bypassMoves(val2);
   link(v, findOrCreateVertex(val2), 1);
 }
 /**
  * Update the value graph to account for a given InlineGuard instruction.
  *
  * <p><b>PRECONDITION:</b> <code> InlineGuard.conforms(s); </code>
  *
  * @param s the instruction in question
  */
 private void processInlineGuard(Instruction s) {
   ValueGraphVertex v = new ValueGraphVertex(s);
   graph.addGraphNode(v);
   nameMap.put(s, v);
   if (s.operator() == IG_PATCH_POINT) {
     // the 'goal' is irrelevant for patch_point guards.
     v.setLabel(s.operator(), 1);
     link(v, findOrCreateVertex(bypassMoves(InlineGuard.getValue(s))), 0);
   } else {
     v.setLabel(s.operator(), 2);
     link(v, findOrCreateVertex(bypassMoves(InlineGuard.getValue(s))), 0);
     link(v, findOrCreateVertex(InlineGuard.getGoal(s)), 1);
   }
 }
 /**
  * Update the value graph to account for a given NullCheck instruction.
  *
  * <p><b>PRECONDITION:</b> <code> ZeroCheck.conforms(s); </code>
  *
  * @param s the instruction in question
  */
 private void processZeroCheck(Instruction s) {
   // label the vertex corresponding to the result with the operator
   RegisterOperand result = ZeroCheck.getGuardResult(s);
   ValueGraphVertex v = findOrCreateVertex(result.getRegister());
   v.setLabel(s.operator(), 1);
   // link node v to the operand it uses
   Operand val = ZeroCheck.getValue(s);
   // bypass Move instructions
   val = bypassMoves(val);
   link(v, findOrCreateVertex(val), 0);
 }
 /**
  * Update the value graph to account for a given Phi instruction.
  *
  * <p><b>PRECONDITION:</b> <code> Phi.conforms(s); </code>
  *
  * @param s the instruction in question
  */
 private void processPhi(Instruction s) {
   // the label for a PHI instruction is the basic block
   // in which it appears
   Register result = Phi.getResult(s).asRegister().getRegister();
   ValueGraphVertex v = findOrCreateVertex(result);
   BasicBlock bb = s.getBasicBlock();
   v.setLabel(bb, bb.getNumberOfIn());
   // link node v to all operands it uses
   for (int i = 0; i < Phi.getNumberOfValues(s); i++) {
     Operand val = Phi.getValue(s, i);
     val = bypassMoves(val);
     ValueGraphVertex target = findOrCreateVertex(val);
     link(v, target, i);
   }
 }