|
|||||||||
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 scale.backend.x86.X86Branch
public class X86Branch
This is the class for all machine X86 branch instructions.
$Id$
Copyright 2008 by James H. Burrill
All Rights Reserved.
Field Summary | |
---|---|
protected int |
opcode
the instruction opcode |
protected boolean |
pt
True branch predicted? |
Constructor Summary | |
---|---|
protected |
X86Branch(int opcode,
boolean pt,
int numTargets)
|
Method Summary | |
---|---|
java.lang.String |
assembleDisp(Assembler asm,
Displacement disp,
int ftn)
Generate a String representation of a Displacement that can be used by the assembly code generater. |
void |
assembler(Assembler asm,
Emit emit)
Insert the assembler representation of the instruction into the output stream. |
static void |
buildAddress(java.lang.StringBuffer buf,
int baseReg,
int indexReg,
Displacement disp,
int scale)
|
boolean |
canBeDeleted(RegisterSet registers)
Return true if the instruction can be deleted without changing program semantics. |
protected boolean |
checkForm(int opcode)
|
boolean |
defs(int register,
RegisterSet registers)
Return true if the instruction sets the register. |
Displacement |
getDisplacement()
|
int |
getOpcode()
Return the numeric opcode of the instruction. |
int |
getOperandSize()
Return 1, 2, 4, or 8 depending on the size of the operand, in bytes, specified for the instruction. |
char |
getOperandSizeLabel()
Return 'b', 'w', 'l', or 'x' depending on the size of the operand specified for the instruction. |
boolean |
getPt()
Return true if the branch is predicited to occur. |
int |
getReg()
|
int |
getReg2()
|
int |
instructionSize()
Return the number of bytes required for the instruction. |
boolean |
isReversed()
Return true if the instruction modifies memory. |
boolean |
isUnconditional()
Return true if the branch is an unconditional transfer of control to a new address. |
boolean |
mods(int register,
RegisterSet registers)
Return true if the instruction clobbers the register. |
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 |
setDisplacement(Displacement disp)
|
protected void |
setOpcode(int opcode)
|
void |
setOperandSize(int size)
Set the operand size specified for the instruction. |
void |
setReg(int reg)
|
void |
setReg2(int reg2)
|
protected void |
setReturnedStructSize(int size)
Specifiy the size of the struct returned by the call or 0 if none. |
void |
setScale(int scale)
Set the scale factor specified for the instruction. |
void |
specifyRegisterUsage(RegisterAllocator rs,
int index,
int strength)
Specify the registers used by this instruction. |
java.lang.String |
toString()
|
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, independent, isBranch, isCall, markAsCall, nullify, numTargets, setBranchProbability, uses |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int opcode
protected boolean pt
Constructor Detail |
---|
protected X86Branch(int opcode, boolean pt, int numTargets)
numTargets
- is the number of successors of this instruction.pt
- is true if the true condition is predicted
For routine calls, it does not include the routine called.Method Detail |
---|
protected boolean checkForm(int opcode)
public final int getOpcode()
Instruction
getOpcode
in class Instruction
protected final void setOpcode(int opcode)
public final boolean isReversed()
public boolean getPt()
public Displacement getDisplacement()
public void setDisplacement(Displacement disp)
public int getReg()
public void setReg(int reg)
public int getReg2()
public void setReg2(int reg2)
protected void setReturnedStructSize(int size)
public void specifyRegisterUsage(RegisterAllocator rs, int index, int strength)
specifyRegisterUsage
in class Branch
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 void remapRegisters(int[] map)
Branch
remapRegisters
in class Branch
map
- maps from the virtual register to real registerpublic void remapSrcRegister(int oldReg, int newReg)
remapSrcRegister
in class Branch
oldReg
- is the previous source registernewReg
- is the new source registerpublic void remapDestRegister(int oldReg, int newReg)
remapDestRegister
in class Branch
oldReg
- is the previous destination registernewReg
- is the new destination registerpublic 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 void assembler(Assembler asm, Emit emit)
Instruction
assembler
in class Instruction
public java.lang.String assembleDisp(Assembler asm, Displacement disp, int ftn)
public boolean canBeDeleted(RegisterSet registers)
canBeDeleted
in class Instruction
public int instructionSize()
Instruction
instructionSize
in class Instruction
public boolean isUnconditional()
public void setScale(int scale)
public int getOperandSize()
public char getOperandSizeLabel()
public void setOperandSize(int size)
public java.lang.String toString()
toString
in class Branch
public static void buildAddress(java.lang.StringBuffer buf, int baseReg, int indexReg, Displacement disp, int scale)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |