1 pnkfelix 1.1.2.1 // TempInstrPair.java, created Mon May 31 13:52:05 1999 by pnkfelix 2 cananian 1.1.2.4 // Copyright (C) 1999 Felix S. Klock II <pnkfelix@mit.edu> 3 pnkfelix 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 pnkfelix 1.1.2.1 package harpoon.Analysis.Instr; 5 pnkfelix 1.1.2.1 6 pnkfelix 1.1.2.1 import harpoon.IR.Assem.Instr; 7 pnkfelix 1.1.2.1 import harpoon.Temp.Temp; 8 pnkfelix 1.1.2.1 /** 9 pnkfelix 1.1.2.1 <code>TempInstrPair</code> is an immutable data structure that 10 pnkfelix 1.1.2.1 associates an <code>Instr</code> with a <code>Temp</code>. 11 pnkfelix 1.1.2.1 12 cananian 1.1.2.4 @author Felix S. Klock II <pnkfelix@mit.edu> 13 cananian 1.2 @version $Id: TempInstrPair.java,v 1.2 2002/02/25 20:57:31 cananian Exp $ 14 pnkfelix 1.1.2.1 */ 15 pnkfelix 1.1.2.3 public class TempInstrPair { 16 pnkfelix 1.1.2.3 private final Temp t; 17 pnkfelix 1.1.2.3 private final Instr i; 18 pnkfelix 1.1.2.1 19 pnkfelix 1.1.2.3 public TempInstrPair(Instr i, Temp t) { 20 pnkfelix 1.1.2.3 this(t, i); 21 pnkfelix 1.1.2.1 } 22 pnkfelix 1.1.2.1 23 pnkfelix 1.1.2.1 public TempInstrPair(Temp t, Instr i) { 24 pnkfelix 1.1.2.1 this.i = i; 25 pnkfelix 1.1.2.1 this.t = t; 26 pnkfelix 1.1.2.1 } 27 pnkfelix 1.1.2.3 28 pnkfelix 1.1.2.3 public Temp getTemp() { return t; } 29 pnkfelix 1.1.2.3 public Instr getInstr() { return i; } 30 pnkfelix 1.1.2.1 31 pnkfelix 1.1.2.1 public boolean equals(Object o) { 32 cananian 1.1.2.2 TempInstrPair tip; 33 cananian 1.1.2.2 if (this==o) return true; 34 cananian 1.1.2.2 if (null==o) return false; 35 cananian 1.1.2.2 try { tip = (TempInstrPair) o; } 36 cananian 1.1.2.2 catch (ClassCastException ignore) { return false; } 37 cananian 1.1.2.2 return tip.t.equals(this.t) && 38 cananian 1.1.2.2 tip.i.equals(this.i); 39 pnkfelix 1.1.2.1 } 40 pnkfelix 1.1.2.1 41 pnkfelix 1.1.2.1 public int hashCode() { 42 pnkfelix 1.1.2.1 return i.hashCode(); 43 pnkfelix 1.1.2.1 } 44 pnkfelix 1.1.2.1 45 cananian 1.2 }