/** Find non-locals variables. Algorithm from Briggs, Cooper, Harvey and Simpson */
  public BitSet findNonLocals() {
    BitSet nonLocals = new BitSet(nbVar);
    BitSet killed = new BitSet(nbVar);
    BitSet emptySet = new BitSet(nbVar);
    for (BasicBlock bb = firstBB; bb != null; bb = bb.getNext()) {
      // clear killed set
      killed.and(emptySet);

      Iterator insts = bb.getInstructions();
      while (insts.hasNext()) {
        QInst inst = (QInst) insts.next();
        QOperandBox[] ops = inst.getUses();
        for (int i = 0; i < ops.length; ++i) {
          QOperand op = ops[i].getOperand();
          if (op instanceof QVar) {
            int r = ((QVar) op).getRegister();
            if (!killed.get(r)) {
              nonLocals.set(r);
            }
          }
        }
        if (inst.defVar()) {
          QOperand op = inst.getDefined().getOperand();
          if (op instanceof QVar) {
            int r = ((QVar) op).getRegister();
            killed.set(r);
          }
        }
      }
    }
    return nonLocals;
  }
 /** Precolor the SSA init variable */
 protected void precolorInitVariables() {
   Iterator insts = start.getInstructions();
   while (insts.hasNext()) {
     QInst inst = (QInst) insts.next();
     if (inst instanceof QDeclareInitialised) {
       QOperand op = inst.getDefined().getOperand();
       if (op instanceof QSSAVar) {
         SSAVar var = ((QSSAVar) op).getSSAVar();
         var.setColor(var.getSourceIndex());
       }
     }
   }
 }