scale.backend.sparc
Class BranchInstruction

java.lang.Object
  extended by scale.backend.Instruction
      extended by scale.backend.Branch
          extended by scale.backend.sparc.SparcBranch
              extended by scale.backend.sparc.BranchInstruction
All Implemented Interfaces:
java.lang.Cloneable

public class BranchInstruction
extends SparcBranch

This class represents Sparc Branch on condition code instructions.

$Id: BranchInstruction.java,v 1.18 2005-03-24 13:56:52 burrill Exp $

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

Instance=02, Op=00, op2=x10

It is important that the branch target always be target 0 and the fall through target be target 1.

See Also:
Branch.addTarget(scale.backend.Label, int)

Field Summary
 
Fields inherited from class scale.backend.sparc.SparcBranch
annulled, delaySlot, opcode, pt
 
Constructor Summary
BranchInstruction(int opcode, Displacement displacement, boolean annulled, int numTargets, SparcInstruction delaySlot)
           
 
Method Summary
 void assembler(Assembler asm, Emit emit)
          Insert the assembler representation of the instruction into the output stream.
 boolean canBeAnnulled()
          Return true if the branch can be annulled.
 boolean independent(Instruction inst, RegisterSet registers)
          Return true if this instruction is independent of the specified instruction.
 boolean isUnconditional()
          Return true if the branch is an unconditional transfer of control to a new address.
 void setDisplacement(Displacement displacement)
          After all of the instructions have been created, the Sparc Branch displacements must be calculated.
 java.lang.String toString()
           
 
Methods inherited from class scale.backend.sparc.SparcBranch
assembleDelay, assembleDisp, canBeDeleted, defs, delayToStringBuf, getAnnulled, getDelaySlot, getOpcode, getPt, instructionSize, mods, remapDestRegister, remapRegisters, remapSrcRegister, setAnnulled, setDelaySlot, setOpcode, setReturnedStructSize, specifyRegisterUsage, uses
 
Methods inherited from class scale.backend.Branch
additionalRegsKilled, additionalRegsSet, additionalRegsUsed, addTarget, copy, getBranchProbability, getExecutionCycles, getRegsKilled, getTarget, isBranch, isCall, markAsCall, nullify, numTargets, setBranchProbability, uses
 
Methods inherited from class scale.backend.Instruction
clone, ehash, getBBID, getCopyDest, getCopySrc, getDestRegister, getFunctionalUnit, getLoopNumber, getNext, getPredicate, getPredicates, getSrcRegisters, getTag, isCopy, isLabel, isLoad, isMandatory, isMarker, isPhi, isPredicated, isPredicatedOnTrue, isPrefetch, isSpillInstruction, isSpillLoadPoint, isSpillStorePoint, isStore, markSpillInstruction, nullified, numPredicates, removePredicates, setBBID, setLoopNumber, setMandatory, setNext, setPredicate, setPredicate, setPredicatedOnTrue, setPredicates, setsSpecialReg, setTag, specifyNotSpillLoadPoint, specifySpillStorePoint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BranchInstruction

public BranchInstruction(int opcode,
                         Displacement displacement,
                         boolean annulled,
                         int numTargets,
                         SparcInstruction delaySlot)
Method Detail

setDisplacement

public void setDisplacement(Displacement displacement)
After all of the instructions have been created, the Sparc Branch displacements must be calculated. This must be done prior to generating the assembly file.


independent

public boolean independent(Instruction inst,
                           RegisterSet registers)
Return true if this instruction is independent of the specified instruction. If instructions are independent, than one instruction can be moved before or after the other instruction without changing the semantics of the program.

Overrides:
independent in class Branch
Parameters:
inst - is the specified instruction

assembler

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

Specified by:
assembler in class Instruction

toString

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

canBeAnnulled

public boolean canBeAnnulled()
Return true if the branch can be annulled.

Overrides:
canBeAnnulled in class SparcBranch

isUnconditional

public boolean isUnconditional()
Return true if the branch is an unconditional transfer of control to a new address.

Overrides:
isUnconditional in class SparcBranch