com.android.dx.rop.code
Class RegOps

java.lang.Object
  extended by com.android.dx.rop.code.RegOps

public final class RegOps
extends Object

All the register-based opcodes, and related utilities.

Note: Opcode descriptions use a rough pseudocode. r is the result register, x is the first argument, y is the second argument, and z is the third argument. The expression which describes the operation uses Java-ish syntax but is preceded by type indicators for each of the values.


Field Summary
static int ADD
          T: any numeric type; r,x,y: T :: r = x + y
static int AGET
          T: any type; r: T; x: T[]; y: int :: r = x[y]
static int AND
          T: any integral type; r,x,y: T :: r = x & y
static int APUT
          T: any type; x: T; y: T[]; z: int :: x[y] = z
static int ARRAY_LENGTH
          T: any type; r: int; x: T[]; :: r = x.length
static int CHECK_CAST
          T: any object type; x: Object :: (T) x (can throw ClassCastException)
static int CMPG
          T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 : (x < y) ? -1 : 1 (Java-style "cmpg" where a NaN is considered "greater than" all other values)
static int CMPL
          T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 : (x > y) ? 1 : -1 (Java-style "cmpl" where a NaN is considered "less than" all other values; also used for integral comparisons)
static int CONST
          T: any type; r, literal: T :: r = literal;
static int CONV
          T: any numeric type; U: any numeric type; r: T; x: U :: r = (T) x (numeric type conversion between the four "real" numeric types)
static int DIV
          T: any numeric type; r,x,y: T :: r = x / y
static int FILL_ARRAY_DATA
          T: Any primitive type; v0..vx: T :: {v0, ..., vx}
static int FILLED_NEW_ARRAY
          T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}
static int GET_FIELD
          T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f
static int GET_STATIC
          T: any type; r: T; f: static field spec of type T :: r = f
static int GOTO
          goto label
static int IF_EQ
          T: int or Object; x,y: T :: if (x == y) goto label
static int IF_GE
          x,y: int :: if (x >= y) goto label
static int IF_GT
          x,y: int :: if (x > y) goto label
static int IF_LE
          x,y: int :: if (x <= y) goto label
static int IF_LT
          x,y: int :: if (x < y) goto label
static int IF_NE
          T: int or Object; x,y: T :: if (x != y) goto label
static int INSTANCE_OF
          T: any object type; x: Object :: x instanceof T
static int INVOKE_DIRECT
          {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...
static int INVOKE_INTERFACE
          {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: interface (instance) method spec; y0: T0; y1: T1 ...
static int INVOKE_STATIC
          {@code Tr, T0, T1...: any types; r: Tr; m: static method spec; y0: T0; y1: T1 ...
static int INVOKE_SUPER
          {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...
static int INVOKE_VIRTUAL
          {@code Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ...
static int MARK_LOCAL
          T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)
static int MONITOR_ENTER
          x: Object :: monitorenter(x)
static int MONITOR_EXIT
          x: Object :: monitorexit(x)
static int MOVE
          T: any type; r,x: T :: r = x;
static int MOVE_EXCEPTION
          T: Throwable; r: T :: r = caught_exception.
static int MOVE_PARAM
          T: any type; r,param(x): T :: r = param(x)
static int MOVE_RESULT
          T: Any type; r: T :: r = return_type.
static int MOVE_RESULT_PSEUDO
          T: Any type; r: T :: r = return_type.
static int MUL
          T: any numeric type; r,x,y: T :: r = x * y
static int NEG
          T: any numeric type; r,x: T :: r = -x
static int NEW_ARRAY
          T: any array type; r: T; x: int :: r = new T[x]
static int NEW_INSTANCE
          T: any non-array object type :: r = alloc(T) (allocate heap space for an object)
static int NOP
          nop()
static int NOT
          T: any integral type; r,x: T :: r = ~x
static int OR
          T: any integral type; r,x,y: T :: r = x | y
static int PUT_FIELD
          T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x
static int PUT_STATIC
          T: any type; f: static field spec of type T; x: T :: f = x
static int REM
          T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)
static int RETURN
          T: return type for the method; x: T; return x
static int SHL
          T: any integral type; r,x: T; y: int :: r = x << y
static int SHR
          T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)
static int SUB
          T: any numeric type; r,x,y: T :: r = x - y
static int SWITCH
          x: int :: goto table[x]
static int THROW
          x: Throwable :: throw(x)
static int TO_BYTE
          r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)
static int TO_CHAR
          r,x: int :: r = x & 0xffff (Java-style convert int to char)
static int TO_SHORT
          r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)
static int USHR
          T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)
static int XOR
          T: any integral type; r,x,y: T :: r = x ^ y
 
Method Summary
static int flippedIfOpcode(int opcode)
          Given an IF_* RegOp, returns the right-to-left flipped version.
static String opName(int opcode)
          Gets the name of the given opcode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOP

public static final int NOP
nop()

See Also:
Constant Field Values

MOVE

public static final int MOVE
T: any type; r,x: T :: r = x;

See Also:
Constant Field Values

MOVE_PARAM

public static final int MOVE_PARAM
T: any type; r,param(x): T :: r = param(x)

See Also:
Constant Field Values

MOVE_EXCEPTION

public static final int MOVE_EXCEPTION
T: Throwable; r: T :: r = caught_exception. Note: This opcode should only ever be used in the first instruction of a block, and such blocks must be the start of an exception handler.

See Also:
Constant Field Values

CONST

public static final int CONST
T: any type; r, literal: T :: r = literal;

See Also:
Constant Field Values

GOTO

public static final int GOTO
goto label

See Also:
Constant Field Values

IF_EQ

public static final int IF_EQ
T: int or Object; x,y: T :: if (x == y) goto label

See Also:
Constant Field Values

IF_NE

public static final int IF_NE
T: int or Object; x,y: T :: if (x != y) goto label

See Also:
Constant Field Values

IF_LT

public static final int IF_LT
x,y: int :: if (x < y) goto label

See Also:
Constant Field Values

IF_GE

public static final int IF_GE
x,y: int :: if (x >= y) goto label

See Also:
Constant Field Values

IF_LE

public static final int IF_LE
x,y: int :: if (x <= y) goto label

See Also:
Constant Field Values

IF_GT

public static final int IF_GT
x,y: int :: if (x > y) goto label

See Also:
Constant Field Values

SWITCH

public static final int SWITCH
x: int :: goto table[x]

See Also:
Constant Field Values

ADD

public static final int ADD
T: any numeric type; r,x,y: T :: r = x + y

See Also:
Constant Field Values

SUB

public static final int SUB
T: any numeric type; r,x,y: T :: r = x - y

See Also:
Constant Field Values

MUL

public static final int MUL
T: any numeric type; r,x,y: T :: r = x * y

See Also:
Constant Field Values

DIV

public static final int DIV
T: any numeric type; r,x,y: T :: r = x / y

See Also:
Constant Field Values

REM

public static final int REM
T: any numeric type; r,x,y: T :: r = x % y (Java-style remainder)

See Also:
Constant Field Values

NEG

public static final int NEG
T: any numeric type; r,x: T :: r = -x

See Also:
Constant Field Values

AND

public static final int AND
T: any integral type; r,x,y: T :: r = x & y

See Also:
Constant Field Values

OR

public static final int OR
T: any integral type; r,x,y: T :: r = x | y

See Also:
Constant Field Values

XOR

public static final int XOR
T: any integral type; r,x,y: T :: r = x ^ y

See Also:
Constant Field Values

SHL

public static final int SHL
T: any integral type; r,x: T; y: int :: r = x << y

See Also:
Constant Field Values

SHR

public static final int SHR
T: any integral type; r,x: T; y: int :: r = x >> y (signed right-shift)

See Also:
Constant Field Values

USHR

public static final int USHR
T: any integral type; r,x: T; y: int :: r = x >>> y (unsigned right-shift)

See Also:
Constant Field Values

NOT

public static final int NOT
T: any integral type; r,x: T :: r = ~x

See Also:
Constant Field Values

CMPL

public static final int CMPL
T: any numeric type; r: int; x,y: T :: r = (x == y) ? 0 : (x > y) ? 1 : -1 (Java-style "cmpl" where a NaN is considered "less than" all other values; also used for integral comparisons)

See Also:
Constant Field Values

CMPG

public static final int CMPG
T: any floating point type; r: int; x,y: T :: r = (x == y) ? 0 : (x < y) ? -1 : 1 (Java-style "cmpg" where a NaN is considered "greater than" all other values)

See Also:
Constant Field Values

CONV

public static final int CONV
T: any numeric type; U: any numeric type; r: T; x: U :: r = (T) x (numeric type conversion between the four "real" numeric types)

See Also:
Constant Field Values

TO_BYTE

public static final int TO_BYTE
r,x: int :: r = (x << 24) >> 24 (Java-style convert int to byte)

See Also:
Constant Field Values

TO_CHAR

public static final int TO_CHAR
r,x: int :: r = x & 0xffff (Java-style convert int to char)

See Also:
Constant Field Values

TO_SHORT

public static final int TO_SHORT
r,x: int :: r = (x << 16) >> 16 (Java-style convert int to short)

See Also:
Constant Field Values

RETURN

public static final int RETURN
T: return type for the method; x: T; return x

See Also:
Constant Field Values

ARRAY_LENGTH

public static final int ARRAY_LENGTH
T: any type; r: int; x: T[]; :: r = x.length

See Also:
Constant Field Values

THROW

public static final int THROW
x: Throwable :: throw(x)

See Also:
Constant Field Values

MONITOR_ENTER

public static final int MONITOR_ENTER
x: Object :: monitorenter(x)

See Also:
Constant Field Values

MONITOR_EXIT

public static final int MONITOR_EXIT
x: Object :: monitorexit(x)

See Also:
Constant Field Values

AGET

public static final int AGET
T: any type; r: T; x: T[]; y: int :: r = x[y]

See Also:
Constant Field Values

APUT

public static final int APUT
T: any type; x: T; y: T[]; z: int :: x[y] = z

See Also:
Constant Field Values

NEW_INSTANCE

public static final int NEW_INSTANCE
T: any non-array object type :: r = alloc(T) (allocate heap space for an object)

See Also:
Constant Field Values

NEW_ARRAY

public static final int NEW_ARRAY
T: any array type; r: T; x: int :: r = new T[x]

See Also:
Constant Field Values

FILLED_NEW_ARRAY

public static final int FILLED_NEW_ARRAY
T: any array type; r: T; x: int; v0..vx: T :: r = new T[x] {v0, ..., vx}

See Also:
Constant Field Values

CHECK_CAST

public static final int CHECK_CAST
T: any object type; x: Object :: (T) x (can throw ClassCastException)

See Also:
Constant Field Values

INSTANCE_OF

public static final int INSTANCE_OF
T: any object type; x: Object :: x instanceof T

See Also:
Constant Field Values

GET_FIELD

public static final int GET_FIELD
T: any type; r: T; x: Object; f: instance field spec of type T :: r = x.f

See Also:
Constant Field Values

GET_STATIC

public static final int GET_STATIC
T: any type; r: T; f: static field spec of type T :: r = f

See Also:
Constant Field Values

PUT_FIELD

public static final int PUT_FIELD
T: any type; x: T; y: Object; f: instance field spec of type T :: y.f = x

See Also:
Constant Field Values

PUT_STATIC

public static final int PUT_STATIC
T: any type; f: static field spec of type T; x: T :: f = x

See Also:
Constant Field Values

INVOKE_STATIC

public static final int INVOKE_STATIC
Tr, T0, T1...: any types; r: Tr; m: static method spec; y0: T0; y1: T1 ... :: r = m(y0, y1, ...) (call static method)

See Also:
Constant Field Values

INVOKE_VIRTUAL

public static final int INVOKE_VIRTUAL
Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call normal virtual method)

See Also:
Constant Field Values

INVOKE_SUPER

public static final int INVOKE_SUPER
Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call superclass virtual method)

See Also:
Constant Field Values

INVOKE_DIRECT

public static final int INVOKE_DIRECT
Tr, T0, T1...: any types; r: Tr; x: Object; m: instance method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call direct/special method)

See Also:
Constant Field Values

INVOKE_INTERFACE

public static final int INVOKE_INTERFACE
Tr, T0, T1...: any types; r: Tr; x: Object; m: interface (instance) method spec; y0: T0; y1: T1 ... :: r = x.m(y0, y1, ...) (call interface method)

See Also:
Constant Field Values

MARK_LOCAL

public static final int MARK_LOCAL
T0: any type; name: local variable name :: mark(name,T0) (mark beginning or end of local variable name)

See Also:
Constant Field Values

MOVE_RESULT

public static final int MOVE_RESULT
T: Any type; r: T :: r = return_type. Note: This opcode should only ever be used in the first instruction of a block following an invoke-*.

See Also:
Constant Field Values

MOVE_RESULT_PSEUDO

public static final int MOVE_RESULT_PSEUDO
T: Any type; r: T :: r = return_type. Note: This opcode should only ever be used in the first instruction of a block following a non-invoke throwing insn

See Also:
Constant Field Values

FILL_ARRAY_DATA

public static final int FILL_ARRAY_DATA
T: Any primitive type; v0..vx: T :: {v0, ..., vx}

See Also:
Constant Field Values
Method Detail

opName

public static String opName(int opcode)
Gets the name of the given opcode.

Parameters:
opcode - the opcode
Returns:
non-null; its name

flippedIfOpcode

public static int flippedIfOpcode(int opcode)
Given an IF_* RegOp, returns the right-to-left flipped version. For example, IF_GT becomes IF_LT.

Parameters:
opcode - An IF_* RegOp
Returns:
flipped IF Regop


Copyright © 2013. All Rights Reserved.