harpoon.IR.Assem
Class InstrJUMP

java.lang.Object
  extended by harpoon.IR.Assem.Instr
      extended by harpoon.IR.Assem.InstrJUMP
All Implemented Interfaces:
HCodeElement, CFGraphable<Instr,InstrEdge>, UseDefable, Graph.Node<Instr,InstrEdge>

public class InstrJUMP
extends Instr

InstrJUMP represents a shift in control flow to one target Label with no side-effects. This instruction is being specialized to allow for easier detection of JUMPs which could guide optimizations (mainly in laying out basic blocks to allow for elimination of unnecessary JUMPs.) Execution of an InstrJUMP should have no side-effects other than changing the Program Counter to the target location in the code. Thus, InstrJUMPs can be eliminated if control would already flow through the code in the same way without the JUMP in place.

Version:
$Id: InstrJUMP.java,v 1.3 2003/06/19 21:01:03 cananian Exp $
Author:
Felix S. Klock II <pnkfelix@mit.edu>

Field Summary
 
Fields inherited from class harpoon.IR.Assem.Instr
arrayFactory, canFallThrough, next, prev
 
Constructor Summary
InstrJUMP(InstrFactory inf, HCodeElement source, String assem, Label target)
          Creates a InstrJUMP.
 
Method Summary
 void accept(InstrVisitor v)
          Accept a visitor.
 Instr cloneMutateAssem(InstrFactory inf, String newAssem)
          Clones this, mutating the assembly string.
 boolean isJump()
          Returns true if this is an unconditional Jump.
 Instr rename(InstrFactory inf, TempMap defMap, TempMap useMap)
          Create a new Instr identical to the receiver, but with all Temps renamed according to the given mappings.
 
Methods inherited from class harpoon.IR.Assem.Instr
cloneMutateAssem, def, defC, edgeC, edges, getAssem, getEntry, getExit, getFactory, getGroups, getID, getInstrFor, getLineNumber, getNext, getPrev, getSourceFile, getTargets, hashCode, hasModifiableTargets, hasMultiplePredecessors, insertAt, insertInstrsAt, isDirective, isDummy, isLabel, isMove, isPred, isSucc, layout, map, map, map, pred, predC, remove, rename, rename, replace, replaceInstrList, setGroup, succ, succC, toString, use, useC
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InstrJUMP

public InstrJUMP(InstrFactory inf,
                 HCodeElement source,
                 String assem,
                 Label target)
Creates a InstrJUMP.

Method Detail

cloneMutateAssem

public Instr cloneMutateAssem(InstrFactory inf,
                              String newAssem)
Description copied from class: Instr
Clones this, mutating the assembly string.
requires: newAssem != null
effects: Returns a new Instr object with the same compiler-visible high level properties as this (use/def, isMove, etc), but instead of having the assembly-string of this, it has newAssem as its assembly string. The generated instr will not have a a place in the instruction layout; it is the responsiblity of the caller to subsequently call Instr.replace to swap this and the returned Instr.

Overrides:
cloneMutateAssem in class Instr

rename

public Instr rename(InstrFactory inf,
                    TempMap defMap,
                    TempMap useMap)
Description copied from class: Instr
Create a new Instr identical to the receiver, but with all Temps renamed according to the given mappings. The new Instr will have no edges, and will come from the specified InstrFactory. FSK: I don't think this "no edges" part of the specification holds anymore (it was written before we revised the control-flow representation in the Instrs...

Overrides:
rename in class Instr

accept

public void accept(InstrVisitor v)
Description copied from class: Instr
Accept a visitor.

Overrides:
accept in class Instr

isJump

public boolean isJump()
Description copied from class: Instr
Returns true if this is an unconditional Jump.
effects: Returns true if the only effect of executing this instruction is to shift control-flow to one target Label with no side-effects.

Overrides:
isJump in class Instr