public class Function
extends java.lang.Object
implements java.io.Serializable
complete()
must be called.Constructor and Description |
---|
Function(java.lang.String name,
java.util.List<java.lang.String> parameter_names,
Function outer_function,
boolean strict,
SourceLocation location,
java.lang.String source)
Constructs a new function.
|
Function(java.lang.String name,
java.util.List<java.lang.String> parameter_names,
Function outer_function,
SourceLocation location) |
Modifier and Type | Method and Description |
---|---|
void |
addBlock(BasicBlock bb)
Adds a basic block to the function.
|
void |
addVariableName(java.lang.String varname)
Adds a variable name (only during flow graph construction).
|
void |
check(Function main,
java.util.Set<java.lang.Integer> seen_functions,
java.util.Set<java.lang.Integer> seen_blocks,
java.util.Set<java.lang.Integer> seen_nodes)
Perform a consistency check of the function.
|
void |
complete()
Sets the block orders.
|
java.util.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.
|
java.lang.String |
getName()
Returns the function name, or null if the function is anonymous.
|
DeclareFunctionNode |
getNode()
Returns the node where this function is declared.
|
BasicBlock |
getOrdinaryExit()
Returns the ordinary exit block.
|
Function |
getOuterFunction()
Returns the outer function, or null if there is no outer function.
|
java.util.List<java.lang.String> |
getParameterNames()
Returns the list of parameter names.
|
java.lang.String |
getSource()
Returns the source code of the function, null if full source code is not available (e.g.
|
SourceLocation |
getSourceLocation()
Returns a source location for this function.
|
java.util.Set<java.lang.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.
|
boolean |
isStrict()
Returns true if this function is in strict mode.
|
void |
removeBlocks(java.util.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 |
setNode(DeclareFunctionNode node)
Sets the node where this function is declared.
|
void |
setOrdinaryExit(BasicBlock ordinary_exit)
Sets the ordinary exit block.
|
void |
setSourceLocation(SourceLocation location)
Sets the source location.
|
void |
toDot(java.io.PrintWriter pw,
boolean standalone,
boolean main)
Produces a Graphviz dot representation of this function.
|
java.lang.String |
toString()
Returns a string description of this function.
|
public Function(java.lang.String name, java.util.List<java.lang.String> parameter_names, Function outer_function, boolean strict, SourceLocation location, java.lang.String source)
name
- function name, null for anonymous functionsparameter_names
- list of parameter names, null can be used in place of an empty listouter_function
- the outer function, null if nonelocation
- source locationsource
- full source code of function, null if not availablepublic Function(java.lang.String name, java.util.List<java.lang.String> parameter_names, Function outer_function, SourceLocation location)
public void addBlock(BasicBlock bb)
public void addVariableName(java.lang.String varname)
public void check(Function main, java.util.Set<java.lang.Integer> seen_functions, java.util.Set<java.lang.Integer> seen_blocks, java.util.Set<java.lang.Integer> seen_nodes)
public void complete()
public java.util.Collection<BasicBlock> getBlocks()
public BasicBlock getEntry()
public BasicBlock getExceptionalExit()
public int getIndex()
public int getMaxRegister()
public java.lang.String getName()
public DeclareFunctionNode getNode()
public BasicBlock getOrdinaryExit()
public Function getOuterFunction()
public java.util.List<java.lang.String> getParameterNames()
public java.lang.String getSource()
public SourceLocation getSourceLocation()
public java.util.Set<java.lang.String> getVariableNames()
public boolean hasOuterFunction()
public boolean isMain()
public boolean isStrict()
public void removeBlocks(java.util.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 setNode(DeclareFunctionNode node)
public void setOrdinaryExit(BasicBlock ordinary_exit)
public void setSourceLocation(SourceLocation location)
public void toDot(java.io.PrintWriter pw, boolean standalone, boolean main)
pw
- A receiving print writer.standalone
- Is this a standalone graph?main
- Is this main?public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2009-2019 Aarhus University