|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpolyglot.visit.NodeVisitor
polyglot.visit.HaltingVisitor
polyglot.visit.ErrorHandlingVisitor
polyglot.visit.DataFlow
polyglot.visit.DeadCodeEliminator
public class DeadCodeEliminator
Visitor which performs dead code elimination.
Nested Class Summary | |
---|---|
protected static class |
DeadCodeEliminator.DataFlowItem
|
protected static class |
DeadCodeEliminator.DefUseFinder
|
Nested classes/interfaces inherited from class polyglot.visit.DataFlow |
---|
DataFlow.BoolItem, DataFlow.ConditionNavigator, DataFlow.FlowGraphSource, DataFlow.Item |
Field Summary |
---|
Fields inherited from class polyglot.visit.DataFlow |
---|
dataflowOnEntry, flowCounter, flowgraphStack, forward |
Fields inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
error, job, nf, ts |
Constructor Summary | |
---|---|
DeadCodeEliminator(Job job,
TypeSystem ts,
NodeFactory nf)
|
Method Summary | |
---|---|
void |
check(FlowGraph graph,
Term n,
DataFlow.Item inItem,
java.util.Map outItems)
Check that the term n satisfies whatever properties this dataflow is checking for. |
DataFlow.Item |
confluence(java.util.List inItems,
Term node,
FlowGraph graph)
The confluence operator for many flows. |
protected NodeVisitor |
createDefUseFinder(java.util.Set def,
java.util.Set use)
|
DataFlow.Item |
createInitialItem(FlowGraph graph,
Term node)
Create an initial Item for the term node. |
protected DeadCodeEliminator.DataFlowItem |
flow(DataFlow.Item in,
FlowGraph graph,
Term t)
|
java.util.Map |
flow(DataFlow.Item in,
FlowGraph graph,
Term t,
java.util.Set succEdgeKeys)
Produce new Item s as appropriate for the
Term n and the input Item in . |
protected java.util.Set[] |
getDefUse(Node n)
Returns array of sets of local instances. |
protected Stmt |
getEffects(Expr expr)
Returns a statement that is side-effect-equivalent to the given expression. |
Node |
leaveCall(Node old,
Node n,
NodeVisitor v)
Overridden superclass method, to pop from the stack of FlowGraph s if necessary. |
void |
post(FlowGraph graph,
Term root)
Check all of the Peers in the graph, after the dataflow analysis has been performed. |
Methods inherited from class polyglot.visit.DataFlow |
---|
confluence, constructItemsFromCondition, createCFGBuilder, currentFlowGraph, dataflow, dataflow, dumpFlowGraph, enterCall, filterItems, filterItemsExceptionSubclass, filterItemsNonError, filterItemsNonException, findSCCs, flow, flow, flowBooleanConditions, flowToBooleanFlow, hasTrueFalseBranches, initGraph, itemsToMap, itemToMap, leave, safeConfluence, safeConfluence, safeConfluence |
Methods inherited from class polyglot.visit.ErrorHandlingVisitor |
---|
begin, catchErrors, enter, enterCall, enterError, errorQueue, hasErrors, job, leaveCall, leaveCall, nodeFactory, typeSystem |
Methods inherited from class polyglot.visit.HaltingVisitor |
---|
bypass, bypass, bypassChildren, override, visitChildren |
Methods inherited from class polyglot.visit.NodeVisitor |
---|
copy, enter, finish, finish, leave, override, toString, visitEdge, visitEdgeNoOverride |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DeadCodeEliminator(Job job, TypeSystem ts, NodeFactory nf)
Method Detail |
---|
public DataFlow.Item createInitialItem(FlowGraph graph, Term node)
DataFlow
createInitialItem
in class DataFlow
public DataFlow.Item confluence(java.util.List inItems, Term node, FlowGraph graph)
DataFlow
confluence
in class DataFlow
inItems
- List of Item
s that flow into node
.
this method will only be called if the list has at least 2
elements.node
- Term
for which the items
are
flowing into.
public java.util.Map flow(DataFlow.Item in, FlowGraph graph, Term t, java.util.Set succEdgeKeys)
DataFlow
Item
s as appropriate for the
Term n
and the input Item in
.
flow
in class DataFlow
in
- the Item flowing into the node. Note that if the Term n
has many flows going into it, the Item in may be the result
of a call to confluence(List, List, Term)graph
- the FlowGraph which the dataflow is operating ont
- the Term which this method must calculate the flow for.succEdgeKeys
- a set of FlowGraph.EdgeKeys, being all the
EdgeKeys of the edges leaving this node. The
returned Map must have mappings for all objects in this set.
protected DeadCodeEliminator.DataFlowItem flow(DataFlow.Item in, FlowGraph graph, Term t)
public void post(FlowGraph graph, Term root) throws SemanticException
DataFlow
post
in class DataFlow
SemanticException
public void check(FlowGraph graph, Term n, DataFlow.Item inItem, java.util.Map outItems) throws SemanticException
DataFlow
check
in class DataFlow
SemanticException
- if the properties this dataflow
analysis is checking for is not satisfied.public Node leaveCall(Node old, Node n, NodeVisitor v) throws SemanticException
DataFlow
FlowGraph
s if necessary.
leaveCall
in class DataFlow
SemanticException
protected java.util.Set[] getDefUse(Node n)
protected NodeVisitor createDefUseFinder(java.util.Set def, java.util.Set use)
protected Stmt getEffects(Expr expr)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |