scale.backend
Class Label

java.lang.Object
  extended by scale.backend.Instruction
      extended by scale.backend.Marker
          extended by scale.backend.Label
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
TripsLabel

public class Label
extends Marker

This class marks the position of a point branched to.

$Id: Label.java,v 1.31 2007-10-04 19:57:49 burrill Exp $

Copyright 2008 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Constructor Summary
Label()
          Create a label.
Label(boolean referenced)
          Create a label.
 
Method Summary
protected  void addPredecessor(Instruction inst)
          Specify an instruction that precedes this label in the execution of the program
 void assembler(Assembler asm, Emit emit)
          Insert the assembler representation of the instruction into the output stream.
static int created()
          Return the number of instances of this class created.
 int getLabelIndex()
          Return the integer value associated with this label.
 Instruction getPredecessor(int i)
          Return the specified predecessor.
 int getStrength()
          Return the strength value associated with this label.
 boolean isFirstInBasicBlock()
          Return true if this label marks the point at which two or more CFG edges merge together.
 boolean isLabel()
          Return true if this is a label marker.
 boolean isReferenced()
          Return true if the label is referenced.
 void markAsFirstInBasicBlock()
          Specify that this label marks the point at which two or more CFG edges merge together.
 int numPredecessors()
          Return the number of edges into this label.
protected  void removePredecessors()
          Remove all the predecessors of a label.
protected  void replacePredecessor(Instruction old, Instruction rep)
          Replace an instruction that preceded this label in the execution of the program by another instruction
 void setLabelIndex(int labelIndex)
          Set the integer value associated with this label.
 void setNotReferenced()
          Indicate that the label has no reference that is not "fall-through".
 void setReferenced()
          Indicate that the label has a reference that is not "fall-through".
 void setStrength(int strength)
          Set the strength value associated with this label.
 java.lang.String toString()
           
 
Methods inherited from class scale.backend.Marker
getExecutionCycles, getOpcode, independent, instructionSize, isMarker, nullify, remapDestRegister, remapRegisters, remapSrcRegister, specifyRegisterUsage
 
Methods inherited from class scale.backend.Instruction
canBeDeleted, clone, copy, defs, ehash, getBBID, getCopyDest, getCopySrc, getDestRegister, getFunctionalUnit, getLoopNumber, getNext, getPredicate, getPredicates, getSrcRegisters, getTag, isBranch, isCopy, isLoad, isMandatory, isPhi, isPredicated, isPredicatedOnTrue, isPrefetch, isSpillInstruction, isSpillLoadPoint, isSpillStorePoint, isStore, markSpillInstruction, mods, nullified, numPredicates, removePredicates, setBBID, setLoopNumber, setMandatory, setNext, setPredicate, setPredicate, setPredicatedOnTrue, setPredicates, setsSpecialReg, setTag, specifyNotSpillLoadPoint, specifySpillStorePoint, uses
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Label

public Label(boolean referenced)
Create a label.

Parameters:
referenced - is true if this label is the explicit target of a branch. Implicit targets are usually the next contiguous instruction.

Label

public Label()
Create a label. The label is assumed to be referenced.

Method Detail

created

public static int created()
Return the number of instances of this class created.


setReferenced

public void setReferenced()
Indicate that the label has a reference that is not "fall-through".


isReferenced

public boolean isReferenced()
Return true if the label is referenced.


setNotReferenced

public void setNotReferenced()
Indicate that the label has no reference that is not "fall-through".


markAsFirstInBasicBlock

public final void markAsFirstInBasicBlock()
Specify that this label marks the point at which two or more CFG edges merge together. A basic block in the backend is slightly different from a basic block in prior phases of the compiler in that a new basic block starts at the return from a subroutine call.


isFirstInBasicBlock

public final boolean isFirstInBasicBlock()
Return true if this label marks the point at which two or more CFG edges merge together. A basic block in the backend is slightly different from a basic block in prior phases of the compiler in that a new basic block starts at the return from a subroutine call.


removePredecessors

protected void removePredecessors()
Remove all the predecessors of a label.


addPredecessor

protected void addPredecessor(Instruction inst)
Specify an instruction that precedes this label in the execution of the program


replacePredecessor

protected void replacePredecessor(Instruction old,
                                  Instruction rep)
Replace an instruction that preceded this label in the execution of the program by another instruction


numPredecessors

public int numPredecessors()
Return the number of edges into this label.


getPredecessor

public Instruction getPredecessor(int i)
Return the specified predecessor.


isLabel

public final boolean isLabel()
Return true if this is a label marker.

Overrides:
isLabel in class Instruction

getLabelIndex

public final int getLabelIndex()
Return the integer value associated with this label.


setLabelIndex

public final void setLabelIndex(int labelIndex)
Set the integer value associated with this label.


getStrength

public final int getStrength()
Return the strength value associated with this label.


setStrength

public final void setStrength(int strength)
Set the strength value associated with this label.


assembler

public void assembler(Assembler asm,
                      Emit emit)
Insert the assembler representation of the instruction into the output stream.

Overrides:
assembler in class Marker

toString

public java.lang.String toString()
Overrides:
toString in class Marker