public class BasicBlock extends Object
| Constructor and Description |
|---|
BasicBlock(Function function)
Constructs a new initially empty block of nodes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(AbstractNode n)
Adds a node to this block.
|
void |
addSuccessor(BasicBlock succ)
Adds a successor.
|
boolean |
canThrowExceptions()
Returns true if this block contains a node that may throw exceptions.
|
void |
check(BasicBlock ordinary_exit,
BasicBlock exceptional_exit,
Set<Integer> seen_blocks,
Set<Integer> seen_nodes)
Perform a consistency check of the basic block.
|
BasicBlock |
getExceptionHandler()
Returns the exception handler block, or null if not set.
|
AbstractNode |
getFirstNode()
Returns the first node.
|
Function |
getFunction()
Returns the function containing this block.
|
int |
getIndex()
Returns the block index.
|
AbstractNode |
getLastNode()
Returns the last node.
|
List<AbstractNode> |
getNodes()
Returns the sequence of nodes.
|
int |
getOrder()
Returns the block order.
|
AbstractNode |
getSingleNode()
Returns the single node in the basic block.
|
BasicBlock |
getSingleSuccessor()
Returns the single successor block.
|
SourceLocation |
getSourceLocation()
Returns the source location for the first node in the basic block.
|
Collection<BasicBlock> |
getSuccessors()
Returns the successors of this block.
|
boolean |
isAdded()
Checks whether this block has been added to a flow graph.
|
boolean |
isEmpty()
Returns true if there are no nodes in the block.
|
boolean |
isEntry()
Checks whether this is a function entry block.
|
void |
removeNodes(Collection<AbstractNode> ns)
Removes a set of nodes from the basic block.
|
void |
removeSuccessor(BasicBlock succ)
Remove a successor.
|
void |
replaceNodes(List<AbstractNode> ns)
Replaces the set of nodes in a basic block.
|
void |
setExceptionHandler(BasicBlock exception_handler)
Sets the exception handler block.
|
void |
setIndex(int index)
Sets the block index.
|
(package private) void |
setOrder(int order)
Sets the block order.
|
void |
toDot(PrintWriter pw,
boolean standalone)
Produces a Graphviz dot representation of this block.
|
String |
toString()
Returns a string description of this block.
|
public BasicBlock(Function function)
function - The function this block belongs to.public void addNode(AbstractNode n)
public void addSuccessor(BasicBlock succ)
public boolean canThrowExceptions()
public void check(BasicBlock ordinary_exit, BasicBlock exceptional_exit, Set<Integer> seen_blocks, Set<Integer> seen_nodes)
public BasicBlock getExceptionHandler()
public AbstractNode getFirstNode()
public Function getFunction()
public int getIndex()
public AbstractNode getLastNode()
public List<AbstractNode> getNodes()
public int getOrder()
public AbstractNode getSingleNode()
public BasicBlock getSingleSuccessor()
AnalysisException - if not exactly one successorpublic SourceLocation getSourceLocation()
public Collection<BasicBlock> getSuccessors()
public boolean isAdded()
public boolean isEmpty()
public boolean isEntry()
public void removeNodes(Collection<AbstractNode> ns)
public void removeSuccessor(BasicBlock succ)
public void replaceNodes(List<AbstractNode> ns)
public void setExceptionHandler(BasicBlock exception_handler)
public void setIndex(int index)
void setOrder(int order)
public void toDot(PrintWriter pw, boolean standalone)
pw - Receiver of the dot representation of this basic block.standalone - Indicates that this is a complete graph that should be closed.Copyright © 2012 Aarhus University