private int getParameterIndexForReg(int ssaReg) {
    SsaInsn defInsn = ssaMeth.getDefinitionForRegister(ssaReg);
    if (defInsn == null) {
      return -1;
    }

    Rop opcode = defInsn.getOpcode();

    // opcode == null for phi insns.
    if (opcode != null && opcode.getOpcode() == RegOps.MOVE_PARAM) {
      CstInsn origInsn = (CstInsn) defInsn.getOriginalRopInsn();
      return ((CstInteger) origInsn.getConstant()).getValue();
    }

    return -1;
  }
Gets the parameter index for SSA registers that are method parameters. {@code -1} is returned
for non-parameter registers.

@param ssaReg {@code >=0;} SSA register to look up
@return parameter index or {@code -1} if not a parameter
android/android_framework/dex-maker/src/main/java/com/android/dx/ssa/back/FirstFitLocalCombiningAllocator.java