scale.backend.alpha
Class MemoryInstruction

java.lang.Object
  extended by scale.backend.Instruction
      extended by scale.backend.alpha.MemoryInstruction
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
BarriorInstruction, FetchInstruction, LoadAddressInstruction, LoadInstruction, RPCCInstruction, StoreInstruction, TrapInstruction

public abstract class MemoryInstruction
extends Instruction

This class represents Alpha memory-format instructions.

$Id: MemoryInstruction.java,v 1.28 2007-10-04 19:57:51 burrill Exp $

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


Field Summary
protected  Displacement displacement
          A symbolic representation of the displacement
protected  int opcode
          The instruction opcode.
protected  int ra
          The ra register.
protected  int rb
          The rb register
protected  int relocType
          The type of relocation
 
Constructor Summary
protected MemoryInstruction(int opcode, int ra, int rb, Displacement displacement)
           
protected MemoryInstruction(int opcode, int ra, int rb, Displacement displacement, int relocType)
           
 
Method Summary
 void assembler(Assembler asm, Emit emit)
          Insert the assembler representation of the instruction into the output stream.
 Displacement getDisplacement()
          Return the displacement.
 int getExecutionCycles()
          Return the number of cycles that this instruction requires.
 int getFunctionalUnit()
          Return the number of the functional unit required to execute this instruction.
 int getOpcode()
          Return the instructions opcode.
 int getRa()
          Return the Ra register field.
 int getRb()
          Return the Rb register field.
 int getRelocType()
          Return the relocation type.
 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 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 setDisplacement(Displacement disp)
          Set the displacement.
protected  void setRb(int rb)
          Set the Rb register field.
 java.lang.String toString()
           
 
Methods inherited from class scale.backend.Instruction
canBeDeleted, clone, copy, defs, ehash, getBBID, getCopyDest, getCopySrc, getDestRegister, 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, setsSpecialReg, setTag, specifyNotSpillLoadPoint, specifyRegisterUsage, specifySpillStorePoint, uses
 
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.


ra

protected int ra
The ra register.


rb

protected int rb
The rb register


displacement

protected Displacement displacement
A symbolic representation of the displacement


relocType

protected int relocType
The type of relocation

Constructor Detail

MemoryInstruction

protected MemoryInstruction(int opcode,
                            int ra,
                            int rb,
                            Displacement displacement,
                            int relocType)

MemoryInstruction

protected MemoryInstruction(int opcode,
                            int ra,
                            int rb,
                            Displacement displacement)
Method Detail

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

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.

Specified by:
remapSrcRegister in class Instruction
Parameters:
oldReg - is the previous source register
newReg - is the new source 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.

Specified by:
remapDestRegister in class Instruction
Parameters:
oldReg - is the previous destination register
newReg - is the new destination register

getOpcode

public int getOpcode()
Return the instructions opcode.

Specified by:
getOpcode in class Instruction

getRa

public int getRa()
Return the Ra register field.


getRb

public int getRb()
Return the Rb register field.


setRb

protected void setRb(int rb)
Set the Rb register field.


getRelocType

public final int getRelocType()
Return the relocation type.


getDisplacement

public Displacement getDisplacement()
Return the displacement.


setDisplacement

public void setDisplacement(Displacement disp)
Set the displacement.


independent

public boolean independent(Instruction inst,
                           RegisterSet registers)
Return true if this instruction is independent of the specified instruction. If instructions are independent, than one instruction can be moved before or after the other instruction without changing the semantics of the program.

Specified by:
independent in class Instruction
Parameters:
inst - is the specified instruction

instructionSize

public int instructionSize()
Return the number of bytes required for the instruction.

Specified by:
instructionSize in class Instruction

getExecutionCycles

public int getExecutionCycles()
Return the number of cycles that this instruction requires.

Overrides:
getExecutionCycles in class Instruction

getFunctionalUnit

public int getFunctionalUnit()
Return the number of the functional unit required to execute this instruction.

Overrides:
getFunctionalUnit in class Instruction

assembler

public void assembler(Assembler asm,
                      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