scale.backend.mips
Class MipsInstruction

java.lang.Object
  extended by scale.backend.Instruction
      extended by scale.backend.mips.MipsInstruction
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CondMovInstruction, FltCmpInstruction, FltOpInstruction, IntOpInstruction, IntOpLitInstruction, LoadImmediateInstruction, LoadInstruction, MFSpecialInstruction, MultInstruction, StoreInstruction, TrapInstruction

public abstract class MipsInstruction
extends Instruction

This is the base class for all Mips instructions except branches.

$Id: MipsInstruction.java,v 1.9 2006-11-16 17:49:37 burrill Exp $

Copyright 2005 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.


Field Summary
protected  int opcode
          the instruction opcode
 
Constructor Summary
MipsInstruction(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 gen, Emit emit)
          Insert the assembler representation of the instruction into the output stream.
 boolean defs(int register, RegisterSet registers)
          Return true if the instruction sets the register.
 int getOpcode()
          Return the numeric opcode of the instruction.
 int instructionSize()
          Return the number of bytes required for all Mips instructions.
 void remapRegisters(int[] map)
          Map the virtual registers referenced in the instruction to the specified real registers.
protected  void setOpcode(int opcode)
           
 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.
 
Methods inherited from class scale.backend.Instruction
canBeDeleted, clone, copy, ehash, getBBID, getCopyDest, getCopySrc, getDestRegister, getExecutionCycles, getFunctionalUnit, getLoopNumber, getNext, getPredicate, getPredicates, getSrcRegisters, getTag, independent, isBranch, isCopy, isLabel, isLoad, isMandatory, isMarker, isPhi, isPredicated, isPredicatedOnTrue, isPrefetch, isSpillInstruction, isSpillLoadPoint, isSpillStorePoint, isStore, markSpillInstruction, mods, nullified, nullify, numPredicates, remapDestRegister, remapSrcRegister, removePredicates, setBBID, setLoopNumber, setMandatory, setNext, setPredicate, setPredicate, setPredicatedOnTrue, setPredicates, setsSpecialReg, setTag, specifyNotSpillLoadPoint, specifySpillStorePoint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

opcode

protected int opcode
the instruction opcode

Constructor Detail

MipsInstruction

public MipsInstruction(int opcode)
Parameters:
opcode - is the instruction's opcode
Method Detail

getOpcode

public int getOpcode()
Description copied from class: Instruction
Return the numeric opcode of the instruction. This opcode may be an encoding of the actual instruction opcode.

Specified by:
getOpcode in class Instruction

setOpcode

protected void setOpcode(int opcode)

instructionSize

public int instructionSize()
Return the number of bytes required for all Mips instructions.

Specified by:
instructionSize in class Instruction

specifyRegisterUsage

public void specifyRegisterUsage(RegisterAllocator rs,
                                 int index,
                                 int strength)
Specify the registers used and defined by this instruction. Uses must be specified before definitions.

Specified by:
specifyRegisterUsage in class Instruction
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 Instruction

defs

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

Overrides:
defs 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.

Specified by:
remapRegisters in class Instruction
Parameters:
map - maps from the virtual register to real register

assembleDisp

public 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.


assembler

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

Specified by:
assembler in class Instruction

toString

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