scale.backend
Class SymbolDisplacement

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

public class SymbolDisplacement
extends Displacement

This class represents a displacement field in an instruction when the displacement refers to an offset that must be relocated by the loader.

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

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


Constructor Summary
SymbolDisplacement(java.lang.String name, int handle)
          Create a displacement that the loader can relocate.
SymbolDisplacement(java.lang.String name, int handle, boolean addressTaken)
           
 
Method Summary
 boolean addressTaken()
          Return true if the address of this symbol was taken.
 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.
 int getHandle()
          Return the data area handle associated with the displacement.
 java.lang.String getName()
          Return the symbolic name.
 int getSequence()
          Return the relocation sequence number.
 boolean isSymbol()
          Return true if the displacement is from a symbol.
static void reset()
          Reset the relocation information for each generated assembly language file.
 void setAddressTaken(boolean addressTaken)
          Set that the address of this symbol has been taken.
 java.lang.String toString()
           
 Displacement unique()
          Return a unique displacement.
static int used()
          Return the relocation sequence number.
 
Methods inherited from class scale.backend.Displacement
adjust, created, getBase, getDisplacement, isNumeric, isStack, isZero, offset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SymbolDisplacement

public SymbolDisplacement(java.lang.String name,
                          int handle)
Create a displacement that the loader can relocate.

Parameters:
name - is the symbol's name
handle - is information associated with the displacement for use by the code generator.

SymbolDisplacement

public SymbolDisplacement(java.lang.String name,
                          int handle,
                          boolean addressTaken)
Method Detail

used

public static int used()
Return the relocation sequence number.


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

setAddressTaken

public void setAddressTaken(boolean addressTaken)
Set that the address of this symbol has been taken. In other words, it may be aliased.


addressTaken

public boolean addressTaken()
Return true if the address of this symbol was taken.


reset

public static void reset()
Reset the relocation information for each generated assembly language file.


getSequence

public int getSequence()
Return the relocation sequence number.


getName

public java.lang.String getName()
Return the symbolic name.


getHandle

public int getHandle()
Return the data area handle associated with the displacement.


isSymbol

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

Overrides:
isSymbol 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