org.jikesrvm.compilers.opt.liveness
Class LiveSet

java.lang.Object
  extended by org.jikesrvm.compilers.opt.liveness.LiveSet

public class LiveSet
extends Object

This file provides a sorted set of registers.


Field Summary
private static boolean DEBUG
          just used for debugging
private  LiveSetElement first
          The beginning of the list
 
Constructor Summary
LiveSet()
           
 
Method Summary
 boolean add(LiveSet additionList)
          Adds the contents of the given set to this set.
 void add(RegisterOperand item)
          create a new object from the passed parameter and add it to the list
 void clear()
          Empties the set.
 boolean contains(Register item)
          Determines if the item passed is in the current set
private  LiveSetElement createAndAddToCurrentList(RegisterOperand register, LiveSetElement prevElement)
          Copy the newElement into a new object and add it to the list after prevElement.
 LiveSetEnumerator enumerator()
          Returns an enumerator of the list
private  LiveSetElement getNextPtr(LiveSetElement ptr)
          Inspects the passed ptr, if it is nonnull it returns its next field otherwise, it returns "first"
 boolean isEmpty()
          Is the current set empty?
 void remove(LiveSet removalList)
          Removes the contents of the passed set from the this set, i.e., this = this - removeList
(package private)  void remove(RegisterOperand item)
          Removes the passed register from this set.
 String toString()
          String-i-fy the current list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

first

private LiveSetElement first
The beginning of the list


DEBUG

private static final boolean DEBUG
just used for debugging

See Also:
Constant Field Values
Constructor Detail

LiveSet

public LiveSet()
Method Detail

clear

public final void clear()
Empties the set.


contains

public boolean contains(Register item)
Determines if the item passed is in the current set

Parameters:
item - the register to search for
Returns:
whether the item was found

add

public void add(RegisterOperand item)
create a new object from the passed parameter and add it to the list

Parameters:
item - an object that contains the register to used in the newly created object

add

public boolean add(LiveSet additionList)
Adds the contents of the given set to this set.

Parameters:
additionList - the set to add to this set
Returns:
whether any additions were made

remove

public void remove(LiveSet removalList)
Removes the contents of the passed set from the this set, i.e., this = this - removeList

Parameters:
removalList - the list to remove from this set

remove

void remove(RegisterOperand item)
Removes the passed register from this set.

Parameters:
item - the registerOperand holding the register of interest

isEmpty

public boolean isEmpty()
Is the current set empty?

Returns:
true iff the set is empty

toString

public String toString()
String-i-fy the current list

Overrides:
toString in class Object
Returns:
the string-i-fied version

enumerator

public final LiveSetEnumerator enumerator()
Returns an enumerator of the list

Returns:
an enumerator of the list

createAndAddToCurrentList

private LiveSetElement createAndAddToCurrentList(RegisterOperand register,
                                                 LiveSetElement prevElement)
Copy the newElement into a new object and add it to the list after prevElement. If prevElement is null, update the "start" data member by inserting at the begining.

Parameters:
register - the element to copy and insert
prevElement - the element on the current list to insert after or null, indicating insert at the front
Returns:
the element that is prior to the newly inserted element

getNextPtr

private LiveSetElement getNextPtr(LiveSetElement ptr)
Inspects the passed ptr, if it is nonnull it returns its next field otherwise, it returns "first"

Parameters:
ptr - the ptr to look at it
Returns:
the next field (if ptr is nonnull) or first (if ptr is null)