PPC
Class Frame

java.lang.Object
  extended by Translate.Frame
      extended by PPC.Frame
Direct Known Subclasses:
Frame.Darwin, Frame.Linux

public abstract class Frame
extends Frame

Represents PowerPC stack frames.

ppc stack frames look like this after procedure prolog has been executed: Higher address: ......... +-------------------------------+ | caller's LR | +-------------------------------+ | caller's CR | +-------------------------------+ Caller's SP->| caller's caller's sp | ^^ Caller's Frame ^^ +===============================+ vv Callee's Frame vv | Save Area for | FPF 31 .......... | Caller's FPF's | FPF n +-------------------------------+ | Save Area for | GRF 31 .......... | Caller's GRF's | GRF n +-------------------------------+ | alignment pad | ............ | (if necessary) | +-------------------------------+ | Local | ........ | Variables | +-------------------------------+ SP + X -> | aN for FUTURE call | +-------------------------------+ .......... +-------------------------------+ SP + 28 -> | a1 for FUTURE call | +-------------------------------+ SP + 24 -> | a0 for FUTURE call | +-------------------------------+ SP + 20 -> | caller's TOC | +-------------------------------+ SP + 16 -> | reserved | +-------------------------------+ SP + 12 -> | reserved | +-------------------------------+ SP + 8 -> | LR callee-save for FUTURE call| +-------------------------------+ SP + 4 -> | CR callee-save for FUTURE call| +-------------------------------+ SP -> | caller's sp | +===============================+ Lower address: NOTE: All state with the exception of LR and CR are saved in the callee's frame. LR and CR are saved in the CALLER'S FRAME. ALSO NOTE: Args to the callee are found in the caller's frame.


Nested Class Summary
static class Frame.Darwin
           
static class Frame.Linux
           
 
Nested classes/interfaces inherited from class Translate.Frame
Frame.Access
 
Field Summary
protected  java.util.LinkedList<java.lang.String> picsymbols
           
 Temp RV
           
 
Fields inherited from class Translate.Frame
formals, maxArgsOut, name
 
Method Summary
 Frame.Access allocFormal(Temp t)
          Allocate a formal parameter represented by temporary t.
 Frame.Access allocLocal(Temp t)
          Allocate a local variable represented by temporary t.
 Temp.Label badPtr()
          Get the label to branch to for null pointers
 Temp.Label badSub()
          Get the label to branch to for bad subscripts
 Tree.Visitor<java.util.LinkedList<Instr>,Temp> codegen()
          Obtain a code generator visitor for the target, producing a list of assembler instructions.
 void procEntryExit1(java.util.LinkedList<Tree.Stm> body)
          Wrap the statement tree body of a procedure with entry/exit after translation.
 void procEntryExit2(java.util.LinkedList<Instr> insns)
          Wrap the assembly body of a procedure with entry/exit after code generation.
 void procEntryExit3(java.util.LinkedList<Instr> insns, Temp.Map map)
          Wrap the assembly body of a procedure with entry/exit after register allocation.
 java.lang.String record(Temp.Label lab, int words)
          Allocate a zeroed static record
 Temp[] registers()
          The registers supported by this target.
 Tree.Exp RV()
          An expression for the return value of this frame.
 java.lang.String string(Temp.Label lab, java.lang.String string)
          Allocate an initialized static string literal.
 java.lang.String vtable(Temp.Label lab, java.util.Collection<Temp.Label> values)
          Allocate and initialize a static virtual dispatch table
 int wordSize()
          The word size (in bytes) of this target.
 
Methods inherited from class Translate.Frame
external, mainFrame, newFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RV

public Temp RV

picsymbols

protected java.util.LinkedList<java.lang.String> picsymbols
Method Detail

wordSize

public int wordSize()
Description copied from class: Frame
The word size (in bytes) of this target.

Specified by:
wordSize in class Frame

allocFormal

public Frame.Access allocFormal(Temp t)
Description copied from class: Frame
Allocate a formal parameter represented by temporary t. If t is null, then allocate the parameter in the frame.

Specified by:
allocFormal in class Frame

allocLocal

public Frame.Access allocLocal(Temp t)
Description copied from class: Frame
Allocate a local variable represented by temporary t. If t is null, then allocate the variable in the frame.

Specified by:
allocLocal in class Frame

registers

public Temp[] registers()
Description copied from class: Frame
The registers supported by this target.

Specified by:
registers in class Frame

RV

public Tree.Exp RV()
Description copied from class: Frame
An expression for the return value of this frame.

Specified by:
RV in class Frame

string

public java.lang.String string(Temp.Label lab,
                               java.lang.String string)
Description copied from class: Frame
Allocate an initialized static string literal.

Specified by:
string in class Frame
Parameters:
lab - the label to use for the string
string - the value of the literal
Returns:
the assembler data fragment

record

public java.lang.String record(Temp.Label lab,
                               int words)
Description copied from class: Frame
Allocate a zeroed static record

Specified by:
record in class Frame
Parameters:
lab - the label to use for the record
words - the size of the record in words
Returns:
the assembler data fragment

vtable

public java.lang.String vtable(Temp.Label lab,
                               java.util.Collection<Temp.Label> values)
Description copied from class: Frame
Allocate and initialize a static virtual dispatch table

Specified by:
vtable in class Frame
Parameters:
lab - the label to use for the record
values - the labels of the methods in the table
Returns:
the assembler data fragment

badPtr

public Temp.Label badPtr()
Description copied from class: Frame
Get the label to branch to for null pointers

Specified by:
badPtr in class Frame
Returns:
the label

badSub

public Temp.Label badSub()
Description copied from class: Frame
Get the label to branch to for bad subscripts

Specified by:
badSub in class Frame
Returns:
the label

procEntryExit1

public void procEntryExit1(java.util.LinkedList<Tree.Stm> body)
Description copied from class: Frame
Wrap the statement tree body of a procedure with entry/exit after translation.

Specified by:
procEntryExit1 in class Frame
Parameters:
body - the procedure body

codegen

public Tree.Visitor<java.util.LinkedList<Instr>,Temp> codegen()
Description copied from class: Frame
Obtain a code generator visitor for the target, producing a list of assembler instructions.

Specified by:
codegen in class Frame
Returns:
the code generator visitor

procEntryExit2

public void procEntryExit2(java.util.LinkedList<Instr> insns)
Description copied from class: Frame
Wrap the assembly body of a procedure with entry/exit after code generation.

Specified by:
procEntryExit2 in class Frame
Parameters:
insns - the procedure body

procEntryExit3

public void procEntryExit3(java.util.LinkedList<Instr> insns,
                           Temp.Map map)
Description copied from class: Frame
Wrap the assembly body of a procedure with entry/exit after register allocation.

Specified by:
procEntryExit3 in class Frame
Parameters:
insns - the procedure body
map - the register allocation mapping temporaries to hard registers