Package mars.assembler
Enum Class OperandType
- All Implemented Interfaces:
Serializable
,Comparable<OperandType>
,Constable
Provides utility method related to MIPS operand formats.
- Version:
- August 2003
- Author:
- Pete Sanderson
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionboolean
accepts
(OperandType fromType) Determine whether this type "accepts" another type; that is, whether an operand with the given type can be interpreted as having this type.boolean
acceptsLoosely
(OperandType fromType) Determine whether this type "accepts" another type; that is, whether an operand with the given type can be interpreted as having this type.static OperandType
int
int
getMask()
getName()
boolean
toString()
static OperandType
union
(OperandType type1, OperandType type2) static OperandType
Returns the enum constant of this class with the specified name.static OperandType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INTEGER_3_UNSIGNED
-
INTEGER_5_UNSIGNED
-
INTEGER_15_UNSIGNED
-
INTEGER_16_SIGNED
-
INTEGER_16_UNSIGNED
-
INTEGER_16
-
INTEGER_32
-
REGISTER
-
FP_REGISTER
-
PAREN_REGISTER
-
LABEL
-
LABEL_OFFSET
-
BRANCH_OFFSET
-
JUMP_LABEL
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getName
-
getBitWidth
public int getBitWidth() -
getMask
public int getMask() -
isInteger
public boolean isInteger() -
accepts
Determine whether this type "accepts" another type; that is, whether an operand with the given type can be interpreted as having this type. This is used to determine which instruction variant is matched by the syntax of a statement.The following table describes the return value, where a "✓" indicates that the row type accepts the column type.
Type compatibility table u3
u5
u15
s16
u16
i16
i32
gpr
fpr
(gpr)
label
label+
broff
jlabel
u3
✓ u5
✓ ✓ u15
✓ ✓ ✓ s16
✓ ✓ ✓ ✓ u16
✓ ✓ ✓ ✓ i16
✓ ✓ ✓ ✓ ✓ ✓ i32
✓ ✓ ✓ ✓ ✓ ✓ ✓ gpr
✓ fpr
✓ (gpr)
✓ label
✓ label+
✓ ✓ broff
✓ ✓ ✓ ✓ ✓ ✓ jlabel
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - Parameters:
fromType
- The type to check for acceptance.- Returns:
true
if this type acceptsfromType
according to the table above, orfalse
otherwise.
-
acceptsLoosely
Determine whether this type "accepts" another type; that is, whether an operand with the given type can be interpreted as having this type. This is used to determine which instruction variant is matched by the syntax of a statement.The following table describes the return value, where a "✓" indicates that the row type accepts the column type.
Type compatibility table u3
u5
u15
s16
u16
i16
i32
gpr
fpr
(gpr)
label
label+
broff
jlabel
u3
✓ u5
✓ ✓ u15
✓ ✓ ✓ s16
✓ ✓ ✓ ✓ ✓ ✓ u16
✓ ✓ ✓ ✓ ✓ ✓ i16
✓ ✓ ✓ ✓ ✓ ✓ i32
✓ ✓ ✓ ✓ ✓ ✓ ✓ gpr
✓ ✓ fpr
✓ (gpr)
✓ ✓ label
✓ ✓ label+
✓ ✓ broff
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ jlabel
✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ - Parameters:
fromType
- The type to check for acceptance.- Returns:
true
if this type acceptsfromType
according to the table above, orfalse
otherwise.
-
toString
- Overrides:
toString
in classEnum<OperandType>
-
fromName
-
union
-