1 cananian 1.1.2.1 // BackendDerivation.java, created Tue Feb 29 12:03:41 2000 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.Maps; 5 cananian 1.1.2.1 6 cananian 1.1.2.1 import harpoon.ClassFile.HCodeElement; 7 cananian 1.1.2.1 import harpoon.Temp.Temp; 8 cananian 1.1.2.1 /** 9 cananian 1.1.2.1 * <code>BackendDerivation</code> provides, in addition to the type and 10 cananian 1.1.2.1 * derivation information provided by <code>Analysis.Maps.Derivation</code>, 11 cananian 1.1.2.1 * a means to identify (polymorphically typed) callee-save registers. 12 cananian 1.1.2.1 * <p> 13 cananian 1.1.2.1 * Note that <code>BackendDerivation</code> extends <code>Derivation</code>, 14 cananian 1.1.2.1 * so non-callee-save-register values will continue to have class and 15 cananian 1.1.2.1 * derivation types. The <code>typeMap()</code> and <code>derivation()</code> 16 cananian 1.1.2.1 * functions should both return <code>null</code> if the temporary in 17 cananian 1.1.2.1 * question is holding a callee-save register value. 18 cananian 1.1.2.1 * 19 cananian 1.1.2.1 * @author C. Scott Ananian <cananian@alumni.princeton.edu> 20 cananian 1.2 * @version $Id: BackendDerivation.java,v 1.2 2002/02/25 21:01:55 cananian Exp $ 21 cananian 1.1.2.1 */ 22 cananian 1.1.2.1 public interface BackendDerivation extends harpoon.Analysis.Maps.Derivation { 23 cananian 1.1.2.1 24 cananian 1.1.2.1 /** Map compiler temporaries to the callee-save register location 25 cananian 1.1.2.1 * they correspond to. 26 cananian 1.1.2.1 * @param t The temporary to query. 27 cananian 1.1.2.1 * @param hce A definition point for <code>t</code>. 28 cananian 1.1.2.1 * @return <code>null</code> if the temporary does not hold the 29 cananian 1.1.2.1 * value of a callee-save register, or else the identity 30 cananian 1.1.2.1 * of the callee-save register. 31 cananian 1.1.2.1 * @exception NullPointerException if <code>t</code> or <code>hc</code> 32 cananian 1.1.2.1 * is <code>null</code>. 33 cananian 1.1.2.1 * @exception TypeNotKnownException if the <code>BackendDerivation</code> 34 cananian 1.1.2.1 * has no information about <code>t</code> as defined 35 cananian 1.1.2.1 * at <code>hce</code>. 36 cananian 1.1.2.1 */ 37 cananian 1.1.2.1 public Register calleeSaveRegister(HCodeElement hce, Temp t); 38 cananian 1.1.2.1 39 cananian 1.1.2.1 public static interface Register { 40 cananian 1.1.2.1 /** Returns the index of this register in the machine register file. 41 cananian 1.1.2.1 * This index is zero based and dense; it may not map directly 42 cananian 1.1.2.1 * to this register's position in the register file. For example, 43 cananian 1.1.2.1 * the first usable/local register in the register file will have 44 cananian 1.1.2.1 * index 0, even if it is logically designated, say, "r8". The 45 cananian 1.1.2.1 * register indexes returned here must be consistent with those 46 cananian 1.1.2.1 * returned by 47 cananian 1.1.2.1 * <code>Backend.Generic.RegFileInfo.MachineRegLoc</code>. 48 cananian 1.1.2.1 */ 49 cananian 1.1.2.1 public int regIndex(); 50 cananian 1.1.2.1 } 51 cananian 1.2 }