@Override Rop rop(TypeList types) { return Rops.opAdd(types); } },
/** * Assigns the element at {@code index} in {@code array} to {@code target}. */ public void aget(Local<?> target, Local<?> array, Local<Integer> index) { addInstruction(new ThrowingInsn(Rops.opAget(target.type.ropType), sourcePosition, RegisterSpecList.make(array.spec(), index.spec()), catches)); moveResult(target, true); }
@Override Rop rop(TypeList types) { return Rops.opAnd(types); } },
/** * Compare floats or doubles. This stores -1 in {@code target} if {@code * a < b}, 0 in {@code target} if {@code a == b} and 1 in target if {@code * a > b}. This stores {@code nanValue} in {@code target} if either value * is {@code NaN}. */ public <T extends Number> void compareFloatingPoint( Local<Integer> target, Local<T> a, Local<T> b, int nanValue) { Rop rop; if (nanValue == 1) { rop = Rops.opCmpg(a.type.ropType); } else if (nanValue == -1) { rop = Rops.opCmpl(a.type.ropType); } else { throw new IllegalArgumentException("expected 1 or -1 but was " + nanValue); } addInstruction(new PlainInsn(rop, sourcePosition, target.spec(), RegisterSpecList.make(a.spec(), b.spec()))); }
switch (opcode) { case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest); case RegOps.GOTO: return GOTO; case RegOps.IF_EQ: return opIfEq(sources); case RegOps.IF_NE: return opIfNe(sources); case RegOps.IF_LT: return opIfLt(sources); case RegOps.IF_GE: return opIfGe(sources); case RegOps.IF_LE: return opIfLe(sources); case RegOps.IF_GT: return opIfGt(sources); case RegOps.SWITCH: return SWITCH; case RegOps.ADD: return opAdd(sources); case RegOps.SUB: return opSub(sources); case RegOps.MUL: return opMul(sources); case RegOps.DIV: return opDiv(sources); case RegOps.REM: return opRem(sources); case RegOps.NEG: return opNeg(dest); case RegOps.AND: return opAnd(sources); case RegOps.OR: return opOr(sources); case RegOps.XOR: return opXor(sources); case RegOps.SHL: return opShl(sources); case RegOps.SHR: return opShr(sources); case RegOps.USHR: return opUshr(sources); case RegOps.NOT: return opNot(dest); case RegOps.CMPL: return opCmpl(sources.getType(0)); case RegOps.CMPG: return opCmpg(sources.getType(0));
= RegisterSpec.make(ssaMeth.makeNewSsaReg(), cst); Rop constRop = Rops.opConst(cst); new PlainCstInsn(Rops.opConst(cst), SourcePosition.NO_INFO, result, RegisterSpecList.EMPTY, cst)); PlainInsn insn = new PlainInsn( Rops.opMoveResultPseudo(result.getTypeBearer()), SourcePosition.NO_INFO, result, RegisterSpecList.EMPTY);
/** * Copies the value in instance field {@code fieldId} of {@code instance} to * {@code target}. */ public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) { addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition, RegisterSpecList.make(instance.spec()), catches, fieldId.constant)); moveResult(target, true); }
@Override Rop rop(TypeList types) { return Rops.opDiv(types); } },
/** * Assigns {@code source} to the element at {@code index} in {@code array}. */ public void aput(Local<?> array, Local<Integer> index, Local<?> source) { addInstruction(new ThrowingInsn(Rops.opAput(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec(), array.spec(), index.spec()), catches)); }
private Rop getCastRop(com.android.dx.rop.type.Type sourceType, com.android.dx.rop.type.Type targetType) { if (sourceType.getBasicType() == BT_INT) { switch (targetType.getBasicType()) { case BT_SHORT: return Rops.TO_SHORT; case BT_CHAR: return Rops.TO_CHAR; case BT_BYTE: return Rops.TO_BYTE; } } return Rops.opConv(targetType, sourceType); }
/** * Copies the constant value {@code value} to {@code target}. The constant * must be a primitive, String, Class, TypeId, or null. */ public <T> void loadConstant(Local<T> target, T value) { Rop rop = value == null ? Rops.CONST_OBJECT_NOTHROW : Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
switch (opcode) { case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest); case RegOps.GOTO: return GOTO; case RegOps.IF_EQ: return opIfEq(sources); case RegOps.IF_NE: return opIfNe(sources); case RegOps.IF_LT: return opIfLt(sources); case RegOps.IF_GE: return opIfGe(sources); case RegOps.IF_LE: return opIfLe(sources); case RegOps.IF_GT: return opIfGt(sources); case RegOps.SWITCH: return SWITCH; case RegOps.ADD: return opAdd(sources); case RegOps.SUB: return opSub(sources); case RegOps.MUL: return opMul(sources); case RegOps.DIV: return opDiv(sources); case RegOps.REM: return opRem(sources); case RegOps.NEG: return opNeg(dest); case RegOps.AND: return opAnd(sources); case RegOps.OR: return opOr(sources); case RegOps.XOR: return opXor(sources); case RegOps.SHL: return opShl(sources); case RegOps.SHR: return opShr(sources); case RegOps.USHR: return opUshr(sources); case RegOps.NOT: return opNot(dest); case RegOps.CMPL: return opCmpl(sources.getType(0)); case RegOps.CMPG: return opCmpg(sources.getType(0));
= RegisterSpec.make(ssaMeth.makeNewSsaReg(), cst); Rop constRop = Rops.opConst(cst); new PlainCstInsn(Rops.opConst(cst), SourcePosition.NO_INFO, result, RegisterSpecList.EMPTY, cst)); PlainInsn insn = new PlainInsn( Rops.opMoveResultPseudo(result.getTypeBearer()), SourcePosition.NO_INFO, result, RegisterSpecList.EMPTY);
/** * Compare floats or doubles. This stores -1 in {@code target} if {@code a < b}, 0 in {@code target} if {@code a == b} and 1 in target if {@code a > b}. This stores {@code nanValue} in {@code target} if either value is {@code NaN}. */ public <T extends Number> void compareFloatingPoint(Local<Integer> target, Local<T> a, Local<T> b, int nanValue) { Rop rop; if (nanValue == 1) { rop = Rops.opCmpg(a.type.ropType); } else if (nanValue == -1) { rop = Rops.opCmpl(a.type.ropType); } else { throw new IllegalArgumentException("expected 1 or -1 but was " + nanValue); } addInstruction(new PlainInsn(rop, sourcePosition, target.spec(), RegisterSpecList.make(a.spec(), b.spec()))); }
/** * Copies the value in instance field {@code fieldId} of {@code instance} to * {@code target}. */ public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) { addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition, RegisterSpecList.make(instance.spec()), catches, fieldId.constant)); moveResult(target, true); }
@Override Rop rop(TypeList types) { return Rops.opDiv(types); } },
/** * Assigns {@code source} to the element at {@code index} in {@code array}. */ public void aput(Local<?> array, Local<Integer> index, Local<?> source) { addInstruction(new ThrowingInsn(Rops.opAput(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec(), array.spec(), index.spec()), catches)); }
private Rop getCastRop(com.android.dx.rop.type.Type sourceType, com.android.dx.rop.type.Type targetType) { if (sourceType.getBasicType() == BT_INT) { switch (targetType.getBasicType()) { case BT_SHORT: return Rops.TO_SHORT; case BT_CHAR: return Rops.TO_CHAR; case BT_BYTE: return Rops.TO_BYTE; } } return Rops.opConv(targetType, sourceType); }
public <T> void loadConstant(Local<T> target, T value) { Rop rop = Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
switch (opcode) { case RegOps.NOP: return NOP; case RegOps.MOVE: return opMove(dest); case RegOps.MOVE_PARAM: return opMoveParam(dest); case RegOps.MOVE_EXCEPTION: return opMoveException(dest); case RegOps.CONST: return opConst(dest); case RegOps.GOTO: return GOTO; case RegOps.IF_EQ: return opIfEq(sources); case RegOps.IF_NE: return opIfNe(sources); case RegOps.IF_LT: return opIfLt(sources); case RegOps.IF_GE: return opIfGe(sources); case RegOps.IF_LE: return opIfLe(sources); case RegOps.IF_GT: return opIfGt(sources); case RegOps.SWITCH: return SWITCH; case RegOps.ADD: return opAdd(sources); case RegOps.SUB: return opSub(sources); case RegOps.MUL: return opMul(sources); case RegOps.DIV: return opDiv(sources); case RegOps.REM: return opRem(sources); case RegOps.NEG: return opNeg(dest); case RegOps.AND: return opAnd(sources); case RegOps.OR: return opOr(sources); case RegOps.XOR: return opXor(sources); case RegOps.SHL: return opShl(sources); case RegOps.SHR: return opShr(sources); case RegOps.USHR: return opUshr(sources); case RegOps.NOT: return opNot(dest); case RegOps.CMPL: return opCmpl(sources.getType(0)); case RegOps.CMPG: return opCmpg(sources.getType(0));