|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.backend.Instruction scale.backend.Branch
public abstract class Branch
This is the abstract class for all machine branch instructions.
$Id: Branch.java,v 1.26 2007-10-04 19:57:48 burrill Exp $
Copyright 2007 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
Constructor Summary | |
---|---|
protected |
Branch(int numTargets)
|
Method Summary | |
---|---|
void |
additionalRegsKilled(short[] regsKilled)
Specify additional registers that may be killed by a subroutine call. |
void |
additionalRegsSet(short[] regsSet)
Specify additional registers that may be set by a subroutine call. |
void |
additionalRegsUsed(short[] regsUsed)
Specify additional registers that may be used by a subroutine call. |
void |
addTarget(Label lab,
int targetNumber)
Add a successor label for this branch. |
Instruction |
copy()
Make a copy of this instruction. |
boolean |
defs(int register,
RegisterSet registers)
Return true if the instruction defines the register. |
double |
getBranchProbability()
Return the probability that this branch is taken. |
int |
getExecutionCycles()
Return the number of cycles that this instruction requires. |
short[] |
getRegsKilled()
Specify additional registers that may be killed by a subroutine call. |
Label |
getTarget(int targetNumber)
Return the place branched to. |
boolean |
independent(Instruction inst,
RegisterSet registers)
Return true if this instruction is independent of the specified instruction. |
boolean |
isBranch()
Return true if this is a branch instruction. |
boolean |
isCall()
Return true if this branch is a call to a subroutine. |
void |
markAsCall()
Specify that this branch is a call to a subroutine. |
boolean |
mods(int register,
RegisterSet registers)
Return true if the instruction clobbers the register. |
void |
nullify(RegisterSet rs)
Mark the instruction as no longer needed. |
int |
numTargets()
Return the number of successors of this branch. |
void |
remapDestRegister(int oldReg,
int newReg)
Map the registers defined in the instruction as destinations to the specified register. |
void |
remapRegisters(int[] map)
Map the virtual registers referenced in the instruction to the specified real registers. |
void |
remapSrcRegister(int oldReg,
int newReg)
Map the registers used in the instruction as sources to the specified register. |
void |
setBranchProbability(double brProb)
Set the probability that this branch is taken. |
void |
specifyRegisterUsage(RegisterAllocator rs,
int index,
int strength)
Specify the registers used by this instruction. |
java.lang.String |
toString()
|
short[] |
uses()
Returns array of registers used. |
boolean |
uses(int register,
RegisterSet registers)
Return true if the instruction uses the register. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Branch(int numTargets)
numTargets
- is the number of successors of this instruction.
For routine calls, it does not include the routine called.Method Detail |
---|
public final void addTarget(Label lab, int targetNumber)
public final void additionalRegsUsed(short[] regsUsed)
public final void additionalRegsKilled(short[] regsKilled)
public final short[] getRegsKilled()
public final void additionalRegsSet(short[] regsSet)
public void nullify(RegisterSet rs)
nullify
in class Instruction
public final boolean isBranch()
isBranch
in class Instruction
public final void markAsCall()
public final boolean isCall()
public final double getBranchProbability()
public final void setBranchProbability(double brProb)
public final Label getTarget(int targetNumber)
public final int numTargets()
public int getExecutionCycles()
getExecutionCycles
in class Instruction
public boolean independent(Instruction inst, RegisterSet registers)
independent
in class Instruction
inst
- is the specified instructionpublic void specifyRegisterUsage(RegisterAllocator rs, int index, int strength)
specifyRegisterUsage
in class Instruction
rs
- is the register set in useindex
- is an index associated with the instructionstrength
- is the importance of the instructionRegisterAllocator.useRegister(int,int,int)
,
RegisterAllocator.defRegister(int,int)
public boolean defs(int register, RegisterSet registers)
defs
in class Instruction
public boolean uses(int register, RegisterSet registers)
uses
in class Instruction
public short[] uses()
public boolean mods(int register, RegisterSet registers)
mods
in class Instruction
public void remapRegisters(int[] map)
remapRegisters
in class Instruction
map
- maps from the virtual register to real registerpublic void remapSrcRegister(int oldReg, int newReg)
remapSrcRegister
in class Instruction
oldReg
- is the previous source registernewReg
- is the new source registerpublic void remapDestRegister(int oldReg, int newReg)
remapDestRegister
in class Instruction
oldReg
- is the previous destination registernewReg
- is the new destination registerpublic java.lang.String toString()
toString
in class java.lang.Object
public Instruction copy()
Instruction
copy
in class Instruction
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |