scale.backend.x86
Class X86RInstruction

java.lang.Object
  extended by scale.backend.Instruction
      extended by scale.backend.x86.X86Instruction
          extended by scale.backend.x86.X86RInstruction
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
X86RDInstruction, X86RRInstruction

public class X86RInstruction
extends X86Instruction

This is the base class for all X86 instructions except branches that def a register.

$Id$

Copyright 2008 by James H. Burrill
All Rights Reserved.


Field Summary
protected  int reg
          If the instruction modifies a register, it is specified by this member.
 
Fields inherited from class scale.backend.x86.X86Instruction
opcode, setCC, useCC
 
Constructor Summary
X86RInstruction(int opcode, int reg)
           
 
Method Summary
 void assembler(Assembler asm, Emit emit)
          Insert the assembler representation of the instruction into the output stream.
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
 int getDestRegister()
          Return the destination register or -1 if none.
 int getReg()
           
 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 setReg(int reg)
           
 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.x86.X86Instruction
assembleDisp, buildAddress, canBeDeleted, getDisplacement, getDisplacement2, getOpcode, getOperandSize, getOperandSizeLabel, getReg2, getReg3, getScale, independent, independentCC, instructionSize, isReversed, setDisplacement, setDisplacement2, setOpcode, setOperandSize, setReg2, setReg3, setScale, setsCC, setSetCC, setsSpecialReg, setUseCC, usesCC
 
Methods inherited from class scale.backend.Instruction
clone, copy, ehash, getBBID, getCopyDest, getCopySrc, 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

reg

protected int reg
If the instruction modifies a register, it is specified by this member. If there is no destination register, the value is -1.

Constructor Detail

X86RInstruction

public X86RInstruction(int opcode,
                       int reg)
Method Detail

checkForm

protected boolean checkForm(int opcode)
Description copied from class: X86Instruction
Return true if the specified form is valid for this instruction opcode.

Overrides:
checkForm in class X86Instruction

getReg

public int getReg()
Overrides:
getReg in class X86Instruction

setReg

public void setReg(int reg)
Overrides:
setReg in class X86Instruction

getDestRegister

public int getDestRegister()
Return the destination register or -1 if none.

Overrides:
getDestRegister in class Instruction

remapRegisters

public void remapRegisters(int[] map)
Description copied from class: Instruction
Map the virtual registers referenced in the instruction to the specified real registers. The mapping is specified using an array that is indexed by the virtual register to return the real register.

Overrides:
remapRegisters in class X86Instruction
Parameters:
map - maps from the virtual register to real register

remapDestRegister

public void remapDestRegister(int oldReg,
                              int newReg)
Map the registers defined in the instruction as destinations to the specified register. If the register is not used as a destination register, no change is made.

Overrides:
remapDestRegister in class X86Instruction
Parameters:
oldReg - is the previous destination register
newReg - is the new destination register

remapSrcRegister

public void remapSrcRegister(int oldReg,
                             int newReg)
Map the registers used in the instruction as sources to the specified register. If the register is not used as a source register, no change is made.

Overrides:
remapSrcRegister in class X86Instruction
Parameters:
oldReg - is the previous source register
newReg - is the new source register

specifyRegisterUsage

public void specifyRegisterUsage(RegisterAllocator rs,
                                 int index,
                                 int strength)
Specify the registers used by this instruction.

Overrides:
specifyRegisterUsage in class X86Instruction
Parameters:
rs - is the register set in use
index - is an index associated with the instruction
strength - is the importance of the instruction
See Also:
RegisterAllocator.useRegister(int,int,int), RegisterAllocator.defRegister(int,int)

uses

public boolean uses(int register,
                    RegisterSet registers)
Return true if the instruction uses the register.

Overrides:
uses in class X86Instruction

defs

public boolean defs(int register,
                    RegisterSet registers)
Return true if the instruction sets the register

Overrides:
defs in class X86Instruction

assembler

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

Overrides:
assembler in class X86Instruction

toString

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