1 salcianu 1.1.2.1 // BasicBlockInterf.java, created Fri Dec 14 19:37:55 2001 by salcianu 2 salcianu 1.1.2.1 // Copyright (C) 2000 Alexandru SALCIANU <salcianu@MIT.EDU> 3 salcianu 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 salcianu 1.1.2.1 package harpoon.Analysis; 5 salcianu 1.1.2.1 6 salcianu 1.1.2.1 import java.util.Set; 7 salcianu 1.1.2.1 import java.util.List; 8 salcianu 1.1.2.1 9 salcianu 1.1.2.1 import harpoon.ClassFile.HCode; 10 salcianu 1.1.2.1 import harpoon.ClassFile.HCodeElement; 11 salcianu 1.1.2.1 12 salcianu 1.1.2.1 /** 13 salcianu 1.1.2.1 * <code>BasicBlockInterf</code> is the interface that needs to be 14 salcianu 1.1.2.1 * implemented by any "basic block"-like structure. Basic 15 salcianu 1.1.2.1 * block views of the code groups together lists of consecutive 16 salcianu 1.1.2.1 * instructions in basic blocks. For each basic block, we have a list 17 salcianu 1.1.2.1 * of statements contained by it, a set of predecessor basic blocks 18 salcianu 1.1.2.1 * and a set of successor basic blocks. Different implementations of 19 salcianu 1.1.2.1 * <code>BasicBlockInterf</code> respect different sets of constraints. 20 salcianu 1.1.2.1 * 21 salcianu 1.1.2.1 * @author Alexandru SALCIANU <salcianu@MIT.EDU> 22 cananian 1.3 * @version $Id: BasicBlockInterf.java,v 1.3 2002/04/10 02:58:48 cananian Exp $ */ 23 cananian 1.2.2.1 public interface BasicBlockInterf<HCE extends HCodeElement,BB extends BasicBlockInterf> { 24 salcianu 1.1.2.1 25 salcianu 1.1.2.1 /** Returns the first statement of the basic block. */ 26 cananian 1.2.2.1 public HCE getFirst(); 27 salcianu 1.1.2.1 28 salcianu 1.1.2.1 /** Returns the last statement of the basic block. */ 29 cananian 1.2.2.1 public HCE getLast(); 30 salcianu 1.1.2.1 31 salcianu 1.1.2.1 /** Returns <i>all</i> the predecessors of the basic block, 32 salcianu 1.1.2.1 according to the normal <i>and</i> the exceptional control flow. */ 33 cananian 1.2.2.1 public Set<BB> prevSet(); 34 salcianu 1.1.2.1 35 salcianu 1.1.2.1 /** Returns <i>all</i> the successors of the basic block, 36 salcianu 1.1.2.1 according to the normal <i>and</i> the exceptional control flow. */ 37 cananian 1.2.2.1 public Set<BB> nextSet(); 38 salcianu 1.1.2.1 39 salcianu 1.1.2.1 /** Returns the list of the statements composing the basic 40 salcianu 1.1.2.1 block. */ 41 cananian 1.2.2.1 public List<HCE> statements(); 42 salcianu 1.1.2.1 43 salcianu 1.1.2.1 /** Calls the appropriate <code>visit</code> method from 44 salcianu 1.1.2.1 <code>visitor</code>. The concept of 45 salcianu 1.1.2.1 <code>BasicBlockInterfVisitor</code> is similar to the concept 46 salcianu 1.1.2.1 of <code>QuadVisitor</code>. Both of them were introduced to 47 salcianu 1.1.2.1 allow pure object oriented programming, that is virtual 48 salcianu 1.1.2.1 methods instead of <code>instanceof</code> tests. */ 49 salcianu 1.1.2.1 public void accept(BasicBlockInterfVisitor visitor); 50 cananian 1.2 }