1 pnkfelix 1.1.2.1 // InstrJUMP.java, created Fri Aug 27 15:20:57 1999 by pnkfelix
 2 pnkfelix 1.1.2.1 // 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.IR.Assem;
 5 pnkfelix 1.1.2.1   
 6 pnkfelix 1.1.2.1 import harpoon.ClassFile.HCodeElement;
 7 pnkfelix 1.1.2.1 import harpoon.Temp.Label;
 8 cananian 1.1.2.4 import harpoon.Temp.TempMap;
 9 pnkfelix 1.1.2.1 
10 pnkfelix 1.1.2.1 import java.util.Arrays;
11 pnkfelix 1.1.2.1 
12 pnkfelix 1.1.2.1 /** <code>InstrJUMP</code> represents a shift in control flow to one
13 pnkfelix 1.1.2.3     target <code>Label</code> with no side-effects.  This instruction
14 pnkfelix 1.1.2.3     is being specialized to allow for easier detection of JUMPs which
15 pnkfelix 1.1.2.3     could guide optimizations (mainly in laying out basic blocks to
16 pnkfelix 1.1.2.3     allow for elimination of unnecessary JUMPs.)
17 pnkfelix 1.1.2.1 
18 pnkfelix 1.1.2.1     Execution of an <code>InstrJUMP</code> should have no side-effects
19 pnkfelix 1.1.2.1     other than changing the Program Counter to the target location in
20 pnkfelix 1.1.2.3     the code.  Thus, <code>InstrJUMP</code>s can be eliminated if
21 pnkfelix 1.1.2.3     control would already flow through the code in the same way
22 pnkfelix 1.1.2.3     without the JUMP in place.
23 pnkfelix 1.1.2.1     
24 pnkfelix 1.1.2.1     @author  Felix S. Klock II <pnkfelix@mit.edu>
25 cananian 1.3         @version $Id: InstrJUMP.java,v 1.3 2003/06/19 21:01:03 cananian Exp $ */
26 pnkfelix 1.1.2.1 public class InstrJUMP extends Instr {
27 pnkfelix 1.1.2.1     
28 pnkfelix 1.1.2.1     /** Creates a <code>InstrJUMP</code>. */
29 pnkfelix 1.1.2.1     public InstrJUMP( InstrFactory inf, HCodeElement source,
30 pnkfelix 1.1.2.1                       String assem, Label target) {
31 pnkfelix 1.1.2.1         super(inf, source, assem, null, null, false, 
32 pnkfelix 1.1.2.1               Arrays.asList(new Label[]{ target }));
33 pnkfelix 1.1.2.1     }
34 pnkfelix 1.1.2.2 
35 pnkfelix 1.1.2.6     public Instr cloneMutateAssem(InstrFactory inf, String newAssem) {
36 cananian 1.3             return new InstrJUMP(inf, this, newAssem, getTargets().get(0));
37 pnkfelix 1.1.2.6     }
38 cananian 1.1.2.4     public Instr rename(InstrFactory inf, TempMap defMap, TempMap useMap) {
39 cananian 1.3             return new InstrJUMP(inf, this, getAssem(), getTargets().get(0));
40 cananian 1.1.2.4     }
41 pnkfelix 1.1.2.2     public void accept(InstrVisitor v) { v.visit(this); }
42 pnkfelix 1.1.2.5 
43 pnkfelix 1.1.2.5     public boolean isJump() { return true; }
44 cananian 1.2     }