Class Label


  • public class Label
    extends java.lang.Object
    Label is used to label an instruction. Labels are used to preserve the location of branch targets. A Label consists of an index into the code array and a boolean that determines whether or not it starts a basic block.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean TRACE  
    • Constructor Summary

      Constructors 
      Constructor Description
      Label​(int index)
      Constructor.
      Label​(int index, boolean startsBlock)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Check if an object is equal to this label.
      int hashCode()
      Hash the label.
      int index()
      Get the index of the label.
      void setComment​(java.lang.String comment)
      Sets the comment associated with this Label.
      void setStartsBlock​(boolean startsBlock)
      Set if the label starts a block.
      boolean startsBlock()
      Check if the label starts a block.
      java.lang.String toString()
      Convert the label to a string.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TRACE

        public static boolean TRACE
    • Constructor Detail

      • Label

        public Label​(int index)
        Constructor.
        Parameters:
        index - A unique index for the label. For instance, its offset in the instruction array.
      • Label

        public Label​(int index,
                     boolean startsBlock)
        Constructor.
        Parameters:
        index - The index of this label into the instruction array
        startsBlock - True if the label is the first instruction in a basic block, false if not.
    • Method Detail

      • setComment

        public void setComment​(java.lang.String comment)
        Sets the comment associated with this Label.
      • setStartsBlock

        public void setStartsBlock​(boolean startsBlock)
        Set if the label starts a block.
        Parameters:
        startsBlock - True if the label starts a block, false if not.
      • startsBlock

        public boolean startsBlock()
        Check if the label starts a block.
        Returns:
        True if the label starts a block, false if not.
      • index

        public int index()
        Get the index of the label.
        Returns:
        The index of the label.
      • hashCode

        public int hashCode()
        Hash the label.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        The hash code.
      • equals

        public boolean equals​(java.lang.Object obj)
        Check if an object is equal to this label.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to compare against.
        Returns:
        true if equal, false if not.
      • toString

        public java.lang.String toString()
        Convert the label to a string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of the label.