package edu.cmu.cs.l3.frame;

import java.util.*;
import edu.cmu.cs.l3.temp.*;
import edu.cmu.cs.l3.tree.*;

public abstract class Frame implements TempMap {

    public Frame() {
    }

    public static final int HEAP=0,STACK=1,REG=2;

    abstract public Frame newFrame(int np, int level);

    abstract public FrameAccess allocLocal(int escapes,int size);
    abstract public Temp allocLocalTemp();
    abstract public String tempMap(Temp t);

    abstract public IRExpression getParam(int index);

    abstract public List generateEntry(String name);
    abstract public List generateExit();
    abstract public void finalize(List code);

    abstract public Temp getGeneralTemp(int index);
    abstract public Temp[] getRegisters();

    public int getNumLocals() {
	return m_numlocals;
    }

    public Label getReturnLabel() {
        return m_rl;
    }

    public Temp getReturnTemp() {
	return m_rv;
    }

    public Temp getFrameTemp() {
	return m_fp;
    }

    public int getWordSize() {
	return m_wordsize;
    }

    public int getNumParams() {
	return m_numparams;
    }

    public int getLevel() {
        return m_level;
    }

    protected List m_params = new ArrayList();
    protected int m_wordsize,m_numparams,m_numlocals=0,m_level=0;
    protected Temp m_rv,m_fp;
    protected Label m_rl;
}
