scale.backend
Class Displacement

java.lang.Object
  |
  +--scale.backend.Displacement
Direct Known Subclasses:
DiffDisplacement, LabelDisplacement, OffsetDisplacement, StackDisplacement, SymbolDisplacement

public class Displacement
extends java.lang.Object

This class represents a displacement field in an instruction.

$Id: Displacement.java,v 1.7 2002/01/03 21:41:30 burrill Exp $

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

This is a simple displacement where the displacement value is known. It is also the base class for displacements that are represented symbolicly or as an expression.


Constructor Summary
Displacement(int 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.
protected  void finalize()
          Keep the count of instances up-to-date.
 int getDisplacement()
          Return the displacement.
 boolean isNumeric()
          Return true if the displacement is zero.
 boolean isZero()
          Return true if the displacement is zero.
static int number()
          Return the current number of instances of this class.
 OffsetDisplacement offset(int offset)
          Obtain a Displacement with an offset from this Displacement.
 java.lang.String remap()
          Insure that the relocation sequence number is lexically, monotonically increasing in the generated assembly code.
 java.lang.String toString()
           
 Displacement unique()
          Return a unique displacement.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Displacement

public Displacement(int displacement)
Parameters:
displacement - is either a non-relocatable offset or it is a handle.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Keep the count of instances up-to-date.
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable - [needs description]

number

public static int number()
Return the current number of instances of this class.

adjust

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

offset

public OffsetDisplacement offset(int offset)
Obtain a Displacement with an offset from this Displacement.

getDisplacement

public int getDisplacement()
Return the displacement.

isZero

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

isNumeric

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

unique

public Displacement unique()
Return a unique displacement.
See Also:
SymbolDisplacement

remap

public java.lang.String remap()
Insure that the relocation sequence number is lexically, monotonically increasing in the generated assembly code.

assembler

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

toString

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