# Class: com.pnfsoftware.jeb.core.units.code.android.ir.AbstractDExpressionOptimizer

Skeleton for a top\-down, recursive, [IDExpression](IDExpression) optimizer. Expressions are provided in depth\-first, pre\-order way: parent expressions are provided before their constituting children. 

 By default, [IDInstruction](IDInstruction)s are not candidates for optimization \(although they can be\).

## Constructor: AbstractDExpressionOptimizer

Description: Create a [standard](DOptimizerType#NORMAL) expression optimizer.

## Constructor: AbstractDExpressionOptimizer
- parameter: `type`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DOptimizerType`

Description: Create an expression optimizer.
parameter: type: optimizer type, or null to use [DOptimizerType#NORMAL](DOptimizerType#NORMAL)

## Constructor: AbstractDExpressionOptimizer
- parameter: `type`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DOptimizerType`
- parameter: `name`, type: `java.lang.String`

Description: Create an expression optimizer.
parameter: type: optimizer type, or null to use [DOptimizerType#NORMAL](DOptimizerType#NORMAL)
parameter: name: optional optimizer name

## Protected Field: currentStatement
Type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDInstruction`
Description: This field holds a reference to the top\-level parent statement of the expression currently being optimized.

## Protected Field: portSourceType
Type: `boolean`
Description: Copy the type of an expression to the replacement expression \(via `IDExpression.setType`\) over to the replacement expression.
 Default value: false.

## Protected Field: skipLeftSideOfAssignment
Type: `boolean`
Description: Do not process left\-side of [statement](IDInstruction).
 Default value: false.

## Protected Field: skipStatementProcessing
Type: `boolean`
Description: Optimize only the constituents of statements, not the statements themselves.
 Default value: true.

## Protected Method: doSubstitution
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `substitutions`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.compiler.SubstitutionDefinition[]`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`

Description: Attempt to apply the first matching [SubstitutionDefinition](SubstitutionDefinition) on an [IDExpression](IDExpression) expression.
parameter: e: the target IR expression to be matched and modified
parameter: substitutions: a list of candidate substitutions
return: null if no substitution was performed, else the new expression

## Protected Method: optimizeExpression
- parameter: `e`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.DOR`

Description: Attempt to optimize expressions. Sub\-expressions may be examined. The implementor should not attempt to modify parent or cousins expressions.
parameter: e: IR expression
return: the new \(optimized\) expression as well as DFA update hints, or null if the expression         could not be optimized

## Method: perform
- return type: `int`


## Method: performOnExpression
- parameter: `exp`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`
- parameter: `ctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDMethodContext`
- return type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`

Description: Run this optimizer on a standalone expression.
parameter: exp: expression to optimize
parameter: ctx: method context
return: replacement expression, or null if the input expression was not optimized

