|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.backend.Instruction scale.backend.x86.X86Instruction
public class X86Instruction
This is the base class for all X86 instructions except branches.
$Id$
Copyright 2008 by James H. Burrill
All Rights Reserved.
Field Summary | |
---|---|
protected int |
opcode
The instruction opcode. |
protected byte |
setCC
flags that specify the condition codes set by the instruction |
protected byte |
useCC
flags that specify the condition codes used by the instruction |
Constructor Summary | |
---|---|
X86Instruction(int opcode)
|
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)
Return true if the specified form is valid for this instruction opcode. |
boolean |
defs(int register,
RegisterSet registers)
Return true if the instruction sets the register. |
Displacement |
getDisplacement()
|
Displacement |
getDisplacement2()
|
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. |
int |
getReg()
|
int |
getReg2()
|
int |
getReg3()
|
int |
getScale()
Return 1, 2, 4, or 8 depending on the scale factor specified for the instruction. |
boolean |
independent(Instruction inst,
RegisterSet registers)
Return true if this instruction is independent of the specified instruction. |
protected boolean |
independentCC(X86Instruction inst)
Return true if this instruction's CC use is independent of the specified instruction. |
int |
instructionSize()
Return the number of bytes required for this instruction. |
boolean |
isReversed()
Return true if the instruction modifies memory. |
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)
|
void |
setDisplacement2(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)
|
void |
setReg3(int reg3)
|
void |
setScale(int scale)
((X86Assembler) Set the scale factor specified for the instruction. |
boolean |
setsCC(int cc)
Return true if the instruction sets the CC flag specified. |
void |
setSetCC(int cc)
Specify the CC set by this instruction. |
boolean |
setsSpecialReg()
Return true if this instruction has a side effect of changing a special register. |
void |
setUseCC(int cc)
Specify the CCs used by this instruction. |
void |
specifyRegisterUsage(RegisterAllocator rs,
int index,
int strength)
Specify the registers used and defined by this instruction. |
java.lang.String |
toString()
|
boolean |
uses(int register,
RegisterSet registers)
Return true if the instruction uses the register. |
boolean |
usesCC(int cc)
Return true if the instruction uses the CC flag specified. |
Methods inherited from class scale.backend.Instruction |
---|
clone, copy, ehash, getBBID, getCopyDest, getCopySrc, getDestRegister, getExecutionCycles, getFunctionalUnit, getLoopNumber, getNext, getPredicate, getPredicates, getSrcRegisters, getTag, isBranch, isCopy, isLabel, isLoad, isMandatory, isMarker, isPhi, isPredicated, isPredicatedOnTrue, isPrefetch, isSpillInstruction, isSpillLoadPoint, isSpillStorePoint, isStore, markSpillInstruction, mods, nullified, nullify, numPredicates, removePredicates, setBBID, setLoopNumber, setMandatory, setNext, setPredicate, setPredicate, setPredicatedOnTrue, setPredicates, setTag, specifyNotSpillLoadPoint, specifySpillStorePoint |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int opcode
protected byte setCC
protected byte useCC
Constructor Detail |
---|
public X86Instruction(int opcode)
opcode
- is the instruction's opcodeMethod 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 Displacement getDisplacement()
public void setDisplacement(Displacement disp)
public Displacement getDisplacement2()
public void setDisplacement2(Displacement disp)
public int getReg()
public void setReg(int reg)
public int getReg2()
public void setReg2(int reg2)
public int getReg3()
public void setReg3(int reg3)
public boolean uses(int register, RegisterSet registers)
uses
in class Instruction
public boolean defs(int register, RegisterSet registers)
defs
in class Instruction
public int instructionSize()
instructionSize
in class Instruction
public final void setSetCC(int cc)
public final void setUseCC(int cc)
public final boolean setsCC(int cc)
cc
- specifies the CCpublic boolean setsSpecialReg()
setsSpecialReg
in class Instruction
public final boolean usesCC(int cc)
cc
- specifies the CCprotected final boolean independentCC(X86Instruction inst)
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 void remapRegisters(int[] map)
Instruction
remapRegisters
in class Instruction
map
- maps from the virtual register to real registerpublic boolean canBeDeleted(RegisterSet registers)
canBeDeleted
in class Instruction
public boolean independent(Instruction inst, RegisterSet registers)
Instruction
independent
in class Instruction
inst
- is the specified instructionpublic void remapDestRegister(int oldReg, int newReg)
Instruction
remapDestRegister
in class Instruction
oldReg
- is the previous destination registernewReg
- is the new destination registerpublic void remapSrcRegister(int oldReg, int newReg)
Instruction
remapSrcRegister
in class Instruction
oldReg
- is the previous source registernewReg
- is the new source registerpublic java.lang.String assembleDisp(Assembler asm, Displacement disp, int ftn)
public int getScale()
public void setScale(int scale)
public int getOperandSize()
public char getOperandSizeLabel()
public void setOperandSize(int size)
public void assembler(Assembler asm, Emit emit)
assembler
in class Instruction
public java.lang.String toString()
toString
in class java.lang.Object
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 |