com.android.dx.rop.code
Class Rop

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

public final class Rop
extends Object

Class that describes all the immutable parts of register-based operations.


Field Summary
static int BRANCH_GOTO
          indicates an unconditional goto
static int BRANCH_IF
          indicates a two-way branch
static int BRANCH_MAX
          maximum BRANCH_* value
static int BRANCH_MIN
          minimum BRANCH_* value
static int BRANCH_NONE
          indicates a non-branching op
static int BRANCH_RETURN
          indicates a function/method return
static int BRANCH_SWITCH
          indicates a switch-style branch
static int BRANCH_THROW
          indicates a throw-style branch (both always-throws and may-throw)
 
Constructor Summary
Rop(int opcode, TypeList sources, TypeList exceptions)
          Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (see isCallLike).
Rop(int opcode, Type result, TypeList sources, int branchingness, String nickname)
          Constructs a no-exception instance.
Rop(int opcode, Type result, TypeList sources, String nickname)
          Constructs a non-branching no-exception instance.
Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, boolean isCallLike, String nickname)
          Constructs an instance.
Rop(int opcode, Type result, TypeList sources, TypeList exceptions, int branchingness, String nickname)
          Constructs an instance.
Rop(int opcode, Type result, TypeList sources, TypeList exceptions, String nickname)
          Constructs a non-empty exceptions instance.
 
Method Summary
 boolean canThrow()
          Gets whether this operation can possibly throw an exception.
 boolean equals(Object other)
          
 int getBranchingness()
          Gets the branchingness of this instance.
 TypeList getExceptions()
          Gets the list of exception types that might be thrown.
 String getNickname()
          Gets the nickname.
 int getOpcode()
          Gets the opcode.
 Type getResult()
          Gets the result type.
 TypeList getSources()
          Gets the source types.
 int hashCode()
          
 boolean isCallLike()
          Gets whether this opcode is a function/method call or similar.
 boolean isCommutative()
          Gets whether this opcode is commutative (the order of its sources are unimportant) or not.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

BRANCH_MIN

public static final int BRANCH_MIN
minimum BRANCH_* value

See Also:
Constant Field Values

BRANCH_NONE

public static final int BRANCH_NONE
indicates a non-branching op

See Also:
Constant Field Values

BRANCH_RETURN

public static final int BRANCH_RETURN
indicates a function/method return

See Also:
Constant Field Values

BRANCH_GOTO

public static final int BRANCH_GOTO
indicates an unconditional goto

See Also:
Constant Field Values

BRANCH_IF

public static final int BRANCH_IF
indicates a two-way branch

See Also:
Constant Field Values

BRANCH_SWITCH

public static final int BRANCH_SWITCH
indicates a switch-style branch

See Also:
Constant Field Values

BRANCH_THROW

public static final int BRANCH_THROW
indicates a throw-style branch (both always-throws and may-throw)

See Also:
Constant Field Values

BRANCH_MAX

public static final int BRANCH_MAX
maximum BRANCH_* value

See Also:
Constant Field Values
Constructor Detail

Rop

public Rop(int opcode,
           Type result,
           TypeList sources,
           TypeList exceptions,
           int branchingness,
           boolean isCallLike,
           String nickname)
Constructs an instance. This method is private. Use one of the public constructors.

Parameters:
opcode - the opcode; one of the constants in RegOps
result - non-null; result type of this operation; Type.VOID for no-result operations
sources - non-null; types of all the sources of this operation
exceptions - non-null; list of possible types thrown by this operation
branchingness - the branchingness of this op; one of the BRANCH_* constants
isCallLike - whether the op is a function/method call or similar
nickname - null-ok; optional nickname (used for debugging)

Rop

public Rop(int opcode,
           Type result,
           TypeList sources,
           TypeList exceptions,
           int branchingness,
           String nickname)
Constructs an instance. The constructed instance is never a call-like op (see isCallLike).

Parameters:
opcode - the opcode; one of the constants in RegOps
result - non-null; result type of this operation; Type.VOID for no-result operations
sources - non-null; types of all the sources of this operation
exceptions - non-null; list of possible types thrown by this operation
branchingness - the branchingness of this op; one of the BRANCH_* constants
nickname - null-ok; optional nickname (used for debugging)

Rop

public Rop(int opcode,
           Type result,
           TypeList sources,
           int branchingness,
           String nickname)
Constructs a no-exception instance. The constructed instance is never a call-like op (see isCallLike).

Parameters:
opcode - the opcode; one of the constants in RegOps
result - non-null; result type of this operation; Type.VOID for no-result operations
sources - non-null; types of all the sources of this operation
branchingness - the branchingness of this op; one of the BRANCH_* constants
nickname - null-ok; optional nickname (used for debugging)

Rop

public Rop(int opcode,
           Type result,
           TypeList sources,
           String nickname)
Constructs a non-branching no-exception instance. The branchingness is always BRANCH_NONE, and it is never a call-like op (see isCallLike).

Parameters:
opcode - the opcode; one of the constants in RegOps
result - non-null; result type of this operation; Type.VOID for no-result operations
sources - non-null; types of all the sources of this operation
nickname - null-ok; optional nickname (used for debugging)

Rop

public Rop(int opcode,
           Type result,
           TypeList sources,
           TypeList exceptions,
           String nickname)
Constructs a non-empty exceptions instance. Its branchingness is always BRANCH_THROW, but it is never a call-like op (see isCallLike).

Parameters:
opcode - the opcode; one of the constants in RegOps
result - non-null; result type of this operation; Type.VOID for no-result operations
sources - non-null; types of all the sources of this operation
exceptions - non-null; list of possible types thrown by this operation
nickname - null-ok; optional nickname (used for debugging)

Rop

public Rop(int opcode,
           TypeList sources,
           TypeList exceptions)
Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (see isCallLike). Its branchingness is always BRANCH_THROW.

Parameters:
opcode - the opcode; one of the constants in RegOps
sources - non-null; types of all the sources of this operation
exceptions - non-null; list of possible types thrown by this operation
Method Detail

equals

public boolean equals(Object other)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toString

public String toString()

Overrides:
toString in class Object

getOpcode

public int getOpcode()
Gets the opcode.

Returns:
the opcode

getResult

public Type getResult()
Gets the result type. A return value of Type.VOID means this operation returns nothing.

Returns:
null-ok; the result spec

getSources

public TypeList getSources()
Gets the source types.

Returns:
non-null; the source types

getExceptions

public TypeList getExceptions()
Gets the list of exception types that might be thrown.

Returns:
non-null; the list of exception types

getBranchingness

public int getBranchingness()
Gets the branchingness of this instance.

Returns:
the branchingness

isCallLike

public boolean isCallLike()
Gets whether this opcode is a function/method call or similar.

Returns:
true iff this opcode is call-like

isCommutative

public boolean isCommutative()
Gets whether this opcode is commutative (the order of its sources are unimportant) or not. All commutative Rops have exactly two sources and have no branchiness.

Returns:
true if rop is commutative

getNickname

public String getNickname()
Gets the nickname. If this instance has no nickname, this returns the result of calling toString().

Returns:
non-null; the nickname

canThrow

public final boolean canThrow()
Gets whether this operation can possibly throw an exception. This is just a convenient wrapper for getExceptions().size() != 0.

Returns:
true iff this operation can possibly throw


Copyright © 2013. All Rights Reserved.