getUsesFromPHIs(bblock);
getUsesFromPhis(bblock);
  private void computeBlockGenAndKill(OPT_BasicBlock bblock, OPT_IR ir) {    if (verbose) {      System.out.println(" --> Computing Gen/Kill for block " + bblock);    }        // Tells whether we've seen the first PEI    boolean seenFirstPEI = false;    // Because control flow may emanate from a potentially excepting    // instruction (PEI) out of the basic block, care must be taken     // when computing what can be killed by a basic block.      //    //  S1:  y =     //  S2:  <exception-raising inst>    //  S3:  x =    // For example in the block above, live variables coming from    // the normal exit of the block (i.e., after S3) can be killed    // by S1 or S3 (depending on the variable).  However, live variables    // coming from the PEI edge (at S2) can only be killed by S1.    // Thus, when a block contains PEIs, we need to distinguish the    // kill sets.  Namely, we need     //    Kill_tot  -  what can be killed anywhere in the block    //    Kill_n    -  what can be killed from PEI_n on up    //    Kill_n-1  -  what can be killed from PEI_n-1 on up    //      ...    //    Kill_1    -  what can be killed from PEI_1 on up    // We would then compute In as follows    //    //  In = Out_norm - Kill_tot   (all vars entering from bottom are eligible    //                                to be killed)    //     U Out_n - Kill_n        //     U Out_n-1 - Kill_n-1    //     ...    //     U Out_1 - Kill_1    //     U Gen    //  where Out_n is the out information at PEI i, i.e., the IN information    //  for whatever handlers may catch PEI i    //    ...    //    PEI 1    //    ...    //    PEI n-1    //    ...    //    PEI n    //    ...    //  If we conservatively assume all handlers for the block of interest    //  can be reached by all PEIs in this block then the equation becomes    //   In = (Out_norm - Kill_tot)    //     U (Out_hand - Kill_n)    //     U (Out_hand - Kill_n-1)    //     ...    //     U (Out_hand - Kill_1)    //     U Gen    // where "Out_hand" is the union of the in sets for all handlers.    // Since Kill_i is a subset of Kill_j, for i < j, we can simplify to    //   In = (Out_norm - Kill_tot)    //     U (Out_hand - Kill_1)    (1)    //     U Gen    // Since kill_1 is a subset of kill_tot, we don't need the    // the parenthesis (and the intermediate set)    // If there are no handlers than (1) is empty and we don't need    // to compute Kill_1.  We will take this approach for now.    // So for each block we will have at most 2 kill sets: Kill_tot and Kill_1    // This code finds the first PEI in the block        OPT_Instruction firstPEI = null;    if (bblock.canThrowExceptions()) {      for (OPT_Instruction inst = bblock.start;           inst != bblock.end; inst = inst.getNext()) {        if (inst.isPEI() &&             bblock.getApplicableExceptionalOut(inst).hasMoreElements()) {          firstPEI = inst;	  // remember that this block has a PEI with a handler for use	  //  later in "processBlock"	  bbLiveInfo[bblock.getNumber()].setContainsPEIWithHandler(true);          break;        }      }    }    // Get any uses from PHIs, which are in the successor blocks    getUsesFromPHIs(bblock);    // Traverse instructions in reverse order within the basic block.    for (OPT_Instruction inst = bblock.end; inst != bblock.start;         inst = inst.getPrev()) {      // traverse from defs to uses becauses uses happen after       // (in a backward sense) defs      OPT_OperandEnumeration defs = inst.getPureDefs();      while (defs.hasMoreElements()) {        OPT_Operand def = defs.next();        if (def instanceof OPT_RegisterOperand) {          OPT_RegisterOperand regOp = (OPT_RegisterOperand)def;          // Do we care about this reg?          if (isSkippableReg(regOp,ir))            continue;          VM_Type regType = regOp.type;          // Because the summary we compute is used to propagate to other          // basic blocks, if a register is block local, we don't need to          // include it.  It will be picked up later by local propagation phase.          if (regOp.register.spansBasicBlock() && regType != null) {            // if it is a DEF we place it is the BBKillSet and remove it from            // the GEN set, (GEN should only contain upward-exposed uses,            // i.e., uses that are NOT dominated by a DEF).            // We don't need to worry about PEIs here because             // later instructions (traversing backwards like we are)             // will always dominate earlier instructions *of this block*            bbLiveInfo[bblock.getNumber()].BBKillSet().add(regOp);            bbLiveInfo[bblock.getNumber()].getGen().remove(regOp);            // However, if an exception can emanate from this basic block            // we are not guaranteed that all instructions will be executed            // in this block.  We allow killing of instructions            // after the last (in a backwards sense) potential exception            // throwing statement. (PEI)            // If there are no PEIs in this block we don't bother to add            if (seenFirstPEI) {              bbLiveInfo[bblock.getNumber()].firstPEIKillSet().add(regOp);            }          }        }      }      // Now process the uses, unless this is a PHI operator      if (inst.operator() != PHI) {        for (OPT_OperandEnumeration uses = inst.getUses();             uses.hasMoreElements();) {          OPT_Operand use = uses.next();          if (use instanceof OPT_RegisterOperand) {            OPT_RegisterOperand regOp = (OPT_RegisterOperand)use;            // Do we care about this reg?            if (isSkippableReg(regOp,ir))              continue;            VM_Type regType = regOp.type;            // Because the summary we compute is used to propagate to            // other basic blocks, if a register is block local,             // we don't need to include it.  It will be picked up             // later by local propagation phase.            if (regOp.register.spansBasicBlock() && regType != null) {              bbLiveInfo[bblock.getNumber()].getGen().add(regOp);            }          }                     // is RegOp        }       // foreach use      }         // not a PHI      // check whether the instruction we just processed is the first      // (last, thinking backwards) exception-raising instruction.      // If so, set the flag so we can start killing.      if (firstPEI == inst) {        seenFirstPEI = true;      }    }           // foreach instruction in block    if (verbose) {      System.out.println("  Gen: " + bbLiveInfo[bblock.getNumber()].getGen());      System.out.println("  Kill: "           + bbLiveInfo[bblock.getNumber()].BBKillSet());      System.out.println("  1st PEI Kill: "           + bbLiveInfo[bblock.getNumber()].firstPEIKillSet());      System.out.println(" ---> Done computing Gen/Kill for block");    }  }