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/span-dep.tex
ViewVC logotype

View of /sml/trunk/src/MLRISC/Doc/latex/span-dep.tex

Parent Directory Parent Directory | Revision Log Revision Log

Revision 547 - (download) (as text) (annotate)
Fri Feb 25 23:54:34 2000 UTC (20 years, 8 months ago) by leunga
File size: 4388 byte(s)

New documentation files for MLRISC.  This version includes MLTREE extensions.
\section{Span Dependency Resolution} \label{sec:span-dep}

The span dependency resolution phase is used to resolve the values of
client defined \href{constants.html}{constants} and \href{labels.html}{labels}
in a program.  An instruction whose immediate operand field contains a
constant or \href{labexp.html}{label expression} which
is too large is rewritten into a sequence of instructions to compute
the same result.  Similarly, short branches referencing labels that are 
too far are rewritten into the long form.   For architectures
that require the filling of delay slots, this is performed at the same
time as span depedency resolution, to ensure maximum benefit results.

\subsubsection{The Interface}

The signature \sml{SDI_JUMPS} describes
architectural information about span dependence resolution.

signature \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS} = sig
  structure I : \href{instructions.html}{INSTRUCTIONS}
  structure C : \href{cells.html}{CELLS}
    sharing I.C = C

  val branchDelayedArch : bool
  val isSdi : I.instruction -> bool
  val minSize : I.instruction -> int
  val maxSize : I.instruction -> int
  val sdiSize : I.instruction * (C.cell -> C.cell)
                              * (Label.label -> int) * int -> int
  val expand : I.instruction * int * int -> I.instruction list

The components in this interface are:
  \item[branchDelayedArch] A flag indicating whether the architecture
contains delay slots.  For example, this would be true on the MIPS,
Sparc, PA RISC; but would be false on the x86 and on the Alpha.
   \item[isSdi] This function returns true if the instruction is 
\newdef{span dependent}, i.e.~its size depends either on some unresolved
constants, or on its position in the code stream.
   \item[sdiSize]  This function takes a span dependent instruction, 
a \href{regmap.html}{regmap},
a mapping from labels to code stream position, and 
its current code stream position and returns the size of its
expansion in bytes.
   \item[expand] This function takes a span dependent instruction,
its size, and its location and return its expansion.

The signature \sml{BBSCHED} is the signature of the phase that performs
span depedennce resolution and code generation.
signature \mlrischref{backpatch/bbsched.sig}{BBSCHED} = sig
  structure F : \href{cluster.html}{FLOWGRAPH}

  val bbsched : F.cluster -> unit
  val finish : unit -> unit
  val cleanUp : unit -> unit

\subsubsection{The Modules}

Three different functors are present in the \MLRISC{} system for
performing span dependence resolution and code generator.
Functor \sml{BBSched2} is the simplest one, which does not perform
delay slot filling.
functor BBSched2
  (structure Flowgraph : \mlrischref{cluster/flowgraph.sig}{FLOWGRAPH}
   structure Jumps : \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS}
   structure Emitter : \href{mc.html}{INSTRUCTION_EMITTER}
     sharing Emitter.P = Flowgraph.P
     sharing Flowgraph.I = Jumps.I = Emitter.I

Functor \sml{SpanDependencyResolution} performs both span dependence
resolution and delay slot filling at the same time.
functor SpanDependencyResolution
  (structure Flowgraph : \mlrischref{cluster/flowgraph.sig}{FLOWGRAPH}
   structure Emitter : \href{mc.html}{INSTRUCTION_EMITTER}
   structure Jumps : \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS}
   structure DelaySlot : \href{delayslots.html}{DELAY_SLOT_PROPERTIES}
   structure Props : \mlrischref{instructions/insnProps.sig}{INSN_PROPERTIES}
     sharing Flowgraph.P = Emitter.P
     sharing Flowgraph.I = Jumps.I = DelaySlot.I = Props.I = Emitter.I
  ) : BBSCHED 

Finally, functor \sml{BackPatch} is a span dependency resolution
module specially written for the \href{x86.html}{x86} architecture.
functor BackPatch
  (structure CodeString : \mlrischref{emit/code-string.sig}{CODE_STRING}
   structure Jumps: \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS}
   structure Props : \mlrischref{instructions/insnProps.sig}{INSN_PROPERTIES}
   structure Emitter : \mlrischref{backpatch/vlBatchPatch.sig}{MC_EMIT}
   structure Flowgraph : \href{cluster.html}{FLOWGRAPH}
   structure Asm : \href{asm.html}{INSTRUCTION_EMITTER}
      sharing Emitter.I = Jumps.I = Flowgraph.I = Props.I = Asm.I) : BBSCHED 

ViewVC Help
Powered by ViewVC 1.0.0