|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.Tree.Bop
public abstract class Bop
Bop
is an enumerated type for BINOP
s.
Operations are typed: pointer (A), integer (I), long (L), float (F) or
double (D).
Basic rationale: Include full set of comparisons so we can optimize
jump direction for best cache locality, etc. Include minimal
arithmetic, because we can pattern match (x+(-y))
for SUB
pretty easily. Include full set of bitwise-operators to make it easier to
pattern-match on those architectures with insanely complete sets of
boolean ops (eg, SPARC has AND/OR/NAND/NOR/XOR/XNOR...).
Allow fully-flexible typing for easy pointer manipulation (ie pointer
shifts, pointer ANDs, pointer ORs, etc).
Note that SHL/SHR/USHR mask off all but the low 5 or 6 bits of
their right-hand operand, just as Qop.xSHL/xSHR/xUSHR do.
Also note that the NOT operation is included in Uop
, but
not in harpoon.IR.Quads.Qop
. Thus you'll have to do
some pattern matching on (x ^ (-1))
to properly generate
Uop.NOT
.
Field Summary | |
---|---|
static int |
ADD
Addition. |
static int |
AND
Bit-wise AND; long/integer only. |
static int |
CMPEQ
If equal-to, then 1 else 0. |
static int |
CMPGE
If greater-than-or-equal-to, then 1 else 0. |
static int |
CMPGT
If greater-than, then 1 else 0. |
static int |
CMPLE
If less-than-or-equal-to, then 1 else 0. |
static int |
CMPLT
If less-than, then 1 else 0. |
static int |
CMPNE
If not-equal-to, then 1 else 0. |
static int |
DIV
Division. |
static int |
MUL
Multiplication. |
static int |
OR
Bit-wise OR; long/integer only. |
static int |
REM
Remainder operation. |
static int |
SHL
Left bit-wise shift; long/integer only. |
static int |
SHR
Right signed bit-wise shift; long/integer only. |
static int |
USHR
Right unsigned bit-wise shift; long/integer only. |
static int |
XOR
Bit-wise XOR; long/integer only. |
Constructor Summary | |
---|---|
Bop()
|
Method Summary | |
---|---|
static int |
invert(int op)
Returns the inverted opposite for a compare Bop . |
static boolean |
isAssociative(int op)
Determines if the given Bop operation
is associative. |
static boolean |
isCommutative(int op)
Determines if the given Bop operation
is commutative. |
static boolean |
isValid(int op)
Determines if the given Bop value is valid. |
static String |
toString(int op)
Converts the enumerated Bop value to a human-readable
string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CMPLT
public static final int CMPLE
public static final int CMPEQ
public static final int CMPNE
public static final int CMPGE
public static final int CMPGT
public static final int ADD
public static final int MUL
public static final int DIV
public static final int REM
frem
. Basically, this is remainder after a
truncating division for both integer and floating-point.
public static final int SHL
public static final int SHR
public static final int USHR
public static final int AND
public static final int OR
public static final int XOR
Constructor Detail |
---|
public Bop()
Method Detail |
---|
public static boolean isValid(int op)
Bop
value is valid.
public static String toString(int op)
Bop
value to a human-readable
string.
public static final boolean isCommutative(int op)
Bop
operation
is commutative.
public static final boolean isAssociative(int op)
Bop
operation
is associative.
public static final int invert(int op)
Bop
.
That is, for CMPEQ
it will return CMPNE
;
for CMPGT
it will return CMPLE
; etc.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |