Enum PrimitiveType

    • Enum Constant Detail

      • BOOLEAN

        public static final PrimitiveType BOOLEAN
        Truth value, descriptor Z, treated as integral since the JVM carries it as an int.
      • BYTE

        public static final PrimitiveType BYTE
        8-bit signed integer, descriptor B, integral and one slot wide.
      • CHAR

        public static final PrimitiveType CHAR
        16-bit unsigned integer, descriptor C, counted as integral here.
      • SHORT

        public static final PrimitiveType SHORT
        16-bit signed integer, descriptor S, integral and one slot wide.
      • INT

        public static final PrimitiveType INT
        32-bit signed integer, descriptor I, and the width the narrower integral types compute in.
      • LONG

        public static final PrimitiveType LONG
        64-bit signed integer, descriptor J, occupying two local or stack slots.
      • FLOAT

        public static final PrimitiveType FLOAT
        32-bit floating point, descriptor F, occupying one slot.
      • DOUBLE

        public static final PrimitiveType DOUBLE
        64-bit floating point, descriptor D, occupying two local or stack slots.
    • Method Detail

      • values

        public static PrimitiveType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (PrimitiveType c : PrimitiveType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PrimitiveType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null
      • getDescriptor

        public String getDescriptor()
        Specified by:
        getDescriptor in interface IRType
        Returns:
        the JVM type descriptor for this type
      • getSize

        public int getSize()
        Specified by:
        getSize in interface IRType
        Returns:
        the number of stack or local slots a value of this type occupies
      • isReference

        public boolean isReference()
        Specified by:
        isReference in interface IRType
        Returns:
        true for object and array types
      • isPrimitive

        public boolean isPrimitive()
        Specified by:
        isPrimitive in interface IRType
        Returns:
        true for the eight primitive types
      • isVoid

        public boolean isVoid()
        Specified by:
        isVoid in interface IRType
        Returns:
        true for the void type
      • isArray

        public boolean isArray()
        Specified by:
        isArray in interface IRType
        Returns:
        true for array types
      • isTwoSlot

        public boolean isTwoSlot()
        Specified by:
        isTwoSlot in interface IRType
        Returns:
        true for long and double, which occupy two slots
      • isIntegral

        public boolean isIntegral()
        Checks if this is an integral type.
        Returns:
        true if boolean, byte, char, short, or int
      • isFloatingPoint

        public boolean isFloatingPoint()
        Checks if this is a floating-point type.
        Returns:
        true if float or double