public final class ConditionOperand extends Operand
Operand
Modifier and Type | Field and Description |
---|---|
static int |
BIT_TEST
Would is bit b set in a?
|
static int |
BORROW_FROM_RSUB
Would b-a produce a borrow?
|
static int |
BORROW_FROM_SUB
Would a-b produce a borrow?
|
static int |
CARRY_FROM_ADD
Would a+b produce a carry?
|
static int |
CMPG_GREATER
Branch if > or unordered - >FU
|
static int |
CMPG_GREATER_EQUAL
Brach if >= or unordered - >=FU
|
static int |
CMPG_LESS
Branch if < - <F
|
static int |
CMPG_LESS_EQUAL
Branch if <= - <=F
|
static int |
CMPL_EQUAL
Branch if == (equivalent to CMPG_EQUAL) - ==F
|
static int |
CMPL_GREATER
Branch if > - >F
|
static int |
CMPL_GREATER_EQUAL
Branch if >= - >=F
|
static int |
CMPL_LESS
Branch if < or unordered - <FU
|
static int |
CMPL_LESS_EQUAL
Branch if <= or unordered - <=FU
|
static int |
CMPL_NOT_EQUAL
Branch if !
|
static int |
EQUAL
Integer equal ==
|
static int |
FALSE
Evaluation result is false
|
static int |
GREATER
Signed integer >
|
static int |
GREATER_EQUAL
Signed integer >=
|
static int |
HIGHER
Unsigned integer > - >U
|
static int |
HIGHER_EQUAL
Unsigned integer >= - >=U
|
static int |
LESS
Signed integer <
|
static int |
LESS_EQUAL
Signed integer <=
|
static int |
LOWER
Unsigned integer < - <U
|
static int |
LOWER_EQUAL
Unsigned integer <= - <=U
|
static int |
NO_BIT_TEST
Would is bit b not set in a?
|
static int |
NO_BORROW_FROM_RSUB
Would b-a not produce a borrow?
|
static int |
NO_BORROW_FROM_SUB
Would a-b not produce a borrow?
|
static int |
NO_CARRY_FROM_ADD
Would a+b not produce a carry?
|
static int |
NO_OVERFLOW_FROM_ADD
Would a+b not cause an overflow?
|
static int |
NO_OVERFLOW_FROM_MUL
Would a*b not cause an overflow?
|
static int |
NO_OVERFLOW_FROM_RSUB
Would b-a not cause an overflow?
|
static int |
NO_OVERFLOW_FROM_SUB
Would a-b not cause an overflow?
|
static int |
NO_RBIT_TEST
Would is bit a not set in b?
|
static int |
NOT_EQUAL
Integer not equal !
|
static int |
OVERFLOW_FROM_ADD
Would a+b cause an overflow?
|
static int |
OVERFLOW_FROM_MUL
Would a*b cause an overflow?
|
static int |
OVERFLOW_FROM_RSUB
Would b-a cause an overflow?
|
static int |
OVERFLOW_FROM_SUB
Would a-b cause an overflow?
|
static int |
RBIT_TEST
Would is bit a set in b?
|
static int |
TRUE
Evaluation result is true
|
static int |
UNKNOWN
Evaluation result is unknown
|
int |
value
Value of this operand.
|
instruction
Modifier | Constructor and Description |
---|---|
private |
ConditionOperand(int code) |
Modifier and Type | Method and Description |
---|---|
static ConditionOperand |
BIT_TEST()
Create the condition code operand for BIT_TEST
|
private static boolean |
bit_test(int x,
int y)
Is bit y of x set?
|
static ConditionOperand |
BORROW_FROM_SUB()
Create the condition code operand for BORROW_FROM_SUB
|
private static boolean |
borrow_from_sub(int x,
int y)
Would
x - y produce a borrow? |
boolean |
branchIfUnordered()
Will this floating point compare branch if the results are
unordered?
|
static ConditionOperand |
CARRY_FROM_ADD()
Create the condition code operand for CARRY_FROM_ADD
|
private static boolean |
carry_from_add(int x,
int y)
Would
x + y produce a carry? |
static ConditionOperand |
CMPG_LESS()
Create the condition code operand for CMPG_LESS
|
static ConditionOperand |
CMPL_EQUAL()
Create the condition code operand for CMPL_EQUAL
|
static ConditionOperand |
CMPL_GREATER_EQUAL()
Create the condition code operand for CMPL_GREATER_EQUAL
|
static ConditionOperand |
CMPL_GREATER()
Create the condition code operand for CMPL_GREATER
|
static ConditionOperand |
CMPL_NOT_EQUAL()
Create the condition code operand for CMPL_NOT_EQUAL
|
Operand |
copy()
Return a new operand that is semantically equivalent to
this . |
static ConditionOperand |
EQUAL()
Create the condition code operand for EQUAL
|
int |
evaluate(Address v1,
Address v2)
Given two Addresses, evaluate the condition on them.
|
int |
evaluate(double v1,
double v2)
Given two doubles, evaluate the condition on them.
|
int |
evaluate(float v1,
float v2)
Given two floats, evaluate the condition on them.
|
int |
evaluate(int v1,
int v2)
Given two ints, evaluate the condition on them.
|
int |
evaluate(long v1,
long v2)
Given two longs, evaluate the condition on them.
|
int |
evaluate(Operand v1,
Operand v2)
Given two operands, evaluate the condition on them.
|
ConditionOperand |
flipCode()
Flip the direction of the condition.
|
ConditionOperand |
flipOperands()
Change the condition code to allow the order of the operands to
be flipped. i.e.
|
static ConditionOperand |
GREATER_EQUAL()
Create the condition code operand for GREATER_EQUAL
|
static ConditionOperand |
GREATER()
Create the condition code operand for GREATER
|
static ConditionOperand |
HIGHER_EQUAL()
Create the condition code operand for HIGHER_EQUAL
|
private static boolean |
higher_equal(int x,
int y)
Is x higher equal (unsigned >=) than y?
|
static ConditionOperand |
HIGHER()
Create the condition code operand for HIGHER
|
private static boolean |
higher(int x,
int y)
Is x higher (unsigned >) than y?
|
boolean |
isBIT_TEST()
Is the condition code a flag operation following a bit test?
|
boolean |
isEQUAL()
Is the condition code EQUAL?
|
boolean |
isFLAG_OPERATION_FROM_ADD()
Is the condition code a flag operation following an add?
|
boolean |
isFLAG_OPERATION_FROM_RSUB()
Is the condition code a flag operation following a reversed subtract?
|
boolean |
isFLAG_OPERATION_FROM_SUB()
Is the condition code a flag operation following a subtract?
|
boolean |
isFLAG_OPERATION()
Is the condition code a flag operation?
|
boolean |
isFLOATINGPOINT()
Is the condition code a floating point compare?
|
boolean |
isGREATER_EQUAL()
Is the condition code GREATER_EQUAL?
|
boolean |
isGREATER()
Is the condition code GREATER?
|
boolean |
isHIGHER_EQUAL()
Is the condition code HIGHER_EQUAL?
|
boolean |
isHIGHER()
Is the condition code HIGHER?
|
boolean |
isLESS_EQUAL()
Is the condition code LESS EQUAL?
|
boolean |
isLESS()
Is the condition code LESS?
|
boolean |
isLOWER_EQUAL()
Is the condition code LOWER_EQUAL?
|
boolean |
isLOWER()
Is the condition code LOWER?
|
boolean |
isNOT_EQUAL()
Is the condition code NOT_EQUAL?
|
boolean |
isRBIT_TEST()
Is the condition code a flag operation following a reversed bit test?
|
boolean |
isUNSIGNED()
Is the condition code an unsigned comparison?
|
static ConditionOperand |
LESS_EQUAL()
Create the condition code operand for LESS_EQUAL
|
static ConditionOperand |
LESS()
Create the condition code operand for LESS
|
static ConditionOperand |
LOWER_EQUAL()
Create the condition code operand for LOWER_EQUAL
|
private static boolean |
lower_equal(int x,
int y)
Is x lower equal (unsigned <=) than y?
|
static ConditionOperand |
LOWER()
Create the condition code operand for LOWER
|
private static boolean |
lower(int x,
int y)
Is x lower (unsigned <) than y?
|
static ConditionOperand |
NOT_EQUAL()
Create the condition code operand for NOT_EQUAL
|
static ConditionOperand |
OVERFLOW_FROM_ADD()
Create the condition code operand for OVERFLOW_FROM_ADD
|
private static boolean |
overflow_from_add(int x,
int y)
Would
x + y overflow a register? |
static ConditionOperand |
OVERFLOW_FROM_MUL()
Create the condition code operand for OVERFLOW_FROM_ADD
|
private static boolean |
overflow_from_mul(int x,
int y)
Would
x * y overflow a register? |
static ConditionOperand |
OVERFLOW_FROM_SUB()
Create the condition code operand for OVERFLOW_FROM_SUB
|
private static boolean |
overflow_from_sub(int x,
int y)
Would
x - y overflow a register? |
boolean |
similar(Operand op)
Are two operands semantically equivalent?
|
String |
toString()
Returns the string representation of this operand.
|
void |
translateCMPG()
Convert this integer compare to a floating point cmpg
compare.
|
void |
translateCMPL()
Convert this integer compare to a floating point cmpl
compare.
|
ConditionOperand |
translateUNSIGNED()
Convert this floating point compare to the equivalent unsigned
integer compare.
|
asAddressConstant, asBlock, asBranch, asClassConstant, asCondition, asDoubleConstant, asFloatConstant, asIntConstant, asLocation, asLongConstant, asMemory, asMethod, asNullConstant, asObjectConstant, asRegister, asStackLocation, asStringConstant, asTIBConstant, asType, conservativelyApproximates, getIndexInInstruction, getType, isAddress, isAddressConstant, isBlock, isBranch, isClassConstant, isConstant, isDefinitelyNull, isDouble, isDoubleConstant, isFloat, isFloatConstant, isInt, isIntConstant, isIntLike, isLocation, isLong, isLongConstant, isMemory, isMethod, isMovableObjectConstant, isNullConstant, isObjectConstant, isRef, isRegister, isStackLocation, isStringConstant, isTIBConstant, isTrueGuard, isType, meet
public static final int EQUAL
public static final int NOT_EQUAL
public static final int LESS
public static final int GREATER_EQUAL
public static final int GREATER
public static final int LESS_EQUAL
public static final int HIGHER
public static final int LOWER
public static final int HIGHER_EQUAL
public static final int LOWER_EQUAL
public static final int CMPL_EQUAL
public static final int CMPL_GREATER
public static final int CMPG_LESS
public static final int CMPL_GREATER_EQUAL
public static final int CMPG_LESS_EQUAL
public static final int CMPL_NOT_EQUAL
public static final int CMPL_LESS
public static final int CMPG_GREATER_EQUAL
public static final int CMPG_GREATER
public static final int CMPL_LESS_EQUAL
public static final int CARRY_FROM_ADD
public static final int NO_CARRY_FROM_ADD
public static final int OVERFLOW_FROM_ADD
public static final int NO_OVERFLOW_FROM_ADD
public static final int BORROW_FROM_SUB
public static final int NO_BORROW_FROM_SUB
public static final int BORROW_FROM_RSUB
public static final int NO_BORROW_FROM_RSUB
public static final int OVERFLOW_FROM_SUB
public static final int NO_OVERFLOW_FROM_SUB
public static final int OVERFLOW_FROM_RSUB
public static final int NO_OVERFLOW_FROM_RSUB
public static final int BIT_TEST
public static final int NO_BIT_TEST
public static final int RBIT_TEST
public static final int NO_RBIT_TEST
public static final int OVERFLOW_FROM_MUL
public static final int NO_OVERFLOW_FROM_MUL
public static final int FALSE
public static final int TRUE
public static final int UNKNOWN
public int value
private ConditionOperand(int code)
code
- the condition codepublic static ConditionOperand EQUAL()
public static ConditionOperand NOT_EQUAL()
public static ConditionOperand LESS()
public static ConditionOperand GREATER_EQUAL()
public static ConditionOperand GREATER()
public static ConditionOperand LESS_EQUAL()
public static ConditionOperand HIGHER()
public static ConditionOperand LOWER()
public static ConditionOperand HIGHER_EQUAL()
public static ConditionOperand LOWER_EQUAL()
public static ConditionOperand CMPL_EQUAL()
public static ConditionOperand CMPL_NOT_EQUAL()
public static ConditionOperand CMPL_GREATER()
public static ConditionOperand CMPL_GREATER_EQUAL()
public static ConditionOperand CMPG_LESS()
public static ConditionOperand CARRY_FROM_ADD()
public static ConditionOperand OVERFLOW_FROM_ADD()
public static ConditionOperand BORROW_FROM_SUB()
public static ConditionOperand OVERFLOW_FROM_SUB()
public static ConditionOperand BIT_TEST()
public static ConditionOperand OVERFLOW_FROM_MUL()
private static boolean higher(int x, int y)
x
- first value for comparisony
- second value for comparisontrue
if x is higher (unsigned >)
than y, false
otherwiseprivate static boolean lower(int x, int y)
x
- first value for comparisony
- second value for comparisontrue
if x is lower (unsigned <)
than y, false
otherwiseprivate static boolean higher_equal(int x, int y)
x
- first value for comparisony
- second value for comparisontrue
if x is higher equal (unsigned >=)
than y, false
otherwiseprivate static boolean lower_equal(int x, int y)
x
- first value for comparisony
- second value for comparisontrue
if x is lower equal (unsigned <=)
than y, false
otherwiseprivate static boolean carry_from_add(int x, int y)
x + y
produce a carry?x
- first summandy
- second summandtrue
if the addition would produce
a carry, false
otherwiseprivate static boolean borrow_from_sub(int x, int y)
x - y
produce a borrow?x
- minuendy
- subtrahendtrue
if the subtraction would produce
a borrow, false
otherwiseprivate static boolean overflow_from_add(int x, int y)
x + y
overflow a register?x
- first summandy
- second summandtrue
if the addition would overflow,
false
otherwiseprivate static boolean overflow_from_sub(int x, int y)
x - y
overflow a register?x
- minuendy
- subtrahendtrue
if the subtraction would overflow,
false
otherwiseprivate static boolean overflow_from_mul(int x, int y)
x * y
overflow a register?x
- first factory
- second factortrue
if the multiplication would overflow,
false
otherwiseprivate static boolean bit_test(int x, int y)
x
- the number to checky
- the bit position (0 is least significant bit)public boolean isEQUAL()
true
if it is or false
if it is notpublic boolean isNOT_EQUAL()
true
if it is or false
if it is notpublic boolean isLESS_EQUAL()
true
if it is or false
if it is notpublic boolean isGREATER_EQUAL()
true
if it is or false
if it is notpublic boolean isGREATER()
true
if it is or false
if it is notpublic boolean isLESS()
true
if it is or false
if it is notpublic boolean isHIGHER()
true
if it is or false
if it is notpublic boolean isLOWER()
true
if it is or false
if it is notpublic boolean isHIGHER_EQUAL()
true
if it is or false
if it is notpublic boolean isLOWER_EQUAL()
true
if it is or false
if it is notpublic boolean isUNSIGNED()
true
if it is or false
if it is notpublic boolean isFLAG_OPERATION()
true
if it is or false
if it is notpublic boolean isFLAG_OPERATION_FROM_ADD()
true
if it is or false
if it is notpublic boolean isFLAG_OPERATION_FROM_SUB()
true
if it is or false
if it is notpublic boolean isFLAG_OPERATION_FROM_RSUB()
true
if it is or false
if it is notpublic boolean isBIT_TEST()
true
if it is or false
if it is notpublic boolean isRBIT_TEST()
true
if it is or false
if it is notpublic boolean isFLOATINGPOINT()
true
if it is or false
if it is notpublic boolean branchIfUnordered()
true
if it is or false
if it is notpublic void translateCMPL()
public void translateCMPG()
public ConditionOperand translateUNSIGNED()
NB this doesn't respect ordered/unordered operation, so it should only be used when it's safe to.
public Operand copy()
Operand
this
.public boolean similar(Operand op)
Operand
public int evaluate(Operand v1, Operand v2)
v1
- first operand to conditionv2
- second operand to conditionTRUE
if (v1 cond v2) or
FALSE
if !(v1 cond v2) or
UNKNOWN
public int evaluate(int v1, int v2)
v1
- first operand to conditionv2
- second operand to conditionTRUE
if (v1 cond v2) or
FALSE
if !(v1 cond v2) or
UNKNOWN
public int evaluate(long v1, long v2)
v1
- first operand to conditionv2
- second operand to conditionTRUE
if (v1 cond v2) or
FALSE
if !(v1 cond v2) or
UNKNOWN
public int evaluate(float v1, float v2)
v1
- first operand to conditionv2
- second operand to conditiontrue
if (v1 cond v2) or
false
otherwisepublic int evaluate(double v1, double v2)
v1
- first operand to conditionv2
- second operand to conditiontrue
if (v1 cond v2) or
false
otherwisepublic int evaluate(Address v1, Address v2)
v1
- first operand to conditionv2
- second operand to conditionTRUE
if (v1 cond v2) or
FALSE
if !(v1 cond v2) or
UNKNOWN
public ConditionOperand flipCode()
if (condition) goto A
goto B
A:
into:
if (!condition) goto B
A:
Note that this is not the same as calling flipOperands()
.public ConditionOperand flipOperands()
if x < y then goto A
becomes:
if y > x then goto A
Note that this is not the same as calling flipCode()
.