soot.jimple.toolkits.graph
Class LoopConditionUnroller

java.lang.Object
  extended by soot.Transformer
      extended by soot.BodyTransformer
          extended by soot.jimple.toolkits.graph.LoopConditionUnroller

public class LoopConditionUnroller
extends BodyTransformer

"unrolls" the condition of while/for loops.
before the first test of a while-loop, we can't be sure, if the body will be taken or not, and several optimizations (especially LCM) can't be done. In this class we try to solve this problem by unrolling the condition of the while-block: we make a copy of the condition-block, and redirect the back-edge of the while-loop to the new block.
After this transformation the edge between the original condition-block and the loop-body is only executed once (and hence suitable for LCM) and we can be sure, that the loop-body will get executed.
Exceptions are ignored (the transformation is done on a BriefBlockGraph.


Constructor Summary
LoopConditionUnroller()
           
 
Method Summary
protected  void internalTransform(Body body, String phaseName, Map options)
          unrolls conditions.
 
Methods inherited from class soot.BodyTransformer
transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoopConditionUnroller

public LoopConditionUnroller()
Method Detail

internalTransform

protected void internalTransform(Body body,
                                 String phaseName,
                                 Map options)
unrolls conditions.

Specified by:
internalTransform in class BodyTransformer
Parameters:
body - the body on which to apply the transformation
phaseName - the phasename for this transform; not typically used by implementations.
options - the actual computed options; a combination of default options and Scene specified options.