public abstract class Simplifier extends IRTools
This module performs no analysis, it simply attempts to simplify the instruction as is. The intent is that analysis modules can call this transformation engine, allowing us to share the tedious simplification code among multiple analysis modules.
NOTE: For maintainability purposes, I've intentionally avoided being clever about combining 'similar' operators together into a combined case of the main switch switch statement. Also, operators are in sorted ordered within each major grouping. Please maintain this coding style. I'd rather have this module be 2000 lines of obviously correct code than 500 lines of clever code.
Modifier and Type | Class and Description |
---|---|
static class |
Simplifier.DefUseEffect
Effect of the simplification on Def-Use chains
|
Constructor and Description |
---|
Simplifier() |
A, AC, AC, CPOS, CR, D, DC, defDoublesAsUse, definedIn, F, FC, getCondMoveOp, getDefaultOperand, getLoadOp, getLoadOp, getMoveOp, getStoreOp, getStoreOp, I, IC, insertInstructionsAfter, L, LC, makeBlockOnEdge, mayBeVolatileFieldLoad, moveInstruction, moveIntoRegister, moveIntoRegister, nonPEIGC, offsetOperand, TG, usedIn, useDoublesAsDef
public Simplifier()
public static Simplifier.DefUseEffect simplify(boolean hir, AbstractRegisterPool regpool, OptOptions opts, Instruction s)
We don't deal with branching operations here -- doing peephole optimizations of branches is the job of a separate module.
hir
- is this the HIR phase?regpool
- register pool in case simplification requires a temporary registeropts
- options for this compilations
- the instruction to simplifyprivate static Simplifier.DefUseEffect guardCombine(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect trapIf(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect nullCheck(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intZeroCheck(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longZeroCheck(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect checkcast(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect checkcastNotNull(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect instanceOf(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect instanceOfNotNull(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect objarrayStoreCheck(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect objarrayStoreCheckNotNull(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect mustImplementInterface(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect guardCondMove(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect booleanNot(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect booleanCmpInt(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect booleanCmpAddr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intAdd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intAnd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intDiv(AbstractRegisterPool regpool, Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intMul(AbstractRegisterPool regpool, Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect multiplyByConstant(AbstractRegisterPool regpool, Instruction s, Operand op1, Operand op2, OptOptions opts)
private static Simplifier.DefUseEffect intNeg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intNot(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intOr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intRem(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intShl(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intShr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intSub(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intUshr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intXor(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refAdd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refAnd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refShl(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refShr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refNeg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refNot(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refOr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refSub(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refUshr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refXor(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longAdd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longAnd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longCmp(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longDiv(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longMul(AbstractRegisterPool regpool, Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longNeg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longNot(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longOr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longRem(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longShl(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longShr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longSub(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longUshr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longXor(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatAdd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatCmpg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatCmpl(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatDiv(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatMul(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatNeg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatRem(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatSub(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatSqrt(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleAdd(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleCmpg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleCmpl(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleDiv(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleMul(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleNeg(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleRem(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleSub(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleSqrt(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect double2Float(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect double2Int(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect double2Long(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect doubleAsLongBits(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2Double(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2Byte(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2UShort(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2Float(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2Long(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2AddrSigExt(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2AddrZerExt(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect long2Addr(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect int2Short(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect intBitsAsFloat(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect addr2Int(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect addr2Long(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect float2Double(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect float2Int(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect float2Long(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect floatAsIntBits(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect long2Float(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect long2Int(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect long2Double(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect longBitsAsDouble(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect arrayLength(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect boundsCheck(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect call(boolean HIR, AbstractRegisterPool regpool, Instruction s, OptOptions opts)
private static Object boxConstantOperand(ConstantOperand op, TypeReference t)
op
- the constant operand to packaget
- the type of the object (needed to differentiate primitive from numeric types..)private static ConstantOperand boxConstantObjectAsOperand(Object x, TypeReference t)
x
- the object to packaget
- the type of the object (needed to differentiate primitive from numeric types..)private static Simplifier.DefUseEffect getField(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getObjTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getClassTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getTypeFromTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getArrayElementTibFromTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getSuperclassIdsFromTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect getDoesImplementFromTib(Instruction s, OptOptions opts)
private static Simplifier.DefUseEffect refLoad(Instruction s, OptOptions opts)
private static void canonicalizeCommutativeOperator(Instruction instr)
Reg = Reg <op> Reg
Reg = Reg <op> Constant
Reg = Constant <op> Constant
instr
- the instruction to considerprivate static int PowerOf2(int v)
private static Address getAddressValue(Operand op)
op
- the operand