public class

EMasterOptimizer

extends AbstractMasterOptimizer<T>
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer<T>
     ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.opt.EMasterOptimizer

Class Overview

Standard master optimizer for CFG of IEStatement IR instructions. Comes with a bundle of standard expression optimizers. Additional optimizers can be registered. Refer to the constructor javadoc. Special use registers can be specified in order to improve the optimization rate of the dead-code removal and expression substitution standard optimizers.

Summary

[Expand]
Inherited Constants
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer
Fields
public static int defaultMaxRunCount no max
[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer
Public Constructors
EMasterOptimizer(IERoutineContext ectx)
Create a standard IR master optimizer with no maximum runcount (unsafe).
EMasterOptimizer(IERoutineContext ectx, int grp1NMaxRunCount)
Create a standard IR master optimizer.
Public Methods
void addDefaultInput(int bit, IEImm val)
void addDisregardedOutputBits(Collection<Integer> disregardedOutputBits)
void addDisregardedOutputFilter(IOptFilterCanDiscard filter)
void addDisregardedOutputVariables(Collection<? extends IEVar> disregardedOutputVars)
boolean canDiscardUnusedDefinition(CFG<IEStatement> cfg, int regDef, long insnAddress)
Check if an unused variable definition unused in the routine, but reaching the exit, can be discarded.
IEImm getDefaultInput(int reg)
static int getDefinitionReachingRoutineOutput(CFG<IEStatement> cfg, int reg, long address)
Indicates if current definition is still valid at the end of the routine.
Set<Integer> getDisregardedOutputRegisters()
static boolean isDefinitionReachingRoutineOutput(CFG<IEStatement> cfg, int reg, long address)
Indicates if current definition is still valid at the end of the routine.
static boolean isReachingRoutineOutput(CFG<IEStatement> cfg, int reg)
Protected Methods
void postAllOptimizationsCallback(IERoutineContext ctx)
This method might be overridden, but the parent should be called first.
void postOptimizationCallback(IERoutineContext ctx, OptimizerEntry<IERoutineContext> e, int cnt, long executionTimeMs)
This method might be overridden, but the parent should be called first.
void preAllOptimizationsCallback(IERoutineContext target)
This method might be overridden, but the parent should be called first.
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.AbstractMasterOptimizer
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.asm.decompiler.opt.IMasterOptimizer

Fields

public static int defaultMaxRunCount

no max

Public Constructors

public EMasterOptimizer (IERoutineContext ectx)

Create a standard IR master optimizer with no maximum runcount (unsafe).

public EMasterOptimizer (IERoutineContext ectx, int grp1NMaxRunCount)

Create a standard IR master optimizer.

Parameters
ectx default context
grp1NMaxRunCount maximum run count for the group [1..N]

Public Methods

public void addDefaultInput (int bit, IEImm val)

public void addDisregardedOutputBits (Collection<Integer> disregardedOutputBits)

public void addDisregardedOutputFilter (IOptFilterCanDiscard filter)

public void addDisregardedOutputVariables (Collection<? extends IEVar> disregardedOutputVars)

public boolean canDiscardUnusedDefinition (CFG<IEStatement> cfg, int regDef, long insnAddress)

Check if an unused variable definition unused in the routine, but reaching the exit, can be discarded.

public IEImm getDefaultInput (int reg)

public static int getDefinitionReachingRoutineOutput (CFG<IEStatement> cfg, int reg, long address)

Indicates if current definition is still valid at the end of the routine. Statuses are:

  • 1: this value is reaching the routine output
  • -1: this value is fully overridden before the routine output, it can be inner redefined/removed if not used anymore
  • 0: the definition reaching routine output is only partial (in general an IESlice) and there is no guarantee if value may be redefined/removed.

  • public Set<Integer> getDisregardedOutputRegisters ()

    public static boolean isDefinitionReachingRoutineOutput (CFG<IEStatement> cfg, int reg, long address)

    Indicates if current definition is still valid at the end of the routine. In other words, if false, indicates that this is the value can be inner redefined/removed if not used anymore.

    public static boolean isReachingRoutineOutput (CFG<IEStatement> cfg, int reg)

    Protected Methods

    protected void postAllOptimizationsCallback (IERoutineContext ctx)

    This method might be overridden, but the parent should be called first.

    protected void postOptimizationCallback (IERoutineContext ctx, OptimizerEntry<IERoutineContext> e, int cnt, long executionTimeMs)

    This method might be overridden, but the parent should be called first. Note that this method might have a big impact on decompilation performance, so override carefully.

    protected void preAllOptimizationsCallback (IERoutineContext target)

    This method might be overridden, but the parent should be called first.