Package iota

Class NInterval

java.lang.Object
iota.NInterval

class NInterval extends Object
Representation of a liveness interval.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The sequence of ranges in this interval.
    int
    Id of the register (virtual or physical) that is attached to this interval.
    Maps LIR instruction id to use type (READ or WRITE).
  • Constructor Summary

    Constructors
    Constructor
    Description
    NInterval(int regId)
    Constructs an NInterval object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds the given range to this interval.
    void
    addUsePosition(int lirId, UseType useType)
    Records whether the LIR instruction with the given id reads or writes to the register bound to this interval.
    void
    firstRangeFrom(int newStart)
    Changes the start value of the first range in this interval (if it is not empty) to the given value.
    boolean
    Returns true if this interval intersects the other interval, and false otherwise.
    Returns a string representation of this interval.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • regId

      public int regId
      Id of the register (virtual or physical) that is attached to this interval.
    • ranges

      public ArrayList<NRange> ranges
      The sequence of ranges in this interval.
    • usePositions

      public HashMap<Integer,UseType> usePositions
      Maps LIR instruction id to use type (READ or WRITE).
  • Constructor Details

    • NInterval

      public NInterval(int regId)
      Constructs an NInterval object.
      Parameters:
      regId - id of the register (virtual or physical) that is attached to this interval.
  • Method Details

    • firstRangeFrom

      public void firstRangeFrom(int newStart)
      Changes the start value of the first range in this interval (if it is not empty) to the given value.
      Parameters:
      newStart - new start value for the first range.
    • addRange

      public void addRange(NRange range)
      Adds the given range to this interval. If this interval is empty, the given range is simply added to it. Otherwise, if range ends right where the first range begins or if the range intersects with the first range, then the first range's start value is set to that of the given range. Otherwise, the range is added as the new first range of this interval.
      Parameters:
      range - the range to add.
    • addUsePosition

      public void addUsePosition(int lirId, UseType useType)
      Records whether the LIR instruction with the given id reads or writes to the register bound to this interval.
      Parameters:
      lirId - instruction id.
      useType - READ or WRITE.
    • intersects

      public boolean intersects(NInterval other)
      Returns true if this interval intersects the other interval, and false otherwise.
      Parameters:
      other - the other interval.
      Returns:
      true if this interval intersects the other interval, and false otherwise.
    • toString

      public String toString()
      Returns a string representation of this interval.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this interval.