예제 #1
0
파일: CFG.java 프로젝트: christ66/findbugs
 /**
  * Look up a BasicBlock by its unique label.
  *
  * @param blockLabel the label of a BasicBlock
  * @return the BasicBlock with the given label, or null if there is no such BasicBlock
  */
 public BasicBlock lookupBlockByLabel(int blockLabel) {
   for (Iterator<BasicBlock> i = blockIterator(); i.hasNext(); ) {
     BasicBlock basicBlock = i.next();
     if (basicBlock.getLabel() == blockLabel) {
       return basicBlock;
     }
   }
   return null;
 }
예제 #2
0
파일: CFG.java 프로젝트: christ66/findbugs
 /**
  * Get Collection of basic blocks whose IDs are specified by given BitSet.
  *
  * @param labelSet BitSet of block labels
  * @return a Collection containing the blocks whose IDs are given
  */
 public Collection<BasicBlock> getBlocks(BitSet labelSet) {
   LinkedList<BasicBlock> result = new LinkedList<BasicBlock>();
   for (Iterator<BasicBlock> i = blockIterator(); i.hasNext(); ) {
     BasicBlock block = i.next();
     if (labelSet.get(block.getLabel())) {
       result.add(block);
     }
   }
   return result;
 }
예제 #3
0
파일: CFG.java 프로젝트: christ66/findbugs
 public void checkIntegrity() {
   // Ensure that basic blocks have only consecutive instructions
   for (Iterator<BasicBlock> i = blockIterator(); i.hasNext(); ) {
     BasicBlock basicBlock = i.next();
     InstructionHandle prev = null;
     for (Iterator<InstructionHandle> j = basicBlock.instructionIterator(); j.hasNext(); ) {
       InstructionHandle handle = j.next();
       if (prev != null && prev.getNext() != handle) {
         throw new IllegalStateException(
             "Non-consecutive instructions in block "
                 + basicBlock.getLabel()
                 + ": prev="
                 + prev
                 + ", handle="
                 + handle);
       }
       prev = handle;
     }
   }
 }
예제 #4
0
 /**
  * Gets the register set associated with the start of the given block. This is just convenient
  * shorthand for <code>getStarts(block.getLabel())</code>.
  *
  * @param block non-null; the block in question
  * @return non-null; the associated register set
  */
 public RegisterSpecSet getStarts(BasicBlock block) {
   return getStarts(block.getLabel());
 }