|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.wala.ssa.analysis.ExpandedControlFlowGraph
public class ExpandedControlFlowGraph
The ExpandedControlFlowGraph provides a convenient way of performing dataflow analyses over the SSA IR. The SSA IR is efficient, but complicates analyses by exposing null instructions, and by working at the (more efficient) basic-blocks level. The ExpandedControlFlowGraph has the following features: 1. it has a single instruction per basic block (acutally, it uses SingleInstructionBasicBlocks) 2. all instructions, including phi instructions, are present in the graph 3. there are no null instructions in the graph, these are skipped over 4. there are designated single entry and single exit nodes that do not contain any instructions At least at this stage, I prefer the less efficient, but more clear ExpandedControlFlowGraph representation. TODO: this needs MAJOR refactoring !!! [EY]
| Nested Class Summary | |
|---|---|
class |
ExpandedControlFlowGraph.SingleInstructionBasicBlock
SingleInstructionBasicBlock A basic-block containing a single instructions. |
class |
ExpandedControlFlowGraph.SingleInstructionExceptionHandlerBlock
SingleInstructionExceptionHandlerBlock BB for exception handler. |
| Constructor Summary | |
|---|---|
ExpandedControlFlowGraph(IR ir)
create an ExpandedControlFlowGraph |
|
| Method Summary | |
|---|---|
void |
addEdge(IBasicBlock src,
IBasicBlock dst)
unsupported operation |
void |
addNode(IBasicBlock n)
unsupported operation |
boolean |
containsNode(IBasicBlock n)
unsupported operation |
void |
dumpDotFile()
dump dot files of the current CFG and the underlying original CFG. |
IBasicBlock |
entry()
Return the entry basic block in the CFG |
IBasicBlock |
exit()
|
java.util.Collection |
getAllInstructions()
get all instructions in the method |
IBasicBlock |
getBlockForInstruction(int index)
|
IBasicBlock |
getBlockForInstruction(SSAInstruction s)
|
BitVector |
getCatchBlocks()
|
java.util.Collection<IBasicBlock> |
getExceptionalPredecessors(IBasicBlock b)
The order of blocks returned should be arbitrary but deterministic. |
java.util.Collection<IBasicBlock> |
getExceptionalSuccessors(IBasicBlock b)
The order of blocks returned should be arbitrary but deterministic. |
IBasicBlock |
getFallThroughTarget(IBasicBlock src)
get the fall-through target of a given source block |
ExpandedControlFlowGraph.SingleInstructionBasicBlock |
getInstructionBlock(SSAInstruction inst)
return the Instruction-Block for the given instruction. |
IInstruction[] |
getInstructions()
|
int |
getMaxNumber()
unsupported operation |
IMethod |
getMethod()
|
IBasicBlock |
getNode(int i)
|
java.util.Collection<IBasicBlock> |
getNormalPredecessors(IBasicBlock b)
The order of blocks returned should be arbitrary but deterministic. |
java.util.Collection<IBasicBlock> |
getNormalSuccessors(IBasicBlock b)
The order of blocks returned should be arbitrary but deterministic. |
int |
getNumber(IBasicBlock n)
unsupported operation |
int |
getNumberOfNodes()
|
java.util.List |
getPredecessors(SSACFG.BasicBlock dest)
get predecessors of a basic block |
int |
getPredNodeCount(IBasicBlock node)
Return the number of immediate predecessor
nodes of this Node
in the Graph. |
IntSet |
getPredNodeNumbers(IBasicBlock node)
|
java.util.Iterator<IBasicBlock> |
getPredNodes(IBasicBlock node)
Return an Iterator over the immediate predecessor nodes of this Node
in the Graph. |
int |
getProgramCounter(int index)
|
java.util.List |
getSuccessors(SSACFG.BasicBlock src)
get successors of a basic block |
int |
getSuccNodeCount(IBasicBlock node)
Return the number of immediate successor
nodes of this Node
in the Graph |
IntSet |
getSuccNodeNumbers(IBasicBlock node)
|
java.util.Iterator<IBasicBlock> |
getSuccNodes(IBasicBlock node)
Return an Iterator over the immediate successor nodes of this Node in
the Graph |
java.util.Set |
getTrueCasePiInstructions()
get a set of true-case pi instructions |
boolean |
hasEdge(IBasicBlock src,
IBasicBlock dst)
|
boolean |
isFallThroughTarget(IBasicBlock src,
IBasicBlock dest)
|
java.util.Iterator<IBasicBlock> |
iterateNodes(IntSet set)
unsupported operation |
java.util.Iterator<IBasicBlock> |
iterator()
|
void |
removeAllIncidentEdges(IBasicBlock node)
unsupported operation |
void |
removeEdge(IBasicBlock src,
IBasicBlock dst)
unsupported operation |
void |
removeIncomingEdges(IBasicBlock node)
unsupported operation |
void |
removeNode(IBasicBlock obj)
unsupported operation |
void |
removeNodeAndEdges(IBasicBlock n)
unsupported operation |
void |
removeOutgoingEdges(IBasicBlock node)
unsupported operation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ExpandedControlFlowGraph(IR ir)
ir - -
method's IR (just to avoid re-getting it)
java.lang.IllegalArgumentException - if ir is null| Method Detail |
|---|
public ExpandedControlFlowGraph.SingleInstructionBasicBlock getInstructionBlock(SSAInstruction inst)
inst - -
instruction
public java.util.Collection getAllInstructions()
public java.util.Set getTrueCasePiInstructions()
public java.util.List getSuccessors(SSACFG.BasicBlock src)
src - -
source basic block
public java.util.List getPredecessors(SSACFG.BasicBlock dest)
dest - -
destination basic block (starting point)
public IBasicBlock entry()
entry in interface ControlFlowGraphpublic IBasicBlock exit()
exit in interface ControlFlowGraphpublic BitVector getCatchBlocks()
getCatchBlocks in interface ControlFlowGraphpublic IBasicBlock getBlockForInstruction(int index)
getBlockForInstruction in interface ControlFlowGraphindex - an instruction index
public IBasicBlock getBlockForInstruction(SSAInstruction s)
public IInstruction[] getInstructions()
getInstructions in interface ControlFlowGraphpublic int getProgramCounter(int index)
getProgramCounter in interface ControlFlowGraphindex - an instruction index
public IMethod getMethod()
getMethod in interface ControlFlowGraphpublic java.util.Collection<IBasicBlock> getExceptionalSuccessors(IBasicBlock b)
ControlFlowGraph
getExceptionalSuccessors in interface ControlFlowGraphb -
public java.util.Collection<IBasicBlock> getNormalSuccessors(IBasicBlock b)
ControlFlowGraph
getNormalSuccessors in interface ControlFlowGraphb -
public int getPredNodeCount(IBasicBlock node)
EdgeManagerimmediate predecessor
nodes of this Node
in the Graph.
getPredNodeCount in interface EdgeManager<IBasicBlock>node - -
source node
public java.util.Iterator<IBasicBlock> getSuccNodes(IBasicBlock node)
EdgeManagernodes of this Node in
the Graph
This method never returns null.
getSuccNodes in interface EdgeManager<IBasicBlock>node - -
source node
public int getSuccNodeCount(IBasicBlock node)
EdgeManagerimmediate successor
nodes of this Node
in the Graph
getSuccNodeCount in interface EdgeManager<IBasicBlock>node - -
source node
public void addEdge(IBasicBlock src,
IBasicBlock dst)
throws java.lang.UnsupportedOperationException
addEdge in interface EdgeManager<IBasicBlock>java.lang.UnsupportedOperationException - unconditionally
public void removeEdge(IBasicBlock src,
IBasicBlock dst)
removeEdge in interface EdgeManager<IBasicBlock>public void removeAllIncidentEdges(IBasicBlock node)
removeAllIncidentEdges in interface EdgeManager<IBasicBlock>public void removeIncomingEdges(IBasicBlock node)
removeIncomingEdges in interface EdgeManager<IBasicBlock>public void removeOutgoingEdges(IBasicBlock node)
removeOutgoingEdges in interface EdgeManager<IBasicBlock>public java.util.Iterator<IBasicBlock> iterateNodes(IntSet set)
iterateNodes in interface NumberedNodeManager<IBasicBlock>public boolean containsNode(IBasicBlock n)
containsNode in interface NodeManager<IBasicBlock>public int getMaxNumber()
getMaxNumber in interface NumberedNodeManager<IBasicBlock>public java.util.Iterator<IBasicBlock> iterator()
iterator in interface NodeManager<IBasicBlock>iterator in interface java.lang.Iterable<IBasicBlock>public void removeNode(IBasicBlock obj)
removeNode in interface NodeManager<IBasicBlock>obj - -
object to be removedpublic java.util.Iterator<IBasicBlock> getPredNodes(IBasicBlock node)
EdgeManagernodes of this Node
in the Graph.
This method never returns null.
getPredNodes in interface EdgeManager<IBasicBlock>node - -
source node
public void addNode(IBasicBlock n)
throws java.lang.UnsupportedOperationException
addNode in interface NodeManager<IBasicBlock>n -
java.lang.UnsupportedOperationException - unconditionallypublic void removeNodeAndEdges(IBasicBlock n)
removeNodeAndEdges in interface Graph<IBasicBlock>n - public int getNumber(IBasicBlock n)
getNumber in interface NumberedNodeManager<IBasicBlock>n - public IBasicBlock getNode(int i)
getNode in interface NumberedNodeManager<IBasicBlock>i - -
number of node to be returned
public int getNumberOfNodes()
getNumberOfNodes in interface NodeManager<IBasicBlock>
public boolean isFallThroughTarget(IBasicBlock src,
IBasicBlock dest)
public IBasicBlock getFallThroughTarget(IBasicBlock src)
src - -
source block
public void dumpDotFile()
public java.util.Collection<IBasicBlock> getExceptionalPredecessors(IBasicBlock b)
ControlFlowGraph
getExceptionalPredecessors in interface ControlFlowGraphpublic java.util.Collection<IBasicBlock> getNormalPredecessors(IBasicBlock b)
ControlFlowGraph
getNormalPredecessors in interface ControlFlowGraph
public boolean hasEdge(IBasicBlock src,
IBasicBlock dst)
hasEdge in interface EdgeManager<IBasicBlock>public IntSet getSuccNodeNumbers(IBasicBlock node)
getSuccNodeNumbers in interface NumberedEdgeManager<IBasicBlock>public IntSet getPredNodeNumbers(IBasicBlock node)
getPredNodeNumbers in interface NumberedEdgeManager<IBasicBlock>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||