Class Rop
java.lang.Object
com.android.dx.rop.code.Rop
Class that describes all the immutable parts of register-based operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intindicates an unconditional gotostatic final intindicates a two-way branchstatic final intmaximumBRANCH_*valuestatic final intminimumBRANCH_*valuestatic final intindicates a non-branching opstatic final intindicates a function/method returnstatic final intindicates a switch-style branchstatic final intindicates a throw-style branch (both always-throws and may-throw) -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (seeisCallLike).Constructs a 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.Constructs a non-empty exceptions instance.Constructs a non-branching no-exception instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancanThrow()Gets whether this operation can possibly throw an exception.booleanintGets the branchingness of this instance.Gets the list of exception types that might be thrown.Gets the nickname.intGets the opcode.Gets the result type.Gets the source types.inthashCode()booleanGets whether this opcode is a function/method call or similar.booleanGets whether this opcode is commutative (the order of its sources are unimportant) or not.toString()
-
Field Details
-
BRANCH_MIN
public static final int BRANCH_MINminimumBRANCH_*value- See Also:
-
BRANCH_NONE
public static final int BRANCH_NONEindicates a non-branching op- See Also:
-
BRANCH_RETURN
public static final int BRANCH_RETURNindicates a function/method return- See Also:
-
BRANCH_GOTO
public static final int BRANCH_GOTOindicates an unconditional goto- See Also:
-
BRANCH_IF
public static final int BRANCH_IFindicates a two-way branch- See Also:
-
BRANCH_SWITCH
public static final int BRANCH_SWITCHindicates a switch-style branch- See Also:
-
BRANCH_THROW
public static final int BRANCH_THROWindicates a throw-style branch (both always-throws and may-throw)- See Also:
-
BRANCH_MAX
public static final int BRANCH_MAXmaximumBRANCH_*value- See Also:
-
-
Constructor Details
-
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 inRegOpsresult-non-null;result type of this operation;Type.VOIDfor no-result operationssources-non-null;types of all the sources of this operationexceptions-non-null;list of possible types thrown by this operationbranchingness- the branchingness of this op; one of theBRANCH_*constantsisCallLike- whether the op is a function/method call or similarnickname-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 (seeisCallLike).- Parameters:
opcode- the opcode; one of the constants inRegOpsresult-non-null;result type of this operation;Type.VOIDfor no-result operationssources-non-null;types of all the sources of this operationexceptions-non-null;list of possible types thrown by this operationbranchingness- the branchingness of this op; one of theBRANCH_*constantsnickname-null-ok;optional nickname (used for debugging)
-
Rop
Constructs a no-exception instance. The constructed instance is never a call-like op (seeisCallLike).- Parameters:
opcode- the opcode; one of the constants inRegOpsresult-non-null;result type of this operation;Type.VOIDfor no-result operationssources-non-null;types of all the sources of this operationbranchingness- the branchingness of this op; one of theBRANCH_*constantsnickname-null-ok;optional nickname (used for debugging)
-
Rop
Constructs a non-branching no-exception instance. Thebranchingnessis alwaysBRANCH_NONE, and it is never a call-like op (seeisCallLike). -
Rop
Constructs a non-empty exceptions instance. Itsbranchingnessis alwaysBRANCH_THROW, but it is never a call-like op (seeisCallLike).- Parameters:
opcode- the opcode; one of the constants inRegOpsresult-non-null;result type of this operation;Type.VOIDfor no-result operationssources-non-null;types of all the sources of this operationexceptions-non-null;list of possible types thrown by this operationnickname-null-ok;optional nickname (used for debugging)
-
Rop
Constructs a non-nicknamed instance with non-empty exceptions, which is always a call-like op (seeisCallLike). Itsbranchingnessis alwaysBRANCH_THROW.- Parameters:
opcode- the opcode; one of the constants inRegOpssources-non-null;types of all the sources of this operationexceptions-non-null;list of possible types thrown by this operation
-
-
Method Details
-
equals
-
hashCode
-
toString
-
getOpcode
public int getOpcode()Gets the opcode.- Returns:
- the opcode
-
getResult
-
getSources
-
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:
trueiff 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
Gets the nickname. If this instance has no nickname, this returns the result of callingtoString().- 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 forgetExceptions().size() != 0.- Returns:
trueiff this operation can possibly throw
-