1 19 20 25 26 27 package soot.jimple.toolkits.scalar; 28 import soot.options.*; 29 30 import soot.*; 31 import soot.jimple.*; 32 import soot.toolkits.scalar.*; 33 import soot.util.*; 34 import soot.toolkits.graph.*; 35 import java.util.*; 36 37 public class NopEliminator extends BodyTransformer 38 { 39 public NopEliminator( Singletons.Global g ) {} 40 public static NopEliminator v() { return G.v().soot_jimple_toolkits_scalar_NopEliminator(); } 41 42 46 47 protected void internalTransform(Body b, String phaseName, Map options) 48 { 49 JimpleBody body = (JimpleBody)b; 50 51 if(Options.v().verbose()) 52 G.v().out.println("[" + body.getMethod().getName() + 53 "] Removing nops..."); 54 55 Chain units = body.getUnits(); 56 57 { 59 Iterator stmtIt = units.snapshotIterator(); 60 61 while(stmtIt.hasNext()) 62 { 63 Stmt s = (Stmt) stmtIt.next(); 64 65 if(s instanceof NopStmt) 66 units.remove(s); 67 } 68 } 69 } 70 } 71 | Popular Tags |