Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/MLRISC/Doc/latex/constants.tex
ViewVC logotype

View of /sml/trunk/src/MLRISC/Doc/latex/constants.tex

Parent Directory Parent Directory | Revision Log Revision Log

Revision 651 - (download) (as text) (annotate)
Thu Jun 1 18:34:03 2000 UTC (20 years, 3 months ago) by monnier
File size: 1310 byte(s)
bring revisions from the vendor branch to the trunk
\section{Client Defined Constants}
MLRISC allows the client to inject abstract 
\newdef{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.

\subsubsection{The Details}
Client defined constants should satsify the following signature:
signature \mlrischref{instructions/constant.sig}{CONSTANT} = sig
   type const

   val toString : const -> string
   val valueOf  : const -> int
   val hash     : const -> word
   val ==       : const * const -> bool

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 \sml{toString} should be implemented in all cases.
The method \sml{valueOf} is necessary only if machine code generation
is used.  The last two methods, \sml{hash} and \sml{==} are necessary
only if SSA optimizations are used.

ViewVC Help
Powered by ViewVC 1.0.0