|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscale.backend.Instruction
scale.backend.Branch
scale.backend.trips2.TripsBranch
public final class TripsBranch
This class represents Trips branch instructions.
$Id: TripsBranch.java,v 1.43 2007-10-31 23:47:51 bmaher Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The TripsInstruction class represents operations in both operand and target form. When in operand form, ithe operation is considered a PSEUDO-op. If a PSEUDO operation is represented, the ra, rb, and rc fields represent an input virtual register.
For operations in target form (non-PSEUDO operations), the ra, rb, and rc fields represent the targets of the operation and specifies either an instruction ID, immediate value, or a register depending on the instruction format.
The opcode encodes the instruction format:
| Bits | Use | description |
|---|---|---|
| 0..19 | 0 | should be zero |
| 20..23 | format | The format of the Trips instruction |
| 24..31 | opcode | The opcode of the Trips instruction |
If there is only one output required from an instruction, the B1 or T1 form is used regardless of the register number or the immediate value size.
Each instruction is labeled with an integer ID which is unique within the basic block in which the instruction resides.
When the instruction is a Trips instruction containing an immediate value, the immediate value is coded as follows:
| Bits | Use | description |
|---|---|---|
| 0..27 | value | an index into a table of displacements |
| 28..31 | ftn | the function to apply to the value |
| Field Summary | |
|---|---|
protected SymbolDisplacement |
disp
The target symbol displacement for a CALLO instruction. |
protected int |
numPredicates
The number of registers the instruction is predicated on. |
protected boolean |
predicatedOnTrue
The condition on which to predicate. |
protected int[] |
predicates
The registers the instruction is predicated on. |
protected int |
rb
The rb register. |
| Constructor Summary | |
|---|---|
TripsBranch(int opcode,
int numTargets)
Create a new Trips SCALL instruction. |
|
TripsBranch(int opcode,
int rb,
int numTargets)
Create a new Trips branch instruction in the B:1 format. |
|
TripsBranch(int opcode,
int numTargets,
int rp,
boolean predicatedOnTrue)
Create a new Trips SCALL Instruction. |
|
TripsBranch(int opcode,
int rb,
int numTargets,
int rp,
boolean predicatedOnTrue)
Create a new Trips branch instruction in the B:1 format. |
|
TripsBranch(int opcode,
Label lab,
int numTargets)
Create a new Trips branch instruction in the B:0 format (except SCALL). |
|
TripsBranch(int opcode,
Label lab,
int numTargets,
int rp,
boolean predicatedOnTrue)
Create a new Trips branch instruction in the B:0 format (except SCALL). |
|
TripsBranch(int opcode,
Label lab,
int numTargets,
int rp,
boolean predicatedOnTrue,
double brpred)
Create a new Trips branch with specified taken probability. |
|
TripsBranch(int opcode,
SymbolDisplacement disp,
int numTargets)
Create a new Trips CALLO Instruction. |
|
TripsBranch(int opcode,
SymbolDisplacement disp,
int numTargets,
int rp,
boolean predicatedOnTrue)
Create a new Trips CALLO Instruction. |
|
| Method Summary | |
|---|---|
void |
assembler(Assembler asm,
Emit emit)
Insert the assembler representation of the instruction into the output stream. |
boolean |
canBeDeleted(RegisterSet registers)
Return true if the instruction can be deleted without changing program semantics. |
static int |
created()
Return the number of instances of this class created. |
boolean |
defs(int register,
RegisterSet registers)
Return true if the instruction sets the register |
int |
ehash()
Return a hash code that can be used to determine equivalence. |
int |
getBBID()
Get the basic block number of the instruction. |
int |
getBranchId()
Return the branch id. |
int |
getCopyDest()
Return the source register of a copy instruction. |
int |
getCopySrc()
Return the source register of a copy instruction. |
int |
getFormat()
Return the instruction format. |
int |
getLoopNumber()
Return the loop number of the instruction. |
int |
getOpcode()
Return the instruction opcode. |
int |
getPredicate(int i)
Return the i-th predicate for the instruction. |
int[] |
getPredicates()
Return the predicates for the instruction. |
int |
getRb()
Return the rb field. |
int[] |
getSrcRegisters()
This routine returns the source registers for an instruction. |
Label |
getTarget()
Return the target of the branch. |
boolean |
independent(Instruction inst,
RegisterSet registers)
Return true if this instruction is independent of the specified instruction. |
int |
instructionSize()
Return the number of bytes required for the TripsBranch. |
boolean |
isCopy()
Return true if the instruction copies a value from one register to another without modification. |
boolean |
isPredicated()
Returns true if the instruction in predicated |
boolean |
isPredicatedOnTrue()
Returns true if the instruction is predicated on true. |
boolean |
mods(int register,
RegisterSet registers)
Return true if the instruction clobbers the register. |
int |
numPredicates()
Return the number of predicates for the instruction. |
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 |
removePredicates()
Remove the predicates from this instruction. |
void |
setBBID(int bbid)
Set the basic block number of the instruction. |
void |
setBranchId(int branchId)
Set the branch id. |
protected void |
setLoopNumber(int loopNumber)
Set the loop number of the instruction. |
void |
setPredicate(int rp)
Set the predicate for the instruction. |
void |
setPredicate(int rp,
boolean predicatedOnTrue)
Set the predicate for the instruction. |
void |
setPredicatedOnTrue(boolean predicatedOnTrue)
Set the condition for the predicate. |
void |
setPredicates(int[] predicates)
Set the predicates for the instruction. |
void |
setPredicates(int[] predicates,
boolean predicatedOnTrue)
Set the predicates for the instruction. |
void |
specifyRegisterUsage(RegisterAllocator rs,
int index,
int strength)
Specify the registers used by this instruction. |
java.lang.String |
toString()
Return a string representation of the instruction. |
boolean |
uses(int register,
RegisterSet registers)
Return true if the instruction uses the register. |
| 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, getDestRegister, getFunctionalUnit, getNext, getTag, isLabel, isLoad, isMandatory, isMarker, isPhi, isPrefetch, isSpillInstruction, isSpillLoadPoint, isSpillStorePoint, isStore, markSpillInstruction, nullified, setMandatory, setNext, setsSpecialReg, setTag, specifyNotSpillLoadPoint, specifySpillStorePoint |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int rb
protected SymbolDisplacement disp
protected int[] predicates
protected int numPredicates
protected boolean predicatedOnTrue
| Constructor Detail |
|---|
public TripsBranch(int opcode,
int rb,
int numTargets,
int rp,
boolean predicatedOnTrue)
opcode - specifies the pseudo-operationrb - specifies the right argument registernumTargets - specifies the number of targets of the branchrp - specifies the register to predicate on (-1 if unused)predicatedOnTrue - specifies the condition to predicate on
(ignored if rp is -1)
public TripsBranch(int opcode,
int rb,
int numTargets)
opcode - specifies the pseudo-operationrb - specifies the right argument registernumTargets - specifies the number of targets of the branch
public TripsBranch(int opcode,
Label lab,
int numTargets,
int rp,
boolean predicatedOnTrue)
opcode - specifies the pseudo-operationlab - specifies the target label (ignored if instruction opcode = SCALL)numTargets - specifies the number of targets of the branchrp - specifies the register to predicate on (-1 if unused)predicatedOnTrue - specifies the condition to predicate on
(ignored if rp is -1)
public TripsBranch(int opcode,
Label lab,
int numTargets,
int rp,
boolean predicatedOnTrue,
double brpred)
opcode - specifies the pseudo-operationlab - specifies the target label (ignored if instruction
opcode = SCALL)numTargets - specifies the number of targets of the branchrp - specifies the register to predicate on (-1 if unused)predicatedOnTrue - specifies the condition to predicate on
(ignored if rp is -1)brpred - is the probability that this branch is taken
public TripsBranch(int opcode,
Label lab,
int numTargets)
opcode - specifies the pseudo-operationlab - specifies the target label (ignored if instruction opcode = SCALL)numTargets - specifies the number of targets of the branch
public TripsBranch(int opcode,
SymbolDisplacement disp,
int numTargets,
int rp,
boolean predicatedOnTrue)
opcode - specifies the pseudo-operationdisp - specifies the target symbol displacement (ignored if
instruction opcode = SCALL)numTargets - specifies the number of targets of the branchrp - specifies the register to predicate on (-1 if unused)predicatedOnTrue - specifies the condition to predicate on
(ignored if rp is -1)
public TripsBranch(int opcode,
SymbolDisplacement disp,
int numTargets)
opcode - specifies the pseudo-operationdisp - specifies the target symbol displacement (ignored if
instruction opcode = SCALL)numTargets - specifies the number of targets of the branch
public TripsBranch(int opcode,
int numTargets,
int rp,
boolean predicatedOnTrue)
opcode - specifies the pseudo-operationnumTargets - specifies the number of targets of the branchrp - specifies the register to predicate on (-1 if unused)predicatedOnTrue - specifies the condition to predicate on
(ignored if rp is -1)
public TripsBranch(int opcode,
int numTargets)
opcode - specifies the pseudo-operationnumTargets - specifies the number of targets of the branch| Method Detail |
|---|
public static int created()
public void remapRegisters(int[] map)
remapRegisters in class Branchmap - maps from the virtual register to real register
public void remapSrcRegister(int oldReg,
int newReg)
remapSrcRegister in class BrancholdReg - is the previous source registernewReg - is the new source register
public void remapDestRegister(int oldReg,
int newReg)
remapDestRegister in class BrancholdReg - is the previous destination registernewReg - is the new destination registerpublic int getOpcode()
getOpcode in class Instructionpublic Label getTarget()
public int getFormat()
public int[] getSrcRegisters()
getSrcRegisters in class Instructionpublic int getRb()
public final int numPredicates()
numPredicates in class Instructionpublic final int getPredicate(int i)
getPredicate in class Instructionpublic int[] getPredicates()
getPredicates in class Instructionpublic void setPredicate(int rp)
setPredicate in class Instruction
public void setPredicate(int rp,
boolean predicatedOnTrue)
setPredicate in class Instructionpublic void setPredicates(int[] predicates)
setPredicates in class Instruction
public void setPredicates(int[] predicates,
boolean predicatedOnTrue)
public void removePredicates()
removePredicates in class Instructionpublic boolean isPredicated()
isPredicated in class Instructionpublic boolean isPredicatedOnTrue()
isPredicatedOnTrue in class Instructionpublic void setPredicatedOnTrue(boolean predicatedOnTrue)
setPredicatedOnTrue in class Instruction
public void specifyRegisterUsage(RegisterAllocator rs,
int index,
int strength)
specifyRegisterUsage in class Branchrs - 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 uses(int register,
RegisterSet registers)
uses in class Branch
public boolean defs(int register,
RegisterSet registers)
defs in class Branch
public boolean mods(int register,
RegisterSet registers)
mods in class Branch
public boolean independent(Instruction inst,
RegisterSet registers)
independent in class Branchinst - is the specified instructionpublic int instructionSize()
instructionSize in class Instructionpublic boolean canBeDeleted(RegisterSet registers)
canBeDeleted in class Instructionpublic boolean isCopy()
isCopy in class Instructionpublic int getCopySrc()
getCopySrc in class Instructionpublic int getCopyDest()
getCopyDest in class Instructionpublic int ehash()
ehash in class Instruction
public void assembler(Assembler asm,
Emit emit)
assembler in class Instructionpublic java.lang.String toString()
toString in class Branchpublic int getLoopNumber()
getLoopNumber in class Instructionprotected void setLoopNumber(int loopNumber)
setLoopNumber in class Instructionpublic int getBBID()
getBBID in class Instructionpublic void setBBID(int bbid)
setBBID in class Instructionpublic int getBranchId()
public void setBranchId(int branchId)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||