Client Defined Constants
MLRISC allows the client to inject abstract
constants that are resolved
only at the end of the compilation phase into the instruction stream.
These constants can be used whereever an integer literal is expected.
Typical usage are stack frame offsets for spill locations which are only
known after register allocation,
and garbage collection and exception map which are resolved only
when all address calculation are performed.
Client defined constants should satsify the following signature:
signature CONSTANT = sig
val toString : const -> string
val valueOf : const -> int
val hash : const -> word
val == : const * const -> bool
The methods are:
The method toString should be implemented in all cases.
The method valueOf is necessary only if machine code generation
is used. The last two methods, hash and == are necessary
only if SSA optimizations are used.
- a pretty printing function
- returns the value of the constant
- returns the hash value of the constant
- compare two constants for identity
Last modified: Thu Jan 9 19:38:15 EST 2003 by leunga@slinky