Enum Class OperandType

java.lang.Object
java.lang.Enum<OperandType>
mars.assembler.OperandType
All Implemented Interfaces:
Serializable, Comparable<OperandType>, Constable

public enum OperandType extends Enum<OperandType>
Provides utility method related to MIPS operand formats.
Version:
August 2003
Author:
Pete Sanderson
  • Enum Constant Details

    • INTEGER_3_UNSIGNED

      public static final OperandType INTEGER_3_UNSIGNED
    • INTEGER_5_UNSIGNED

      public static final OperandType INTEGER_5_UNSIGNED
    • INTEGER_15_UNSIGNED

      public static final OperandType INTEGER_15_UNSIGNED
    • INTEGER_16_SIGNED

      public static final OperandType INTEGER_16_SIGNED
    • INTEGER_16_UNSIGNED

      public static final OperandType INTEGER_16_UNSIGNED
    • INTEGER_16

      public static final OperandType INTEGER_16
    • INTEGER_32

      public static final OperandType INTEGER_32
    • REGISTER

      public static final OperandType REGISTER
    • FP_REGISTER

      public static final OperandType FP_REGISTER
    • PAREN_REGISTER

      public static final OperandType PAREN_REGISTER
    • LABEL

      public static final OperandType LABEL
    • LABEL_OFFSET

      public static final OperandType LABEL_OFFSET
    • BRANCH_OFFSET

      public static final OperandType BRANCH_OFFSET
    • JUMP_LABEL

      public static final OperandType JUMP_LABEL
  • Method Details

    • values

      public static OperandType[] 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

      public static OperandType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getName

      public String getName()
    • getBitWidth

      public int getBitWidth()
    • getMask

      public int getMask()
    • isInteger

      public boolean isInteger()
    • accepts

      public boolean 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. 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
      u3u5u15s16u16i16i32gprfpr(gpr)labellabel+broffjlabel
      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 accepts fromType according to the table above, or false otherwise.
    • acceptsLoosely

      public 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. 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
      u3u5u15s16u16i16i32gprfpr(gpr)labellabel+broffjlabel
      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 accepts fromType according to the table above, or false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<OperandType>
    • fromName

      public static OperandType fromName(String name)
    • union

      public static OperandType union(OperandType type1, OperandType type2)