|
|
Client Defined Constants
Introduction
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.
The Details
Client defined constants should satsify the following signature:
signature CONSTANT = sig
type const
val toString : const -> string
val valueOf : const -> int
val hash : const -> word
val == : const * const -> bool
end
The methods are:
-
toString
- a pretty printing function
-
valueOf
- returns the value of the constant
-
hash
- returns the hash value of the constant
-
==
- compare two constants for identity
-
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.
|
|
Generated by
mltex2html
|
Last modified: Mon Jun 8 14:18:05 UTC 2009 by buildd@vernadsky
|
|