1 cananian 1.1.2.1 // Frame.java, created Fri Feb 5 05:48:12 1999 by cananian 2 cananian 1.1.2.1 // Copyright (C) 1999 C. Scott Ananian <cananian@alumni.princeton.edu> 3 cananian 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 cananian 1.1.2.1 package harpoon.Backend.Generic; 5 cananian 1.1.2.1 6 cananian 1.1.2.44 import harpoon.Analysis.CallGraph; 7 cananian 1.1.2.44 import harpoon.Analysis.ClassHierarchy; 8 cananian 1.1.2.42 import harpoon.ClassFile.HCodeFactory; 9 cananian 1.1.2.37 import harpoon.ClassFile.Linker; 10 pnkfelix 1.1.2.13 11 cananian 1.1.2.1 /** 12 cananian 1.1.2.1 * A <code>Frame</code> encapsulates the machine-dependent information 13 cananian 1.1.2.15 * needed for compilation. <code>Frame</code>s are not intended to be 14 cananian 1.1.2.15 * <i>entirely</i> machine-specific; all machines with roughly the same 15 cananian 1.1.2.15 * datatypes (for example, 32-bit words) and which use the same runtime 16 cananian 1.1.2.15 * implementation should be able to share most, if not all, of a 17 cananian 1.1.2.15 * <code>Frame</code> implementation. 18 cananian 1.1.2.1 * 19 cananian 1.1.2.1 * @author C. Scott Ananian <cananian@alumni.princeton.edu> 20 cananian 1.1.2.43 * @author Felix S. Klock II <pnkfelix@mit.edu> 21 cananian 1.1.2.15 * @author Andrew Berkheimer <andyb@mit.edu> 22 salcianu 1.3 * @version $Id: Frame.java,v 1.3 2003/04/19 01:03:44 salcianu Exp $ 23 cananian 1.1.2.15 * @see harpoon.IR.Assem 24 cananian 1.1.2.1 */ 25 salcianu 1.3 public abstract class Frame implements java.io.Serializable { 26 cananian 1.1.2.37 /** The <code>Linker</code> object to use when compiling for this 27 cananian 1.1.2.37 * <code>Frame</code>. */ 28 cananian 1.1.2.37 public abstract Linker getLinker(); 29 duncan 1.1.2.3 30 cananian 1.1.2.1 /** Returns <code>false</code> if pointers can be represented in 31 cananian 1.1.2.1 * 32 bits, or <code>true</code> otherwise. */ 32 andyb 1.1.2.8 public abstract boolean pointersAreLong(); 33 andyb 1.1.2.4 34 cananian 1.1.2.32 /** Returns the appropriate <code>Generic.Runtime</code> for 35 cananian 1.1.2.27 * this <code>Frame</code>. */ 36 cananian 1.1.2.27 public abstract Runtime getRuntime(); 37 andyb 1.1.2.9 38 pnkfelix 1.1.2.28 /** Returns the appropriate <code>InstrBuilder</code> for this 39 pnkfelix 1.1.2.28 <code>Frame</code>. 40 pnkfelix 1.1.2.17 */ 41 pnkfelix 1.1.2.28 public abstract InstrBuilder getInstrBuilder(); 42 pnkfelix 1.1.2.13 43 pnkfelix 1.1.2.28 /** Returns the appropriate <code>RegFileInfo</code> for this 44 pnkfelix 1.1.2.28 <code>Frame</code>. 45 pnkfelix 1.1.2.21 */ 46 pnkfelix 1.1.2.28 public abstract RegFileInfo getRegFileInfo(); 47 cananian 1.1.2.34 48 cananian 1.1.2.34 /** Returns the appropriate <code>LocationFactory</code> for this 49 cananian 1.1.2.34 * <code>Frame</code>. 50 cananian 1.1.2.34 */ 51 cananian 1.1.2.34 public abstract LocationFactory getLocationFactory(); 52 pnkfelix 1.1.2.19 53 cananian 1.1.2.30 /** Returns the <code>Generic.CodeGen</code> for the backend 54 pnkfelix 1.1.2.19 associated with <code>this</code>. 55 pnkfelix 1.1.2.19 */ 56 cananian 1.1.2.31 public abstract CodeGen getCodeGen(); 57 cananian 1.1.2.42 58 cananian 1.1.2.42 /** Returns a code factory for machine-specific <code>IR.Assem</code>s, 59 cananian 1.1.2.42 * given a code factory for <code>CanonicalTreeCode</code>. Uses 60 cananian 1.1.2.42 * the code generator defined by this frame. Returns <code>null</code> 61 cananian 1.1.2.42 * if this frame does not have a code factory that generates 62 cananian 1.1.2.42 * <code>IR.Assem.Instr</code>s. */ 63 cananian 1.1.2.42 public abstract HCodeFactory getCodeFactory(HCodeFactory hcf); 64 pnkfelix 1.1.2.36 65 pnkfelix 1.1.2.36 /** Returns the <code>Generic.TempBuilder</code> for the backend 66 pnkfelix 1.1.2.36 associated with <code>this</code>. 67 pnkfelix 1.1.2.36 */ 68 pnkfelix 1.1.2.36 public abstract TempBuilder getTempBuilder(); 69 kkz 1.1.2.40 70 kkz 1.1.2.40 /** Returns the <code>GCInfo</code> for the backend 71 kkz 1.1.2.41 associated with <code>this</code>. <code>null</code> 72 kkz 1.1.2.41 may be returned in some cases. i.e. if precise 73 kkz 1.1.2.41 garbage collection is not supported. 74 kkz 1.1.2.40 */ 75 kkz 1.1.2.40 public abstract GCInfo getGCInfo(); 76 cananian 1.1.2.44 77 cananian 1.1.2.44 // methods used during initialization: 78 cananian 1.1.2.44 /** Sets the <code>ClassHierarchy</code> to use for this 79 cananian 1.1.2.44 * <code>Generic.Frame</code>. See <code>Generic.Runtime</code> 80 cananian 1.1.2.44 * for more details on when this needs to be called. */ 81 cananian 1.1.2.44 public void setClassHierarchy(ClassHierarchy ch) { 82 cananian 1.1.2.44 getRuntime().setClassHierarchy(ch); 83 cananian 1.1.2.44 } 84 cananian 1.1.2.44 /** Sets the <code>CallGraph</code> to use for this 85 cananian 1.1.2.44 * <code>Generic.Frame</code>. See <code>Generic.Runtime</code> 86 cananian 1.1.2.44 * for more details on when/if this needs to be called. */ 87 cananian 1.1.2.44 public void setCallGraph(CallGraph cg) { 88 cananian 1.1.2.44 getRuntime().setCallGraph(cg); 89 cananian 1.1.2.44 } 90 cananian 1.2 }