scale.backend
Class OffsetDisplacement

java.lang.Object
  extended by scale.backend.Displacement
      extended by scale.backend.OffsetDisplacement

public class OffsetDisplacement
extends Displacement

This class represents a displacement field in an instruction that is offset from another displacement.

$Id: OffsetDisplacement.java,v 1.23 2007-09-20 18:57:40 burrill Exp $

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

This displacement is offset from another displacement. When the base displacement is adjusted, this displacement is also adjusted.


Constructor Summary
OffsetDisplacement(Displacement displacement, long offset)
          Obtain a Displacement with an offset from the specified Displacement.
 
Method Summary
 void adjust(int adjustment)
          Adjust the displacement by the specified value.
 java.lang.String assembler(Assembler asm)
          Generate a String representation that can be used by the assembly code generater.
 boolean equivalent(java.lang.Object o)
          Return true if the displacements are equivalent.
 Displacement getBase()
          Return the base of the offset displacement.
 long getDisplacement()
          Return the displacement.
 boolean isNumeric()
          Return true if the displacement can be represented as an integer.
 boolean isStack()
          Return true if the displacement is from the stack pointer.
 boolean isZero()
          Return true if the displacement is zero.
 java.lang.String toString()
           
 Displacement unique()
          Return a unique displacement.
 
Methods inherited from class scale.backend.Displacement
created, isSymbol, offset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OffsetDisplacement

public OffsetDisplacement(Displacement displacement,
                          long offset)
Obtain a Displacement with an offset from the specified Displacement.

Method Detail

getBase

public Displacement getBase()
Return the base of the offset displacement.

Overrides:
getBase in class Displacement

isZero

public boolean isZero()
Return true if the displacement is zero.

Overrides:
isZero in class Displacement

unique

public Displacement unique()
Return a unique displacement. For the Alpha, each symbol reference must have a unique identification number.

Specified by:
unique in class Displacement
See Also:
SymbolDisplacement

isNumeric

public boolean isNumeric()
Return true if the displacement can be represented as an integer.

Overrides:
isNumeric in class Displacement

getDisplacement

public long getDisplacement()
Return the displacement.

Overrides:
getDisplacement in class Displacement

isStack

public boolean isStack()
Return true if the displacement is from the stack pointer.

Overrides:
isStack in class Displacement

adjust

public void adjust(int adjustment)
Adjust the displacement by the specified value.

Overrides:
adjust in class Displacement

assembler

public java.lang.String assembler(Assembler asm)
Generate a String representation that can be used by the assembly code generater.

Specified by:
assembler in class Displacement

toString

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

equivalent

public boolean equivalent(java.lang.Object o)
Return true if the displacements are equivalent.

Overrides:
equivalent in class Displacement