예제 #1
0
  public void compile(CompilerContext context, MethodVisitor mv) {
    startCompile(context, mv);

    if (isBranching()) {
      compileBranch(context, mv);
    } else if (insn == Instructions.JR) {
      compileJr(context, mv);
    } else if (insn == Instructions.JALR) {
      compileJalr(context, mv);
    } else if (interpretAllVfpuInstructions && insn.category().startsWith("VFPU")) {
      context.visitIntepreterCall(opcode, insn);
    } else {
      insn.compile(context, getOpcode());
    }

    context.endInstruction();
  }
예제 #2
0
  private int getBranchingOpcode(CompilerContext context, MethodVisitor mv) {
    int branchingOpcode = Opcodes.NOP;

    if (insn == Instructions.BEQ) {
      branchingOpcode =
          getBranchingOpcodeBranch2(context, mv, Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE);
    } else if (insn == Instructions.BEQL) {
      branchingOpcode =
          getBranchingOpcodeBranch2L(context, mv, Opcodes.IF_ICMPEQ, Opcodes.IF_ICMPNE);
    } else if (insn == Instructions.BNE) {
      branchingOpcode =
          getBranchingOpcodeBranch2(context, mv, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPEQ);
    } else if (insn == Instructions.BNEL) {
      branchingOpcode =
          getBranchingOpcodeBranch2L(context, mv, Opcodes.IF_ICMPNE, Opcodes.IF_ICMPEQ);
    } else if (insn == Instructions.BGEZ) {
      branchingOpcode = getBranchingOpcodeBranch1(context, mv, Opcodes.IFGE, Opcodes.IFLT);
    } else if (insn == Instructions.BGEZL) {
      branchingOpcode = getBranchingOpcodeBranch1L(context, mv, Opcodes.IFGE, Opcodes.IFLT);
    } else if (insn == Instructions.BGTZ) {
      branchingOpcode = getBranchingOpcodeBranch1(context, mv, Opcodes.IFGT, Opcodes.IFLE);
    } else if (insn == Instructions.BGTZL) {
      branchingOpcode = getBranchingOpcodeBranch1L(context, mv, Opcodes.IFGT, Opcodes.IFLE);
    } else if (insn == Instructions.BLEZ) {
      branchingOpcode = getBranchingOpcodeBranch1(context, mv, Opcodes.IFLE, Opcodes.IFGT);
    } else if (insn == Instructions.BLEZL) {
      branchingOpcode = getBranchingOpcodeBranch1L(context, mv, Opcodes.IFLE, Opcodes.IFGT);
    } else if (insn == Instructions.BLTZ) {
      branchingOpcode = getBranchingOpcodeBranch1(context, mv, Opcodes.IFLT, Opcodes.IFGE);
    } else if (insn == Instructions.BLTZL) {
      branchingOpcode = getBranchingOpcodeBranch1L(context, mv, Opcodes.IFLT, Opcodes.IFGE);
    } else if (insn == Instructions.J) {
      branchingOpcode = getBranchingOpcodeBranch0(context, mv);
    } else if (insn == Instructions.JAL) {
      branchingOpcode = getBranchingOpcodeCall0(context, mv);
    } else if (insn == Instructions.BLTZAL) {
      branchingOpcode = getBranchingOpcodeCall1(context, mv, Opcodes.IFLT, Opcodes.IFGE);
    } else if (insn == Instructions.BLTZALL) {
      branchingOpcode = getBranchingOpcodeCall1L(context, mv, Opcodes.IFLT, Opcodes.IFGE);
    } else if (insn == Instructions.BGEZAL) {
      branchingOpcode = getBranchingOpcodeCall1(context, mv, Opcodes.IFGE, Opcodes.IFLT);
    } else if (insn == Instructions.BGEZALL) {
      branchingOpcode = getBranchingOpcodeCall1L(context, mv, Opcodes.IFGE, Opcodes.IFLT);
    } else if (insn == Instructions.BC1F) {
      branchingOpcode = getBranchingOpcodeBC1(context, mv, Opcodes.IFEQ, Opcodes.IFNE);
    } else if (insn == Instructions.BC1FL) {
      branchingOpcode = getBranchingOpcodeBC1L(context, mv, Opcodes.IFEQ, Opcodes.IFNE);
    } else if (insn == Instructions.BC1T) {
      branchingOpcode = getBranchingOpcodeBC1(context, mv, Opcodes.IFNE, Opcodes.IFEQ);
    } else if (insn == Instructions.BC1TL) {
      branchingOpcode = getBranchingOpcodeBC1L(context, mv, Opcodes.IFNE, Opcodes.IFEQ);
    } else if (insn == Instructions.BVF) {
      branchingOpcode = getBranchingOpcodeBV(context, mv, Opcodes.IFEQ, Opcodes.IFNE);
    } else if (insn == Instructions.BVT) {
      branchingOpcode = getBranchingOpcodeBV(context, mv, Opcodes.IFNE, Opcodes.IFEQ);
    } else if (insn == Instructions.BVFL) {
      branchingOpcode = getBranchingOpcodeBVL(context, mv, Opcodes.IFEQ, Opcodes.IFNE);
    } else if (insn == Instructions.BVTL) {
      branchingOpcode = getBranchingOpcodeBVL(context, mv, Opcodes.IFNE, Opcodes.IFEQ);
    } else {
      log.error(
          "CodeInstruction.getBranchingOpcode: unknown instruction "
              + insn.disasm(getAddress(), getOpcode()));
    }

    return branchingOpcode;
  }