public class Function extends Object
complete() must be called.| Constructor and Description |
|---|
Function(String name,
List<String> parameter_names,
Function outer_function,
SourceLocation location)
Constructs a new function.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBlock(BasicBlock bb)
Adds a basic block to the function.
|
void |
addVariableName(String varname)
Adds a variable name (only during flow graph construction).
|
void |
check(Function main,
Set<Integer> seen_functions,
Set<Integer> seen_blocks,
Set<Integer> seen_nodes)
Perform a consistency check of the function.
|
void |
complete()
Sets the block orders.
|
Collection<BasicBlock> |
getBlocks()
Returns the collection of basic blocks.
|
BasicBlock |
getEntry()
Returns the entry block.
|
BasicBlock |
getExceptionalExit()
Returns the exceptional exit block.
|
int |
getIndex()
Returns the function index.
|
int |
getMaxRegister()
Returns the upper bound of the register numbers used in this function.
|
String |
getName()
Returns the function name, or null if the function is anonymous.
|
BasicBlock |
getOrdinaryExit()
Returns the ordinary exit block.
|
Function |
getOuterFunction()
Returns the outer function, or null if there is no outer function.
|
List<String> |
getParameterNames()
Returns the list of parameter names.
|
SourceLocation |
getSourceLocation()
Returns a source location for this function.
|
Set<String> |
getVariableNames()
Returns the set of variable names declared in this function.
|
boolean |
hasOuterFunction()
Returns true iff the function has an outer function.
|
boolean |
isMain()
Returns true if this is the main function.
|
void |
removeBlocks(Collection<BasicBlock> bbs)
Removes a collection of basic blocks from the function.
|
void |
setEntry(BasicBlock entry)
Sets the entry block.
|
void |
setExceptionalExit(BasicBlock exceptional_exit)
Sets the exceptional exit basic block.
|
(package private) void |
setIndex(int index)
Sets the function index.
|
void |
setMaxRegister(int max_tmp)
Sets the upper bound of the register numbers used in this function.
|
void |
setOrdinaryExit(BasicBlock ordinary_exit)
Sets the ordinary exit block.
|
void |
toDot(PrintWriter pw,
boolean standalone,
boolean main)
Produces a Graphviz dot representation of this function.
|
String |
toString()
Returns a string description of this function.
|
public Function(String name, List<String> parameter_names, Function outer_function, SourceLocation location)
name - Function name. Null for anonymous functions.parameter_names - A list of parameter names.outer_function - the outer functionlocation - The source location.public void addBlock(BasicBlock bb)
public void addVariableName(String varname)
public void check(Function main, Set<Integer> seen_functions, Set<Integer> seen_blocks, Set<Integer> seen_nodes)
public void complete()
public Collection<BasicBlock> getBlocks()
public BasicBlock getEntry()
public BasicBlock getExceptionalExit()
public int getIndex()
public int getMaxRegister()
public String getName()
public BasicBlock getOrdinaryExit()
public Function getOuterFunction()
public SourceLocation getSourceLocation()
public Set<String> getVariableNames()
public boolean hasOuterFunction()
public boolean isMain()
public void removeBlocks(Collection<BasicBlock> bbs)
public void setEntry(BasicBlock entry)
public void setExceptionalExit(BasicBlock exceptional_exit)
void setIndex(int index)
public void setMaxRegister(int max_tmp)
public void setOrdinaryExit(BasicBlock ordinary_exit)
public void toDot(PrintWriter pw, boolean standalone, boolean main)
pw - A receiving print writer.standalone - Is this a standalone graph?main - Is this main?Copyright © 2012 Aarhus University