coins.ssa
Class DeadCodeElimination

java.lang.Object
  extended bycoins.ssa.DeadCodeElimination
All Implemented Interfaces:
LocalTransformer, Transformer

class DeadCodeElimination
extends java.lang.Object
implements LocalTransformer

Dead code elimination:
If the expressions which are never used or reached, then these expressions are dead. This optimizer eliminate all dead expressions from the program.


Field Summary
static int THR
          The threshold of the debug print
 
Constructor Summary
DeadCodeElimination(SsaEnvironment e)
          Constructor
 
Method Summary
 boolean doIt(Data data, ImList args)
          Transform the DATA component.
 boolean doIt(Function function, ImList args)
          Do dead code elimination.
 java.lang.String name()
          Return the name of the transforming engine.
(package private)  boolean reachToAvailBlk(BasicBlk blk, BiList visited)
          If the basic block can be reached from the entrance of the current CFG, then return true.
 java.lang.String subject()
          Return brief description of the tranformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THR

public static final int THR
The threshold of the debug print

See Also:
Constant Field Values
Constructor Detail

DeadCodeElimination

public DeadCodeElimination(SsaEnvironment e)
Constructor

Parameters:
e - The environment of the SSA module
Method Detail

doIt

public boolean doIt(Data data,
                    ImList args)
Description copied from interface: LocalTransformer
Transform the DATA component.

Specified by:
doIt in interface LocalTransformer
Parameters:
data - DATA to be transformed.
args - list of optional arguments.
Returns:
true if transformation suceeded.

name

public java.lang.String name()
Description copied from interface: Transformer
Return the name of the transforming engine. Used for trace tag name.

Specified by:
name in interface Transformer
Returns:
the name of the transforming engine.

subject

public java.lang.String subject()
Description copied from interface: Transformer
Return brief description of the tranformation.

Specified by:
subject in interface Transformer
Returns:
brief description of the tranformation.

doIt

public boolean doIt(Function function,
                    ImList args)
Do dead code elimination.

Specified by:
doIt in interface LocalTransformer
Parameters:
function - The current function
args - The list of options
Returns:
true if transformation suceeded.

reachToAvailBlk

boolean reachToAvailBlk(BasicBlk blk,
                        BiList visited)
If the basic block can be reached from the entrance of the current CFG, then return true.

Parameters:
blk - The current basic block
visited - The list of the basic blocks which are already visited
Returns:
If the current basic block can be reached, return true