harpoon.Backend.MIPS
Class InstrBuilder

java.lang.Object
  extended by harpoon.Backend.Generic.InstrBuilder
      extended by harpoon.Backend.MIPS.InstrBuilder

public class InstrBuilder
extends InstrBuilder

MIPS.InstrBuilder is an Generic.InstrBuilder for the MIPS architecture.

Version:
$Id: InstrBuilder.java,v 1.4 2002/04/10 03:02:51 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>, Emmett Witchel <witchel@mit.edu>

Method Summary
 int getSize(Temp t)
          Returns the size of temp on the stack.
 InstrLABEL makeLabel(Instr template)
           
 InstrLABEL makeLabel(Label l, Instr template)
          Returns a new InstrLABEL for generating new arbitrary code blocks to branch to.
 List makeLoad(Temp r, int offset, Instr template)
          Generates a new set of Instrs for memory traffic from RAM to one register in the register file.
 List makeStore(Temp r, int offset, Instr template)
          Generates a new set of Instrs for memory traffic from the register file to RAM.
 
Methods inherited from class harpoon.Backend.Generic.InstrBuilder
makeLoad, makeStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSize

public int getSize(Temp t)
Description copied from class: InstrBuilder
Returns the size of temp on the stack.
effects: Calculates the size that a value of the type of temp would have on the stack (in terms of the abstract number used for calculating stack offsets in makeLoad() and makeStore()).
When constructing loads and stores, the register allocator should ensure that live values do not overlap on the stack. Thus, given two temps t1 and t2, either ( offset(t2) is greater than or equal to offset(t1) + getSize(t1) ) OR ( offset(t1) is greater than or equal to offset(t2) + getSize(t2) ).
The default implementation simply returns 1; subclasses should override this and check for double word temps, etc.

Overrides:
getSize in class InstrBuilder
See Also:
InstrBuilder.makeLoad(java.util.List, int, harpoon.IR.Assem.Instr), InstrBuilder.makeStore(java.util.List, int, harpoon.IR.Assem.Instr)

makeLoad

public List makeLoad(Temp r,
                     int offset,
                     Instr template)
Description copied from class: InstrBuilder
Generates a new set of Instrs for memory traffic from RAM to one register in the register file.

Specified by:
makeLoad in class InstrBuilder
See Also:
InstrBuilder.getSize(harpoon.Temp.Temp)

makeStore

public List makeStore(Temp r,
                      int offset,
                      Instr template)
Description copied from class: InstrBuilder
Generates a new set of Instrs for memory traffic from the register file to RAM.

Specified by:
makeStore in class InstrBuilder
See Also:
InstrBuilder.getSize(harpoon.Temp.Temp)

makeLabel

public InstrLABEL makeLabel(Instr template)

makeLabel

public InstrLABEL makeLabel(Label l,
                            Instr template)
Returns a new InstrLABEL for generating new arbitrary code blocks to branch to.

Overrides:
makeLabel in class InstrBuilder
Parameters:
template - An Instr to base the generated InstrLABEL. template should be part of the instruction stream that the returned InstrLABEL is intended for.