|
|||||||||
Home >> All >> Compil3r >> [ Quad overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
Compil3r.Quad
Class ControlFlowGraph

java.lang.ObjectCompil3r.Quad.ControlFlowGraph
- All Implemented Interfaces:
- Util.Graphs.Graph
- public class ControlFlowGraph
- extends java.lang.Object
- implements Util.Graphs.Graph
- extends java.lang.Object
Control flow graph for the Quad format. The control flow graph is a fundamental part of the quad intermediate representation. The control flow graph organizes the basic blocks for a method. Control flow graphs always include an entry basic block and an exit basic block. These basic blocks are always empty and have id numbers 0 and 1, respectively. A control flow graph includes references to the entry and exit nodes, and the set of exception handlers for the method.
- Version:
- $Id: ControlFlowGraph.java,v 1.20 2003/06/17 02:12:27 joewhaley Exp $
Field Summary | |
private int |
bb_counter
|
private BasicBlock |
end_node
|
private java.util.List |
exception_handlers
|
(package private) java.util.Map |
jsr_map
|
private Clazz.jq_Method |
method
|
private int |
quad_counter
|
private RegisterFactory |
rf
|
private BasicBlock |
start_node
|
Constructor Summary | |
ControlFlowGraph(Clazz.jq_Method method,
int numOfExits,
int numOfExceptionHandlers,
RegisterFactory rf)
Creates a new ControlFlowGraph. |
Method Summary | |
(package private) void |
addExceptionHandler(ExceptionHandler eh)
|
void |
addJSRInfo(JSRInfo info)
|
(package private) static void |
addRegistersToMap(java.util.HashMap map,
RegisterFactory from,
RegisterFactory to)
|
(package private) static void |
addRegistersToMap(java.util.HashMap map,
RegisterFactory from,
RegisterFactory to,
Clazz.jq_Type type)
|
void |
appendExceptionHandlers(ExceptionHandlerList ehl)
|
private BasicBlock |
copier(java.util.HashMap map,
BasicBlock this_bb)
|
private ExceptionHandler |
copier(java.util.HashMap map,
ExceptionHandler this_eh)
|
private ExceptionHandlerList |
copier(java.util.HashMap map,
ExceptionHandlerList this_ehl)
|
private Quad |
copier(java.util.HashMap map,
Quad this_q)
|
BasicBlock |
createBasicBlock(int numOfPredecessors,
int numOfSuccessors,
int numOfInstructions,
ExceptionHandlerList ehs)
Create a new basic block in this control flow graph. |
BasicBlock |
entry()
Returns the entry node. |
BasicBlock |
exit()
Returns the exit node. |
java.lang.String |
fullDump()
Returns a verbose string of every basic block in this control flow graph. |
Util.Templates.List.ExceptionHandler |
getExceptionHandlers()
Return the list of exception handlers in this control flow graph. |
java.util.Iterator |
getExceptionHandlersMatchingEntry(BasicBlock b)
Return an iterator of the exception handlers with the given entry point. |
JSRInfo |
getJSRInfo(BasicBlock bb)
|
int |
getMaxQuadID()
Returns the maximum id number for a quad. |
Clazz.jq_Method |
getMethod()
Returns the method this control flow graph represents. |
Util.Graphs.Navigator |
getNavigator()
|
int |
getNewQuadID()
Returns a new id number for a quad. |
int |
getNumberOfBasicBlocks()
Returns a maximum on the number of basic blocks in this control flow graph. |
int |
getNumberOfQuads()
|
RegisterFactory |
getRegisterFactory()
Returns the register factory used by this control flow graph. |
java.util.Collection |
getRoots()
|
ControlFlowGraph |
merge(ControlFlowGraph from)
Merges the given control flow graph into this control flow graph. |
Util.Templates.List.BasicBlock |
postOrderOnReverseGraph(BasicBlock start_bb)
Returns a list of basic blocks of the reversed graph in post order, starting at the given basic block. |
Util.Templates.ListIterator.BasicBlock |
postOrderOnReverseGraphIterator()
Returns an iteration of the basic blocks in the reversed graph in post order. |
private void |
reversePostOrder_helper(BasicBlock b,
boolean[] visited,
java.util.LinkedList result,
boolean direction)
Helper function to compute reverse post order. |
Util.Templates.List.BasicBlock |
reversePostOrder(BasicBlock start_bb)
Returns a list of basic blocks in reverse post order, starting at the given basic block. |
Util.Templates.ListIterator.BasicBlock |
reversePostOrderIterator()
Returns an iteration of the basic blocks in this graph in reverse post order. |
Util.Templates.ListIterator.BasicBlock |
reversePostOrderIterator(BasicBlock start_bb)
Returns an iteration of the basic blocks in this graph reachable from the given basic block in reverse post order, starting from the given basic block. |
Util.Templates.List.BasicBlock |
reversePostOrderOnReverseGraph(BasicBlock start_bb)
Returns a list of basic blocks of the reversed graph in reverse post order, starting at the given basic block. |
Util.Templates.ListIterator.BasicBlock |
reversePostOrderOnReverseGraphIterator()
Returns an iteration of the basic blocks in the reversed graph in reverse post order. |
(package private) void |
updateBBcounter(int value)
Use with care after renumbering basic blocks. |
private void |
updateOperand(java.util.HashMap map,
Operand op)
|
void |
visitBasicBlocks(BasicBlockVisitor bbv)
Visits all of the basic blocks in this graph with the given visitor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
method
private final Clazz.jq_Method method
start_node
private final BasicBlock start_node
end_node
private final BasicBlock end_node
exception_handlers
private final java.util.List exception_handlers
rf
private final RegisterFactory rf
bb_counter
private int bb_counter
quad_counter
private int quad_counter
jsr_map
java.util.Map jsr_map
Constructor Detail |
ControlFlowGraph
public ControlFlowGraph(Clazz.jq_Method method, int numOfExits, int numOfExceptionHandlers, RegisterFactory rf)
- Creates a new ControlFlowGraph.
Method Detail |
entry
public BasicBlock entry()
- Returns the entry node.
exit
public BasicBlock exit()
- Returns the exit node.
getMethod
public Clazz.jq_Method getMethod()
- Returns the method this control flow graph represents.
May be null for synthetic methods.
getRegisterFactory
public RegisterFactory getRegisterFactory()
- Returns the register factory used by this control flow graph.
createBasicBlock
public BasicBlock createBasicBlock(int numOfPredecessors, int numOfSuccessors, int numOfInstructions, ExceptionHandlerList ehs)
- Create a new basic block in this control flow graph. The new basic block
is given a new, unique id number.
updateBBcounter
void updateBBcounter(int value)
- Use with care after renumbering basic blocks.
getNumberOfBasicBlocks
public int getNumberOfBasicBlocks()
- Returns a maximum on the number of basic blocks in this control flow graph.
getNumberOfQuads
public int getNumberOfQuads()
getNewQuadID
public int getNewQuadID()
- Returns a new id number for a quad.
getMaxQuadID
public int getMaxQuadID()
- Returns the maximum id number for a quad.
addJSRInfo
public void addJSRInfo(JSRInfo info)
getJSRInfo
public JSRInfo getJSRInfo(BasicBlock bb)
reversePostOrderIterator
public Util.Templates.ListIterator.BasicBlock reversePostOrderIterator()
- Returns an iteration of the basic blocks in this graph in reverse post order.
reversePostOrderOnReverseGraphIterator
public Util.Templates.ListIterator.BasicBlock reversePostOrderOnReverseGraphIterator()
- Returns an iteration of the basic blocks in the reversed graph in reverse post order.
The reversed graph is the graph where all edges are reversed.
postOrderOnReverseGraphIterator
public Util.Templates.ListIterator.BasicBlock postOrderOnReverseGraphIterator()
- Returns an iteration of the basic blocks in the reversed graph in post order.
The reversed graph is the graph where all edges are reversed.
reversePostOrderIterator
public Util.Templates.ListIterator.BasicBlock reversePostOrderIterator(BasicBlock start_bb)
- Returns an iteration of the basic blocks in this graph reachable from the given
basic block in reverse post order, starting from the given basic block.
visitBasicBlocks
public void visitBasicBlocks(BasicBlockVisitor bbv)
- Visits all of the basic blocks in this graph with the given visitor.
reversePostOrder
public Util.Templates.List.BasicBlock reversePostOrder(BasicBlock start_bb)
- Returns a list of basic blocks in reverse post order, starting at the given basic block.
reversePostOrderOnReverseGraph
public Util.Templates.List.BasicBlock reversePostOrderOnReverseGraph(BasicBlock start_bb)
- Returns a list of basic blocks of the reversed graph in reverse post order, starting at the given basic block.
postOrderOnReverseGraph
public Util.Templates.List.BasicBlock postOrderOnReverseGraph(BasicBlock start_bb)
- Returns a list of basic blocks of the reversed graph in post order, starting at the given basic block.
reversePostOrder_helper
private void reversePostOrder_helper(BasicBlock b, boolean[] visited, java.util.LinkedList result, boolean direction)
- Helper function to compute reverse post order.
addExceptionHandler
void addExceptionHandler(ExceptionHandler eh)
getExceptionHandlers
public Util.Templates.List.ExceptionHandler getExceptionHandlers()
- Return the list of exception handlers in this control flow graph.
getExceptionHandlersMatchingEntry
public java.util.Iterator getExceptionHandlersMatchingEntry(BasicBlock b)
- Return an iterator of the exception handlers with the given entry point.
fullDump
public java.lang.String fullDump()
- Returns a verbose string of every basic block in this control flow graph.
copier
private ExceptionHandler copier(java.util.HashMap map, ExceptionHandler this_eh)
copier
private ExceptionHandlerList copier(java.util.HashMap map, ExceptionHandlerList this_ehl)
updateOperand
private void updateOperand(java.util.HashMap map, Operand op)
copier
private Quad copier(java.util.HashMap map, Quad this_q)
copier
private BasicBlock copier(java.util.HashMap map, BasicBlock this_bb)
addRegistersToMap
static void addRegistersToMap(java.util.HashMap map, RegisterFactory from, RegisterFactory to, Clazz.jq_Type type)
addRegistersToMap
static void addRegistersToMap(java.util.HashMap map, RegisterFactory from, RegisterFactory to)
merge
public ControlFlowGraph merge(ControlFlowGraph from)
- Merges the given control flow graph into this control flow graph.
Doesn't modify the given control flow graph. A copy of the
given control flow graph (with appropriate renumberings) is
returned.
appendExceptionHandlers
public void appendExceptionHandlers(ExceptionHandlerList ehl)
getRoots
public java.util.Collection getRoots()
- Specified by:
getRoots
in interfaceUtil.Graphs.Graph
getNavigator
public Util.Graphs.Navigator getNavigator()
- Specified by:
getNavigator
in interfaceUtil.Graphs.Graph
|
|||||||||
Home >> All >> Compil3r >> [ Quad overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |