scale.backend
Class Displacement

java.lang.Object
  extended by scale.backend.Displacement
Direct Known Subclasses:
DiffDisplacement, FloatDisplacement, IntegerDisplacement, LabelDisplacement, OffsetDisplacement, StackDisplacement, SymbolDisplacement

public abstract class Displacement
extends java.lang.Object

This class represents a displacement field in an instruction.

$Id: Displacement.java,v 1.22 2007-09-20 18:57:39 burrill Exp $

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

It is the base class for displacements that are represented symbolicly or as an expression.


Constructor Summary
Displacement()
           
 
Method Summary
 void adjust(int adjustment)
          Adjust the displacement by the specified value.
abstract  java.lang.String assembler(Assembler asm)
          Generate a String representation that can be used by the assembly code generater.
static int created()
          Return the number of instances of this class that were created.
 boolean equivalent(java.lang.Object o)
          Return true if the displacements are equivalent.
 Displacement getBase()
          Return the base of the 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 isSymbol()
          Return true if the displacement is from a symbol.
 boolean isZero()
          Return true if the displacement is zero.
 OffsetDisplacement offset(long offset)
          Obtain a Displacement with an offset from this Displacement.
abstract  Displacement unique()
          Return a unique displacement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Displacement

public Displacement()
Method Detail

created

public static int created()
Return the number of instances of this class that were created.


adjust

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


offset

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


getBase

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


getDisplacement

public long getDisplacement()
Return the displacement.


isStack

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


isZero

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


isNumeric

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


isSymbol

public boolean isSymbol()
Return true if the displacement is from a symbol.


unique

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

See Also:
SymbolDisplacement

assembler

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


equivalent

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