org.jikesrvm.compilers.opt.ir
Class GCIRMap

java.lang.Object
  extended by org.jikesrvm.compilers.opt.ir.GCIRMap
All Implemented Interfaces:
Iterable<GCIRMapElement>

public final class GCIRMap
extends Object
implements Iterable<GCIRMapElement>

This class holds GC maps for various program points. This data structure is IR-based. In a later phase, this information will be used to create the final GC map (see OptMachineCodeMap.java)


Field Summary
private static boolean DEBUG
          Used for class-wide debugging
private  LinkedListRVM<GCIRMapElement> list
          This is the list of maps.
 
Constructor Summary
GCIRMap()
           
 
Method Summary
 int countNumSpillElements()
          Calculates the number of spill entries in this GCIRMap This is the total number of spills for all instructions in this map.
 List<RegSpillListElement> createDU(LiveSet set)
          TODO What is this method doing in this class ??
 void delete(Instruction inst)
          This method removes an entry in the GCIRMap that is specified by inst.
 void dump()
          dumps the map
 int getNumInstructionMaps()
          returns the number of GC points in this map, i.e., the number of instructions we have maps for.
 void insert(Instruction inst, List<RegSpillListElement> regList)
          This method inserts a new entry into the GCIRMap
 void insertTwin(Instruction inst, Instruction twin)
          This method inserts an entry for a "twin" instruction immediately after the original entry.
 Iterator<GCIRMapElement> iterator()
           
 void moveToEnd(Instruction inst)
          This method moves an entry in the GCIRMap that is specified by inst to the end of the list.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

list

private final LinkedListRVM<GCIRMapElement> list
This is the list of maps. Each element on the list is an GCIRMapElement, which is a pair
  1. an IR instruction (the GC point)
  2. a list of RegSpillListElement, which initially hold symbolic registers that are references (these are expanded to either physical regs or spills by the register allocator)


DEBUG

private static final boolean DEBUG
Used for class-wide debugging

See Also:
Constant Field Values
Constructor Detail

GCIRMap

public GCIRMap()
Method Detail

getNumInstructionMaps

public int getNumInstructionMaps()
returns the number of GC points in this map, i.e., the number of instructions we have maps for.

Returns:
the number of GC points in this map

countNumSpillElements

public int countNumSpillElements()
Calculates the number of spill entries in this GCIRMap This is the total number of spills for all instructions in this map.

Returns:
the number of spill entries in this map

createDU

public List<RegSpillListElement> createDU(LiveSet set)
TODO What is this method doing in this class ?? RJG This method creates a regSpillList from the passed live set.

Parameters:
set - the set of registers, encoded as a LiveSet object
Returns:
a list corresponding to the set passed

insert

public void insert(Instruction inst,
                   List<RegSpillListElement> regList)
This method inserts a new entry into the GCIRMap

Parameters:
inst - the IR instruction we care about
regList - the set of symbolic registers as a list

delete

public void delete(Instruction inst)
This method removes an entry in the GCIRMap that is specified by inst. Only one element of the list will be removed per call. If the instruction is not found in the GC Map and exeception is thrown.

Parameters:
inst - the IR instruction we want to remove

moveToEnd

public void moveToEnd(Instruction inst)
This method moves an entry in the GCIRMap that is specified by inst to the end of the list. Only one element of the list will be moved per call. If the instruction is not found in the GC Map and exception is thrown.

Parameters:
inst - the IR instruction we want to remove

insertTwin

public void insertTwin(Instruction inst,
                       Instruction twin)
This method inserts an entry for a "twin" instruction immediately after the original entry. If the instruction is not found in the GC Map an exception is thrown.

Parameters:
inst - the original IR instruction
twin - the new twin IR instruction

iterator

public Iterator<GCIRMapElement> iterator()
Specified by:
iterator in interface Iterable<GCIRMapElement>

dump

public void dump()
dumps the map


toString

public String toString()
Overrides:
toString in class Object
Returns:
string version of this object