diff -r -u a/latex/annotations.tex b/latex/annotations.tex --- a/latex/annotations.tex 2018-05-16 17:50:53.851446532 +0300 +++ b/latex/annotations.tex 2018-05-16 19:07:55.673342303 +0300 @@ -30,4 +30,4 @@ recognized by the core system. This signature is \mlrischref{instructions/mlriscAnnotations.sig}{MLRISC\_ANNOTATIONS}. More detailed documentation can be found in this -\href{http://cm.bell-labs.com/cm/cs/what/smlnj/compiler-notes/annotations.ps}{paper}. +\localhref{http://cm.bell-labs.com/cm/cs/what/smlnj/compiler-notes/annotations.ps}{paper}. diff -r -u a/latex/asm.tex b/latex/asm.tex --- a/latex/asm.tex 2018-05-16 17:50:50.284822156 +0300 +++ b/latex/asm.tex 2018-05-16 19:08:33.256235173 +0300 @@ -7,10 +7,10 @@ \begin{SML} signature INSTRUCTION_EMITTER = sig - structure I : \href{instructions.html}{INSTRUCTIONS} - structure C : \href{cells.html}{CELLS} - structure S : \href{streams.html}{INSTRUCTION_STREAM} - structure P : \href{pseudo-ops.html}{PSEUDO_OPS} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure C : \localhref{cells.html}{CELLS} + structure S : \localhref{streams.html}{INSTRUCTION_STREAM} + structure P : \localhref{pseudo-ops.html}{PSEUDO_OPS} sharing I.C = C sharing S.P = P @@ -49,7 +49,7 @@ \subsubsection{More Details} Assemblers are automatically generated by the -\href{mlrisc-md.html}{MDGen} tool. Some specific generated +\localhref{mlrisc-md.html}{MDGen} tool. Some specific generated assemblers are listed below: \begin{enumerate} \item \mlrischref{sparc/emit/sparcAsm.sml}{Sparc} diff -r -u a/latex/availability.tex b/latex/availability.tex --- a/latex/availability.tex 2018-05-16 17:50:49.151502261 +0300 +++ b/latex/availability.tex 2018-05-16 19:08:57.709281902 +0300 @@ -12,7 +12,7 @@ \externhref{http://cm.bell-labs.com/cm/cs/what/smlnj/software.html}{SML/NJ software page} as part of the SML/NJ compiler releases. These versions are relative stable, but do not include the entire MLRISC source tree. -\item \href{mailto:leunga@cs.nyu.edu}{Allen} +\item \localhref{mailto:leunga@cs.nyu.edu}{Allen} keeps an up-to-date version of MLRISC at NYU for private use. This version includes everything but is under constant changes, so beware! To access the CVS repository, set your \sml{CVSROOT} environment variable @@ -27,7 +27,7 @@ The password to use is \sml{mlrisc}. \item Generally speaking, you can get the latest version of MLRISC by asking -\href{mailto:george@research.bell-labs.com}{Lal}. +\localhref{mailto:george@research.bell-labs.com}{Lal}. \end{enumerate} MLRISC is \newdef{free, open source} software, and is released under the -\href{http://cm.bell-labs.com/cm/cs/what/smlnj/license.html}{SML/NJ license}. +\localhref{http://cm.bell-labs.com/cm/cs/what/smlnj/license.html}{SML/NJ license}. diff -r -u a/latex/cells.tex b/latex/cells.tex --- a/latex/cells.tex 2018-05-16 17:50:49.314833658 +0300 +++ b/latex/cells.tex 2018-05-16 19:09:11.865782638 +0300 @@ -20,7 +20,7 @@ \item \sml{MEM} -- memory \item \sml{CTRL} -- control dependence \end{itemize} - \item \sml{regmap} -- \href{regmap.html}{register map} + \item \sml{regmap} -- \localhref{regmap.html}{register map} \item \sml{cellset} -- a cellset represent a set of cells. This type can be used to denote live-in/live-out information. Cellsets are implemented as immutable abstract types. diff -r -u a/latex/cluster.tex b/latex/cluster.tex --- a/latex/cluster.tex 2018-05-16 17:50:48.014849072 +0300 +++ b/latex/cluster.tex 2018-05-16 19:09:32.742204600 +0300 @@ -8,10 +8,10 @@ Its signature is: \begin{SML} signature FLOWGRAPH = sig - structure C : \href{cells.html}{CELLS} - structure I : \href{instructions.html}{INSTRUCTIONS} - structure P : \href{pseudo-ops.html}{PSEUDO_OPS} - structure W : \href{freq.html}{FREQ} + structure C : \localhref{cells.html}{CELLS} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure P : \localhref{pseudo-ops.html}{PSEUDO_OPS} + structure W : \localhref{freq.html}{FREQ} sharing I.C = C datatype block = @@ -46,8 +46,8 @@ \end{SML} Clusters are used in -\href{span-dep.html}{span dependency resolution}, -\href{delayslots.html}{delay slot filling}, -\href{asm.html}{assembly}, -and \href{mc.html}{machine code} +\localhref{span-dep.html}{span dependency resolution}, +\localhref{delayslots.html}{delay slot filling}, +\localhref{asm.html}{assembly}, +and \localhref{mc.html}{machine code} output, since these phases require the code laid out in linearized form. diff -r -u a/latex/compiler-graphs.tex b/latex/compiler-graphs.tex --- a/latex/compiler-graphs.tex 2018-05-16 17:50:47.951516490 +0300 +++ b/latex/compiler-graphs.tex 2018-05-16 19:09:57.595246601 +0300 @@ -6,8 +6,8 @@ Mostly of these algorithms are parameterized with respect to the actual intermediate representation, and as such they do not provide many facilities that are provided by higher abstraction -layers, such as in \href{mlrisc-ir.html}{MLRISC IR}, -or in \href{SSA.html}{SSA}. +layers, such as in \localhref{mlrisc-ir.html}{MLRISC IR}, +or in \localhref{SSA.html}{SSA}. \subsubsection{Dominator/Post-dominator Trees} \newdef{Dominance} diff -r -u a/latex/contributions.tex b/latex/contributions.tex --- a/latex/contributions.tex 2018-05-16 17:50:46.251536647 +0300 +++ b/latex/contributions.tex 2018-05-16 19:10:13.328395499 +0300 @@ -2,7 +2,7 @@ The optimizations provided by MLRISC are at a similar level to those performed by the Impact compiler; several target back ends exist (Dec Alpha, HPPA, Sparc, x86, and PPC); but more importantly, the - framework has been demonstrated in \href{systems.html}{real use} + framework has been demonstrated in \localhref{systems.html}{real use} for languages with radically different execution models. These include: \begin{center} diff -r -u a/latex/freq.tex b/latex/freq.tex --- a/latex/freq.tex 2018-05-16 17:50:44.638222443 +0300 +++ b/latex/freq.tex 2018-05-16 19:10:25.701583781 +0300 @@ -4,4 +4,4 @@ estimates provided by the front-end. These can be in the form of explicit vertex and edge frequencies, in the form of branch probabilities, or a combination of the above. Frequency information can be propagated -to the backend via the \href{annotations.html}{annotations} mechanism. +to the backend via the \localhref{annotations.html}{annotations} mechanism. diff -r -u a/latex/gc.tex b/latex/gc.tex --- a/latex/gc.tex 2018-05-16 17:50:43.691567002 +0300 +++ b/latex/gc.tex 2018-05-16 19:10:38.741430909 +0300 @@ -62,13 +62,13 @@ value in the program with a \newdef{gc type}, which is used to specify the abstract object representation, and the constraints on code motion that may be applied to such a value. -The front-end uses an architecture independent \href{mltree.html}{RTL} +The front-end uses an architecture independent \localhref{mltree.html}{RTL} language for representing the program, thus this annotation phase is portable between target architectures. \item[GC constraints propagation] After instruction selection, gc constraint are propagated throughout the machine level program representation. Again, for portability, gc typing -rules are specified in terms of the \href{mltree.html}{ RTL } of +rules are specified in terms of the \localhref{mltree.html}{ RTL } of the machine instructions. In this phase, unsafe code motions which exposes unrecoverable derived values to gc safepoints are automatically identified. (Pseudo) control dependence and anti-control dependence diff -r -u a/latex/graphs.tex b/latex/graphs.tex --- a/latex/graphs.tex 2018-05-16 17:50:42.278250426 +0300 +++ b/latex/graphs.tex 2018-05-17 12:25:02.296606895 +0300 @@ -877,10 +877,10 @@ \begin{wrapfigure}{r}{3in} \begin{Boxit} - \psfig{figure=../pictures/eps/trace.eps,width=2.8in} + \includegraphics[width=2.8in]{../pictures/pdf/trace.pdf} \end{Boxit} - \label{fig:trace-view} \caption{A trace view} + \label{fig:trace-view} \end{wrapfigure} A \newdef{trace} is an acyclic path in a graph. The function \sml{trace_view} takes a trace of node ids @@ -910,10 +910,10 @@ \end{SML} \begin{wrapfigure}{r}{3in} \begin{Boxit} - \psfig{figure=../pictures/eps/subgraph.eps,width=2.8in} + \includegraphics[width=2.8in]{../pictures/pdf/subgraph.pdf} \end{Boxit} - \label{fig:acyclic-subgraph-view} \caption{An acyclic subgraph} + \label{fig:acyclic-subgraph-view} \end{wrapfigure} The function \sml{acyclic_view} takes an ordered list of node ids $v_1,\ldots,v_n$ and a graph $G$ as arguments @@ -996,8 +996,8 @@ do_after_set_exits : (node_id list -> unit) -> ('n,'e,'g) graph -> ('n,'e,'g) graph \end{SML} \end{boxit} -\label{fig:behavioral-view-primitives} \caption{Behavioral view primitives} +\label{fig:behavioral-view-primitives} \end{Figure} Frequently it is not necessary to know precisely by which method a graph's diff -r -u a/latex/instrsel.tex b/latex/instrsel.tex --- a/latex/instrsel.tex 2018-05-16 17:50:39.851612533 +0300 +++ b/latex/instrsel.tex 2018-05-16 19:11:07.491093849 +0300 @@ -1,6 +1,6 @@ \section{Instruction Selection} \label{sec:instrsel} Instruction selection modules are reponsible for translating -\href{mltree.html}{MLTree} statements into a flowgraph consisting +\localhref{mltree.html}{MLTree} statements into a flowgraph consisting of target machine instructions. MLRISC decomposes this complex task into \emph{three} components: \begin{description} @@ -14,16 +14,16 @@ \end{description} By detaching these components, extra flexiblity is obtained. For example, the MLRISC system uses two different internal representations. The -first, \href{cluster.html}{cluster}, is a \emph{light-weight} representation +first, \localhref{cluster.html}{cluster}, is a \emph{light-weight} representation which is suitable for simple compilers without extensive -optimizations; the second, \href{mlrisc-ir.html}{MLRISC IR}, is a +optimizations; the second, \localhref{mlrisc-ir.html}{MLRISC IR}, is a \emph{heavy duty} representation which allows very complex transformations to be performed. Since the flowgraph builders are detached from the instruction selection modules, the same instruction selection modules can be used for both representations. For consistency, the three components communicate to each other -via the same \href{stream.html}{stream} interface. +via the same \localhref{stream.html}{stream} interface. \subsection{Interface Definition} All instruction selection modules satisfy the following signature: @@ -31,10 +31,10 @@ \begin{SML} signature \mlrischref{mltree/mltreecomp.sig}{MLTREECOMP} = sig - structure T : \href{mltree.html}{MLTREE} - structure I : \href{instructions.html}{INSTRUCTIONS} - structure C : \href{cells.html}{CELLS} - sharing T.LabelExp = I.\href{labelexp.html}{LabelExp} + structure T : \localhref{mltree.html}{MLTREE} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure C : \localhref{cells.html}{CELLS} + sharing T.LabelExp = I.\localhref{labelexp.html}{LabelExp} sharing I.C = C type instrStream = (I.instruction,C.regmap,C.cellset) T.stream @@ -56,10 +56,10 @@ \begin{SML} signature \mlrischref{mltree/mltreecomp.sig}{MLTREE_EXTENSION_COMP} = sig - structure T : \href{mltree.html}{MLTREE} - structure I : \href{instructions.html}{INSTRUCTIONS} - structure C : \href{cells.html}{CELLS} - sharing T.LabelExp = I.\href{labelexp.html}{LabelExp} + structure T : \localhref{mltree.html}{MLTREE} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure C : \localhref{cells.html}{CELLS} + sharing T.LabelExp = I.\localhref{labelexp.html}{LabelExp} sharing I.C = C type reducer = diff -r -u a/latex/instructions.tex b/latex/instructions.tex --- a/latex/instructions.tex 2018-05-16 17:50:38.611627236 +0300 +++ b/latex/instructions.tex 2018-05-16 19:11:20.930936273 +0300 @@ -7,9 +7,9 @@ \begin{SML} signature INSTRUCTIONS = sig - structure C : \href{cells.html}{CELLS} - structure Constant : \href{constants.html}{CONSTANT} - structure LabelExp : \href{labelexp.html}{LABELEXP} + structure C : \localhref{cells.html}{CELLS} + structure Constant : \localhref{constants.html}{CONSTANT} + structure LabelExp : \localhref{labelexp.html}{LABELEXP} sharing LabelExp.Constant = Constant type operand diff -r -u a/latex/INTRO.tex b/latex/INTRO.tex --- a/latex/INTRO.tex 2018-05-16 17:50:55.554759668 +0300 +++ b/latex/INTRO.tex 2018-05-17 12:54:21.908893514 +0300 @@ -7,20 +7,20 @@ \begin{center} \begin{tabular}{cc} \begin{address} - \href{mailto:george@research.bell-labs.com}{Lal George} + \localhref{mailto:george@research.bell-labs.com}{Lal George} \end{address} & \begin{address} - \href{mailto:leunga@cs.nyu.edu}{ Allen Leung} + \localhref{mailto:leunga@cs.nyu.edu}{ Allen Leung} \end{address} \\ Bell Labs & New York University \\ \end{tabular} \end{center} \begin{center} -\image{MLRISC logo}{pictures/png/uncol.png}{align="middle"} +\image{MLRISC logo}{pictures/png/uncol.png}{align=middle} \begin{Italics} - \href{contributors.html}{Contributors} + \localhref{contributors.html}{Contributors} \end{Italics} \end{center} @@ -45,4 +45,4 @@ the latter part of the document is incomplete but it may still be useful. These pages are also available in -\href{../latex/mlrisc.ps}{tech report} form. +\localhref{../latex/mlrisc.ps}{tech report} form. diff -r -u a/latex/labelexp.tex b/latex/labelexp.tex --- a/latex/labelexp.tex 2018-05-16 17:50:38.418296195 +0300 +++ b/latex/labelexp.tex 2018-05-16 19:11:36.514086896 +0300 @@ -2,7 +2,7 @@ A \newdef{label expression} is a constant expression defined in terms of labels, or user -defined \href{constants.html}{constants}. MLRISC uses the type +defined \localhref{constants.html}{constants}. MLRISC uses the type \sml{labexp} to represent label expressions. Label expressions are defined in the structure \mlrischref{instructions/labelExp.sml}{LabelExp}. @@ -33,7 +33,7 @@ \end{itemize} The type \sml{labexp} is depends on client defined -\href{constants.html}{constants} typed. The functor \sml{LabelExp} +\localhref{constants.html}{constants} typed. The functor \sml{LabelExp} is parameterized as follows. \begin{SML} functor \mlrischref{instructions/labelExp.sml}{LabelExp}(Constant : \mlrischref{instructions/constant.sig}{CONSTANT}) diff -r -u a/latex/labels.tex b/latex/labels.tex --- a/latex/labels.tex 2018-05-16 17:50:37.531640042 +0300 +++ b/latex/labels.tex 2018-05-16 19:11:46.233972928 +0300 @@ -22,4 +22,4 @@ with a label \end{itemize} -See also \href{labelexp.html}{Label Expressions}. +See also \localhref{labelexp.html}{Label Expressions}. diff -r -u a/latex/Makefile b/latex/Makefile --- a/latex/Makefile 2018-05-16 17:50:53.054789312 +0300 +++ b/latex/Makefile 2018-05-17 14:47:26.632636015 +0300 @@ -1,52 +1,9 @@ -# -# This file compiles the documentation -# - -TEX= sml.tex mlrisc.tex mltexdoc.tex -DVI= $(TEX:.tex=.dvi) -PS= $(TEX:.tex=.ps) -PDF= $(TEX:.tex=.pdf) - -all: pictures $(DVI) $(PS) - +PDF=sml.pdf mlrisc.pdf mltexdoc.pdf +.PHONY: clean pictures +all: pictures $(PDF) pictures: - (cd ../pictures; make) - -again: cleandvi bib - make - -cleandvi: - rm -f $(TEX:.tex=.dvi) - -bib: - for f in $(TEX:.tex=) ; do bibtex $$f; done - -pdf: $(PDF) - -%.dvi: %.tex sml.sty mltex.sty - latex $(@:.dvi=.tex) - -%.ps: %.dvi - dvips -D 600 -t letter $(@:.ps=.dvi) -o - -%.pdf: %.ps - ps2pdf $< - -mlrisc.dvi: annotations.tex graphics.tex instructions.tex mltree.tex \ - delayslots.tex cells.tex cluster.tex constants.tex \ - pseudo-ops.tex streams.tex labelexp.tex labels.tex regions.tex \ - regmap.tex graphs.tex mlrisc-ir.tex compiler-graphs.tex \ - SSA.tex VLIW.tex ra.tex ILP.tex mlrisc-arch.tex \ - future-work.tex asm.tex mc.tex instrsel.tex \ - availability.tex gc.tex mlrisc-gen.tex contributions.tex \ - systems.tex mlrisc-graphics.tex contributors.tex \ - requirements.tex INTRO.tex problem.tex mlrisc-compiler.tex \ - mlrisc-ir-rep.tex backend-opt.tex sys-integration.tex \ - optimizations.tex span-dep.tex mlrisc-md.tex line-counts.tex \ - sparc.tex alpha.tex x86.tex ppc.tex mips.tex hppa.tex C6.tex \ - mltree-ext.tex mltree-util.tex - -mltexdoc.dvi: mltex.tex - -clean: - /bin/rm -f $(DVI) *.aux *.log *.bbl *.blg + $(MAKE) -C ../pictures +%.pdf: %.tex pictures sml.sty mltex.sty + latexmk -pdf $< +clean: + latexmk -C diff -r -u a/latex/mc.tex b/latex/mc.tex --- a/latex/mc.tex 2018-05-16 17:50:36.138323229 +0300 +++ b/latex/mc.tex 2018-05-16 19:12:13.030325390 +0300 @@ -11,10 +11,10 @@ signature INSTRUCTION_EMITTER = sig - structure I : \href{instructions.html}{INSTRUCTIONS} - structure C : \href{cells.html}{CELLS} - structure S : \href{streams.html}{INSTRUCTION_STREAM} - structure P : \href{pseudo-ops.html}{PSEUDO_OPS} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure C : \localhref{cells.html}{CELLS} + structure S : \localhref{streams.html}{INSTRUCTION_STREAM} + structure P : \localhref{pseudo-ops.html}{PSEUDO_OPS} sharing I.C = C sharing S.P = P @@ -42,7 +42,7 @@ \subsubsection{More Details} Machine code emitters are automatically generated by the -\href{mlrisc-md.html}{MDGen} tool. Some specific generated +\localhref{mlrisc-md.html}{MDGen} tool. Some specific generated emitters are listed below: \begin{enumerate} \item \mlrischref{sparc/emit/sparcMC.sml}{Sparc} diff -r -u a/latex/md.tex b/latex/md.tex --- a/latex/md.tex 2018-05-16 17:50:36.394986852 +0300 +++ b/latex/md.tex 2018-05-16 21:54:12.798141891 +0300 @@ -14,20 +14,20 @@ the properties of the register set and (some part of) memory hierarchy. \item \codehref{instructions/instructions.sig}{INSTRUCTIONS} -- the concrete instruction set representation. - \item \codehref{instructions/insnProps.sig}{INSNS_PROPERTIES} -- + \item \codehref{instructions/insnProps.sig}{INSNS\_PROPERTIES} -- properties of the instructions. - \item \codehref{instructions/shuffle.sig}{SHUFFLE} -- + \item \codehref{instructions/shuffle.sig}{SHUFFLE} -- methods to emit linearized code from parallel copies. \item \codehref{emit/instruction-emitter.sig}{ASSEMBLER} -- the assembler \item \codehref{emit/instruction-emitter.sig}{MC} -- the machine code emitter - \item \codehref{../backpatch/sdi-jumps.sig}{ SDI_JUMPS } -- + \item \codehref{../backpatch/sdi-jumps.sig}{SDI\_JUMPS} -- methods for resolving span-dependent instructions. - \item DELAY_SLOTS_PROPERTIES - -- machine properties for delay slot filling, if a machine - architecture contains branch delay slots or load delay slots. - \item \codehref{../SSA/ssaProps.sig}{ SSA_PROPERTIES } -- + \item \codehref{../backpatch/delaySlotProps.sig}{DELAY\_SLOTS\_PROPERTIES} -- + machine properties for delay slot filling, if a machine + architecture contains branch delay slots or load delay slots. + \item \codehref{../SSA/ssaProps.sig}{SSA\_PROPERTIES} -- semantics properties for performing optimizations in Static Single Assignment form. \end{itemize} @@ -56,11 +56,10 @@ required by the MLRISC system. The basic concepts of MDGen are inspired largely from -Norman Ramsey's -New Jersey Machine Code Tool Kit and +Norman Ramsey's \externhref{http://www.cs.virginia.edu/~nr/toolkit} +{New Jersey Machine Code Tool Kit} and Ramsey and Davidson's - -Lambda RTL +\externhref{http://www.cs.virginia.edu/zephyr/csdl/lrtlindex.html}{Lambda RTL}. \subsection{A Sample Description} @@ -71,21 +70,19 @@ \begin{SML} architecture Alpha = - struct - +struct name "Alpha" - superscalar - little endian + lowercase assembly +end +\end{SML} - lowercase assembly +\ref{subsubsec:cells} Storage cells and locations. - \href{#cells}{Storage cells and locations} - \href{#encoding}{Instruction encoding formats specification} - \href{#instruction}{Instruction definition} -end -\end{SML} +\ref{subsubsec:encoding} Instruction encoding formats specification. + +\ref{subsubsec:instruction} Instruction definition. Here, we declare that the Alpha is a superscalar machine using little endian encoding. Furthermore, assembly output should be displayed @@ -94,15 +91,15 @@ -\subsubsection{ Specifying Storage Cells and Locations } +\subsubsection{Specifying Storage Cells and Locations} \label{subsubsec:cells} -A cell is an abstract resource location +A \newdef{cell} is an abstract resource location for holding data values. On typical machines, the types of cells include general purpose registers, floating point registers, and condition code registers. The \sml{storage} declaration defines different -cellkinds. MLRISC requires the +\newdef{cellkinds}. MLRISC requires the cellkinds \sml{GP}, \sml{FP}, \sml{CC} to be defined. These are the cellkinds for general purpose registers, floating point registers and condition code registers. @@ -126,50 +123,48 @@ assembly temporary etc. \end{itemize} - \begin{SML} - storage - GP = 32 cells of 64 bits in cellset called "register" - assembly as (fn 30 => "$sp" + storage + GP = 32 cells of 64 bits in cellset called "register" + assembly as (fn 30 => "$sp" | r => "$"^Int.toString r) - | FP = 32 cells of 64 bits in cellset called "floating point register" - assembly as (fn f => "f"^Int.toString f) - | CC = cells of 64 bits in cellset GP called "condition code register" - assembly as "cc" - locations - stackptrR = $GP[30] - and asmTmpR = $GP[28] - and fasmTmp = $FP[30] - and GPReg r = $GP[r] - and FPReg f = $GP[f] + | FP = 32 cells of 64 bits in cellset called "floating point register" + assembly as (fn f => "f"^Int.toString f) + | CC = cells of 64 bits in cellset GP called "condition code register" + assembly as "cc" + locations + stackptrR = $GP[30] + and asmTmpR = $GP[28] + and fasmTmp = $FP[30] + and GPReg r = $GP[r] + and FPReg f = $GP[f] \end{SML} -

- Specifying the Representation of Instructions

+\subsubsection{Specifying the Representation of Instructions} \label{subsubsec:instruction} \begin{SML} - structure Instruction = - struct - datatype ea = - Direct of $GP - | FDirect of $FP - | Displace of {base: $GP, disp:int} - - datatype operand = - REGop of $GP ``'' (GP) - | IMMop of int ``'' - | HILABop of LabelExp.labexp ``hi()'' - | LOLABop of LabelExp.labexp ``lo()'' - | LABop of LabelExp.labexp ``'' - | CONSTop of Constant.const ``'' + structure Instruction = + struct + datatype ea = + Direct of $GP + | FDirect of $FP + | Displace of {base: $GP, disp:int} + + datatype operand = + REGop of $GP ``'' (GP) + | IMMop of int ``'' + | HILABop of LabelExp.labexp ``hi()'' + | LOLABop of LabelExp.labexp ``lo()'' + | LABop of LabelExp.labexp ``'' + | CONSTop of Constant.const ``'' (* - * When I say ! after the datatype name XXX, it means generate a + * When I say ! after the datatype name XXX, it means generate a * function emit_XXX that converts the constructors into the corresponding * assembly text. By default, it uses the same name as the constructor, * but may be modified by the lowercase/uppercase assembly directive. * *) - datatype branch! = + datatype branch! = BR 0x30 | BSR 0x34 | BLBC 0x3 @@ -177,18 +172,18 @@ | BLBS 0x3c | BNE 0x3d | BGE 0x3e | BGT 0x3f - datatype fbranch! = + datatype fbranch! = FBEQ 0x31 | FBLT 0x32 | FBLE 0x33 | FBNE 0x35 | FBGE 0x36 | FBGT 0x37 - datatype load! = LDL 0x28 | LDL_L 0x2A | LDQ 0x29 | LDQ_L 0x2B | LDQ_U 0x0B - datatype store! = STL 0x2C | STQ 0x2D | STQ_U 0x0F - datatype fload[0x20..0x23]! = LDF | LDG | LDS | LDT - datatype fstore[0x24..0x27]! = STF | STG | STS | STT + datatype load! = LDL 0x28 | LDL_L 0x2A | LDQ 0x29 | LDQ_L 0x2B | LDQ_U 0x0B + datatype store! = STL 0x2C | STQ 0x2D | STQ_U 0x0F + datatype fload[0x20..0x23]! = LDF | LDG | LDS | LDT + datatype fstore[0x24..0x27]! = STF | STG | STS | STT (* non-trapping opcodes *) - datatype operate! = (* table C-5 *) + datatype operate! = (* table C-5 *) ADDL (0wx10,0wx00) | ADDQ (0wx10,0wx20) | CMPBGE(0wx10,0wx0f) | CMPEQ (0wx10,0wx2d) | CMPLE (0wx10,0wx6d) | CMPLT (0wx10,0wx4d) | CMPULE (0wx10,0wx3d) @@ -219,14 +214,14 @@ (* conditional moves *) - datatype pseudo_op! = DIVL | DIVLU + datatype pseudo_op! = DIVL | DIVLU - datatype operateV! = (* table C-5 opc/func *) + datatype operateV! = (* table C-5 opc/func *) ADDLV (0wx10,0wx40) | ADDQV (0wx10,0wx60) | SUBLV (0wx10,0wx49) | SUBQV (0wx10,0wx69) | MULLV (0wx13,0wx00) | MULQV (0wx13,0wx60) - datatype foperate! = (* table C-6 *) + datatype foperate! = (* table C-6 *) CPYS (0wx17,0wx20) | CPYSE (0wx17,0wx022) | CPYSN (0wx17,0wx021) | CVTLQ (0wx17,0wx010) | CVTQL (0wx17,0wx030) | CVTQLSV (0wx17,0wx530) | CVTQLV (0wx17,0wx130) @@ -238,7 +233,7 @@ | CMPTEQ (0wx16,0wx0a5) | CMPTLT (0wx16,0wx0a6) | CMPTLE (0wx16,0wx0a7) | CMPTUN (0wx16,0wx0a4) - datatype foperateV! = + datatype foperateV! = ADDSSUD 0wx5c0 | ADDTSUD 0wx5e0 | CVTQSC 0wx3c @@ -252,26 +247,24 @@ | SUBSSUD 0wx5c1 | SUBTSUD 0wx5e1 - datatype osf_user_palcode! = + datatype osf_user_palcode! = BPT 0x80 | BUGCHK 0x81 | CALLSYS 0x83 | GENTRAP 0xaa | IMB 0x86 | RDUNIQUE 0x9e | WRUNIQUE 0x9f end (* Instruction *) \end{SML} -

- Specifying the Instruction Encoding Formats

+\subsubsection{Specifying the Instruction Encoding Formats} \label{subsubsec:encoding} The Alpha has very simple instruction encoding formats. - \begin{SML} - instruction formats 32 bits + instruction formats 32 bits Memory{opc:6, ra:5, rb:GP 5, disp: signed 16} (* p3-9 *) (* derived from Memory *) | LoadStore{opc,ra,rb,disp} = - let val disp = - case disp of + let val disp = + case disp of I.REGop rb => emit_GP rb | I.IMMop i => itow i | I.HILABop le => itow(LabelExp.valueOf le) @@ -292,7 +285,7 @@ (* p3-11 *) | Operate1{opc:6,ra:GP 5,lit:signed 13..20,_:1=1,func:5..11,rc:GP 5} | Operate{opc,ra,rb,func,rc} = - (case rb of + (case rb of I.REGop rb => Operate0{opc,ra,rb,func,rc,sbz=0w0} | I.IMMop i => Operate1{opc,ra,lit=itow i,func,rc} | I.HILABop le => Operate1{opc,ra,lit=itow(LabelExp.valueOf le),func,rc} @@ -303,110 +296,108 @@ | Foperate{opc:6,fa:FP 5,fb:FP 5,func:5..15,fc:FP 5} | Pal{opc:6=0,func:26} \end{SML} - \subsubsection{ Specifying the instruction set } - \begin{SML} - structure MC = - struct + structure MC = + struct (* compute displacement address *) - fun disp lab = itow(Label.addrOf lab - !loc - 4) ~>> 0w2 - end + fun disp lab = itow(Label.addrOf lab - !loc - 4) ~>> 0w2 + end (* - * The main instruction set definition consists of the following: - * 1) constructor-like declaration defines the view of the instruction, + * The main instruction set definition consists of the following: + * 1) constructor-like declaration defines the view of the instruction, * 2) assembly directive in funny quotes `` '', * 3) machine encoding expression, * 4) semantics expression in [[ ]], * 5) delay slot directives etc (not necessary in this architecture!) *) - instruction - DEFFREG of $FP (* define a floating point register *) + instruction + DEFFREG of $FP (* define a floating point register *) ``deffreg '' (* Pseudo instruction for the register allocator *) (* Load/Store *) - | LDA of {r: $GP, b: $GP, d:operand} (* use of REGop is illegal *) + | LDA of {r: $GP, b: $GP, d:operand} (* use of REGop is illegal *) ``lda\t, ()'' ILoadStore{opc=0w08,r,b,d} - | LDAH of {r: $GP, b: $GP, d:operand} (* use of REGop is illegal *) + | LDAH of {r: $GP, b: $GP, d:operand} (* use of REGop is illegal *) ``ldah\t, ()'' ILoadStore{opc=0w09,r,b,d} - | LOAD of {ldOp:load, r: $GP, b: $GP, d:operand, mem:Region.region} + | LOAD of {ldOp:load, r: $GP, b: $GP, d:operand, mem:Region.region} ``\t, ()'' ILoadStore{opc=emit_load ldOp,r,b,d} - | STORE of {stOp:store, r: $GP, b: $GP, d:operand, mem:Region.region} + | STORE of {stOp:store, r: $GP, b: $GP, d:operand, mem:Region.region} ``\t, ()'' ILoadStore{opc=emit_store stOp,r,b,d} - | FLOAD of {ldOp:fload, r: $FP, b: $GP, d:operand, mem:Region.region} + | FLOAD of {ldOp:fload, r: $FP, b: $GP, d:operand, mem:Region.region} ``\t, ()'' FLoadStore{opc=emit_fload ldOp,r,b,d} - | FSTORE of {stOp:fstore, r: $FP, b: $GP, d:operand, mem:Region.region} + | FSTORE of {stOp:fstore, r: $FP, b: $GP, d:operand, mem:Region.region} ``\t, ()'' FLoadStore{opc=emit_fstore stOp,r,b,d} (* Control Instructions *) - | JMPL of {r: $GP, b: $GP, d:int} * Label.label list + | JMPL of {r: $GP, b: $GP, d:int} * Label.label list ``jmpl\t, ()'' Jump{opc=0wx1a,h=0w0,ra=r,rb=b,disp=d} (* table C-3 *) - | JSR of {r: $GP, b: $GP, d:int} * C.cellset * C.cellset + | JSR of {r: $GP, b: $GP, d:int} * C.cellset * C.cellset ``jsr\t, ()'' Jump{opc=0wx1a,h=0w1,ra=r,rb=b,disp=d} - | RET of {r: $GP, b: $GP, d:int} + | RET of {r: $GP, b: $GP, d:int} ``ret\t, ()'' Jump{opc=0wx1a,h=0w2,ra=r,rb=b,disp=d} - | BRANCH of branch * $GP * Label.label + | BRANCH of branch * $GP * Label.label `` , - \subsection{ 4 Machine Descriptions } Here are some machine descriptions in varing degree of completion. @@ -439,6 +428,3 @@ \begin{itemize} \item \href{md.vim}{ For vim 5.3 } \end{itemize} - - - diff -r -u a/latex/mlrisc-arch.tex b/latex/mlrisc-arch.tex --- a/latex/mlrisc-arch.tex 2018-05-16 17:50:35.008336628 +0300 +++ b/latex/mlrisc-arch.tex 2018-05-16 19:12:39.570014176 +0300 @@ -5,29 +5,29 @@ The core components of MLRISC allow the client to quickly construct an backend for various architectures. These components include: \begin{itemize} - \item The \href{mltree.html}{MLTREE} language, + \item The \localhref{mltree.html}{MLTREE} language, which is a RTL-like intermediate language that is used by the client to communicate to the MLRISC system. A client is responsible for writing the module that generates MLTREE from the source program representation. - \item \href{instrsel.html}{Instruction selection modules}, + \item \localhref{instrsel.html}{Instruction selection modules}, which generates target machine instructions from MLTREE. - \item The \href{ra.html}{Register Allocator}, + \item The \localhref{ra.html}{Register Allocator}, which performs register allocation. - \item \href{asm.html}{Assemblers}, which emits assembly code. + \item \localhref{asm.html}{Assemblers}, which emits assembly code. \end{itemize} For systems that require direct machine code generation, the following modules are included: \begin{itemize} - \item \href{span-dep.html}{Span dependency resolution} + \item \localhref{span-dep.html}{Span dependency resolution} modules, which compute addresses from symbolic addresses, fill delay slots, and expand instructions that are \newdef{span dependent} - \item \href{mc.html}{Machine code emitters}, + \item \localhref{mc.html}{Machine code emitters}, which emit executable machine code into a binary stream. \end{itemize} @@ -50,19 +50,19 @@ Basic concepts in MLRISC are: \begin{itemize} - \item \href{instructions.html}{Instructions} -- + \item \localhref{instructions.html}{Instructions} -- the instruction set of the target architecture. - \item \href{cells.html}{Cells} -- which describes registers, + \item \localhref{cells.html}{Cells} -- which describes registers, memory and other mutable resources in the machine. - \item \href{regions.html}{Regions} -- a client defined + \item \localhref{regions.html}{Regions} -- a client defined abstract type used to represent aliasing information available from the front-end. - \item \href{constants.html}{Constants} -- a client defined + \item \localhref{constants.html}{Constants} -- a client defined place holder used to represent constants whose values are unknown in the front-end. - \item \href{pseudo-ops.html}{Pseudo Ops} -- a client defined + \item \localhref{pseudo-ops.html}{Pseudo Ops} -- a client defined - \item \href{annotations.html}{Annotations} -- this is + \item \localhref{annotations.html}{Annotations} -- this is a generic mechinism for propagating information in the MLRISC sstem. The client may attach arbitrary annotation of various granularity to MLRISC's program representation, @@ -72,17 +72,17 @@ The same mechanism is also used to propagate analysis information one optimization phase to another. - \item \href{streams.html}{Instruction Streams} -- an abstraction + \item \localhref{streams.html}{Instruction Streams} -- an abstraction for describing a stream of instructions. Instruction streams are used to connect modules such as instruction selection, assembler, machine code emitter, and control flow graph builder. - \item \href{regmap.html}{Regmap} -- a mapping between registers + \item \localhref{regmap.html}{Regmap} -- a mapping between registers names. MLRISC register allocators represent the result of register allocation as a regmap. - \item \href{labels.html}{Labels} -- a type representing + \item \localhref{labels.html}{Labels} -- a type representing symbolic labels. - \item \href{labelexp.html}{Label Expressions} -- a type representing + \item \localhref{labelexp.html}{Label Expressions} -- a type representing constant expressions involving symbolic labels. \end{itemize} @@ -91,12 +91,12 @@ MLRISC uses two different program representations, clusters and MLRISC IR. \begin{itemize} - \item \href{cluster.html}{Cluster} is light-weight representation + \item \localhref{cluster.html}{Cluster} is light-weight representation that is used when only the most basic optimizations are required. - \item \href{mlrisc-ir.html}{MLRISC IR} is more heavy-weight + \item \localhref{mlrisc-ir.html}{MLRISC IR} is more heavy-weight representation that is built from the - \href{graphs.html}{MLRISC graph library} and the - \href{compiler-graphs.html}{MLRISC compiler graph library}. + \localhref{graphs.html}{MLRISC graph library} and the + \localhref{compiler-graphs.html}{MLRISC compiler graph library}. MLRISC IR allows more complex transformations and analysis of the program graph. \end{itemize} @@ -107,7 +107,7 @@ a compiler backend. For example, a minimal backend consists of \begin{itemize} \item the instruction selection module, which translates -\href{mltree.html}{MLTree} into target instructions, +\localhref{mltree.html}{MLTree} into target instructions, \item the flowgraph builder, which conversts a stream of target instructions into a cluster, \item the register allocator, which performs register allocation, and diff -r -u a/latex/mlrisc-gen.tex b/latex/mlrisc-gen.tex --- a/latex/mlrisc-gen.tex 2018-05-16 17:50:33.588353465 +0300 +++ b/latex/mlrisc-gen.tex 2018-05-16 19:12:53.216520812 +0300 @@ -35,12 +35,12 @@ spliced instead. \item The unit of compilation is called a - \href{cluster.html}{cluster} which + \localhref{cluster.html}{cluster} which is the smallest unit for inter-procedural optimizations. A cluster will typically consist of several entry points that may call each other, as well as call local functions in the module. For maximum flexibility, the parameter passing convention for local functions - should be specialized by the \href{mlrisc-ra.html}{register allocator}. + should be specialized by the \localhref{mlrisc-ra.html}{register allocator}. Once the MLRisc trees for a cluster have been built, they must be converted into target assembly or machine code. This is done by diff -r -u a/latex/mlrisc-graphics.tex b/latex/mlrisc-graphics.tex --- a/latex/mlrisc-graphics.tex 2018-05-16 17:50:32.628364847 +0300 +++ b/latex/mlrisc-graphics.tex 2018-05-16 19:13:07.089691452 +0300 @@ -16,14 +16,14 @@ displayed is usually outlined in \begin{color}{blue}blue\end{color}. \begin{description} - \item[\href{graphics/mandelbrot-opt.gif}{Control Flowgraph after Optimization:}] Each basic block is shown with its dynamic profile and + \item[\localhref{graphics/mandelbrot-opt.gif}{Control Flowgraph after Optimization:}] Each basic block is shown with its dynamic profile and code before and after a specific optimization. This view saves having to pour through pages of assembly code listings -- a tedious and frustrating activity. - \item[\href{graphics/mandelbrot-ssa.gif}{SSA form:}] + \item[\localhref{graphics/mandelbrot-ssa.gif}{SSA form:}] The generated flow graph is converted to SSA form which makes many code improvement optimizations easy and efficient. - \item[\href{graphics/mandelbrot-ddg.gif}{Data Dependency Graph}] + \item[\localhref{graphics/mandelbrot-ddg.gif}{Data Dependency Graph}] A graphical view of the data dependency graph and the various kinds of dependencies decorating the edges, provides a useful clue to why instructions got rearranged the way they did. The navigational diff -r -u a/latex/mlrisc-ir-rep.tex b/latex/mlrisc-ir-rep.tex --- a/latex/mlrisc-ir-rep.tex 2018-05-16 17:50:32.498366389 +0300 +++ b/latex/mlrisc-ir-rep.tex 2018-05-16 19:13:16.669579104 +0300 @@ -63,7 +63,7 @@ assemblers to lay out data, jump tables, and perform alignment. \item[Annotations] - \href{annotations.html}{Annotations} are used + \localhref{annotations.html}{Annotations} are used for injecting semantics and other program information from the front-end into the backend. For example, a probability annotation can be attached to a branch instruction. Similarly, line number annotations @@ -106,7 +106,7 @@ variables. This encoding cannot be computed until register allocation has been performed, therefore the integer literal encoding is represented as an abstract - \href{constants.html}{constant}. + \localhref{constants.html}{constant}. Again, in the SML/NJ compiler, most stores are for initializing records in the allocation space, therefore representing every slot in @@ -150,7 +150,7 @@ as an operand to \sml{LDA}. Two instructions may ultimately be required to load the encoding into the \sml{maskReg} register. This expansion is done during - \href{span-dep.html}{span-dependency resolution}. + \localhref{span-dep.html}{span-dependency resolution}. All these examples are intended to indicate that one intermediate representation and optimization suite does not fit diff -r -u a/latex/mlrisc-ir.tex b/latex/mlrisc-ir.tex --- a/latex/mlrisc-ir.tex 2018-05-16 17:50:31.495044952 +0300 +++ b/latex/mlrisc-ir.tex 2018-05-17 12:25:46.459426622 +0300 @@ -187,7 +187,7 @@ representation as the base layer. \begin{wrapfigure}{r}{4.5in} \begin{Boxit} - \psfig{figure=../pictures/eps/mlrisc-IR.eps,width=4.5in} + \includegraphics[width=4.5in]{../pictures/pdf/mlrisc-IR.pdf} \end{Boxit} \caption{The MLRISC IR} \end{wrapfigure} @@ -514,10 +514,10 @@ \end{SML} \begin{Figure} \begin{boxit} -\cpsfig{figure=../pictures/eps/tail-duplication.eps,width=3in} +\includegraphics[width=3in]{../pictures/pdf/tail-duplication.pdf} \end{boxit} -\label{fig:tail-duplication} \caption{Tail-duplication} +\label{fig:tail-duplication} \end{Figure} This function tail-duplicates the region \sml{subgraph} diff -r -u a/latex/mlrisc-md.tex b/latex/mlrisc-md.tex --- a/latex/mlrisc-md.tex 2018-05-16 17:50:31.075049932 +0300 +++ b/latex/mlrisc-md.tex 2018-05-16 19:13:28.479440600 +0300 @@ -658,5 +658,5 @@ \subsection{ Syntax Highlighting Macros } \begin{itemize} - \item \href{md.vim}{For vim 5.3} + \item \localhref{md.vim}{For vim 5.3} \end{itemize} diff -r -u a/latex/mlrisc.tex b/latex/mlrisc.tex --- a/latex/mlrisc.tex 2018-05-16 17:50:23.571805566 +0300 +++ b/latex/mlrisc.tex 2018-05-17 11:54:18.896657515 +0300 @@ -1,4 +1,7 @@ \documentclass{article} +\usepackage{graphicx} +\usepackage{hyperref} +\usepackage[nottoc]{tocbibind} \usepackage{mltex} \usepackage{wrapfig} \usepackage{float} @@ -76,6 +79,8 @@ many components of the system to be customized to fit the source language semantics and runtime system requirements. \end{abstract} + + \newpage \tableofcontents \newpage @@ -84,6 +89,7 @@ \include{contributors} \include{requirements} \include{availability} + \majorsection{Overview} \include{problem} \include{contributions} @@ -111,8 +117,7 @@ \include{mc} \include{delayslots} \include{span-dep} -%\include{md} - +\include{md} \include{graphs} \include{graphics} \include{compiler-graphs} diff -r -u a/latex/mltex.sty b/latex/mltex.sty --- a/latex/mltex.sty 2018-05-16 17:50:20.968503100 +0300 +++ b/latex/mltex.sty 2018-05-17 14:42:29.032902400 +0300 @@ -4,8 +4,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mltex}[2000/2/12 defines mltex environment] +\usepackage{caption} \usepackage{latexsym} -\usepackage{psfig} \usepackage{fancyheadings} \usepackage{sml} \usepackage{color} @@ -19,7 +19,7 @@ \newcommand{\Subsection}[1]{\subsection{#1}} \newcommand{\Subsubsection}[1]{\subsubsection{#1}} \newcommand{\Paragraph}[1]{\paragraph{#1}} -\newcommand{\majorsection}[1]{} +\newcommand{\majorsection}[1]{\part{#1}} % Frames \newsavebox{\savepar} @@ -33,8 +33,12 @@ \newenvironment{Table}[2]{\begin{tabular}{#1}}{\end{tabular}} % Images and Figures -\newcommand{\image}[3]{} -\newcommand{\cpsfig}[1]{\centerline{\psfig{#1}}} +\newcommand{\image}[3]{ +\begin{figure}[h] + \centering\includegraphics[scale=0.2]{../#2} + \caption*{#1} +\end{figure} +} % Formatting \newenvironment{Bold}{\begingroup\bf}{\endgroup} @@ -56,9 +60,10 @@ \newenvironment{address}{}{} % HTML -\newcommand{\href}[2]{#2\footnote{url: \tt #1}} +\newcommand{\localhref}[2]{#2\footnote{url: \tt #1}} \newcommand{\externhref}[2]{#2\footnote{url: \tt #1}} \newcommand{\mlrischref}[2]{\sml{#2}\footnote{{\bf file:} {\tt #1}}} +\newcommand{\codehref}[2]{\sml{#2}\footnote{{\bf file:} {\tt #1}}} \newcommand{\br}[1]{} \newcommand{\hr}{\rule{1em}{\textwidth}} diff -r -u a/latex/mltex.tex b/latex/mltex.tex --- a/latex/mltex.tex 2018-05-16 17:50:19.841849792 +0300 +++ b/latex/mltex.tex 2018-05-16 19:13:40.905961528 +0300 @@ -70,7 +70,7 @@ \item[href] This macro generates a html hypertext link to a page within the same logical document. For example, we can say \begin{verbatim} - \href{url}{text} + \localhref{url}{text} \end{verbatim} \item[mlrischref] This macro generates a html hypertext link to MLRISC code. The general syntax is: @@ -117,4 +117,4 @@ \end{itemize} Please send bug fixes and comments to -\href{mailto:leunga@cs.nyu.edu}{Allen Leung}. +\localhref{mailto:leunga@cs.nyu.edu}{Allen Leung}. diff -r -u a/latex/mltree.tex b/latex/mltree.tex --- a/latex/mltree.tex 2018-05-16 17:50:17.208547682 +0300 +++ b/latex/mltree.tex 2018-05-16 19:14:13.142250107 +0300 @@ -82,9 +82,9 @@ the instruction stream type, and the client defined MLTree extensions. \begin{SML} functor MLTreeF - (structure LabelExp : \href{labelexp.html}{LABELEXP} - structure Region : \href{regions.html}{REGION} - structure Stream : \href{streams.html}{INSTRUCTION_STREAM} + (structure LabelExp : \localhref{labelexp.html}{LABELEXP} + structure Region : \localhref{regions.html}{REGION} + structure Stream : \localhref{streams.html}{INSTRUCTION_STREAM} structure Extension : \mlrischref{mltree/mltree-extension.sig}{MLTREE_EXTENSION} ) : MLTREE \end{SML} @@ -339,7 +339,7 @@ \begin{SML} LOAD : ty * rexp * Region.region -> rexp \end{SML} -The client is required to specify a \href{regions.html}{region} that +The client is required to specify a \localhref{regions.html}{region} that serves as aliasing information for the load. \subsubsection{Miscellaneous Integer Operators} @@ -643,10 +643,10 @@ \end{SML} The constructor \sml{DEFINE L} has the same meaning as executing the method \sml{defineLabel L} in the -\href{stream.html}{stream interface}. +\localhref{stream.html}{stream interface}. \subsection{Annotations} -\href{annotations.html}{Annotations} are used as the generic mechanism for +\localhref{annotations.html}{Annotations} are used as the generic mechanism for exchanging information between different phases of the MLRISC system, and between a compiler front end and the MLRISC back end. The following constructors can be used to annotate a MLTree term with diff -r -u a/latex/pseudo-ops.tex b/latex/pseudo-ops.tex --- a/latex/pseudo-ops.tex 2018-05-16 17:50:14.381914531 +0300 +++ b/latex/pseudo-ops.tex 2018-05-16 19:14:23.152132700 +0300 @@ -35,5 +35,5 @@ location counter. \end{itemize} These methods are involved during the -\href{span-dep.html}{span dependence resolution} phase to determine +\localhref{span-dep.html}{span dependence resolution} phase to determine the size and layout of the pseudo ops. diff -r -u a/latex/regmap.tex b/latex/regmap.tex --- a/latex/regmap.tex 2018-05-16 17:50:12.778600208 +0300 +++ b/latex/regmap.tex 2018-05-16 19:14:32.875351986 +0300 @@ -5,12 +5,12 @@ represent the current binding of virtual registers. Regmaps are implemented as \mlrischref{library/intmap.sml}{Intmap} in MLRISC, and are defined in the -\href{cells.html}{CELLS} interface. +\localhref{cells.html}{CELLS} interface. Regmaps are used in phases such as -\href{asm.html}{assembly generation} and -\href{mc.html}{machine code}. MLRISC program representations such -\href{cluster.html}{clusters} and \href{mlrisc-ir.html}{IR} +\localhref{asm.html}{assembly generation} and +\localhref{mc.html}{machine code}. MLRISC program representations such +\localhref{cluster.html}{clusters} and \localhref{mlrisc-ir.html}{IR} each contains a global regmap per compilation unit. Representations -such as \href{hyperblock.html}{hyperblock} may contain its own +such as \localhref{hyperblock.html}{hyperblock} may contain its own regmap, which overrides the global regmap. diff -r -u a/latex/span-dep.tex b/latex/span-dep.tex --- a/latex/span-dep.tex 2018-05-16 17:50:09.198642655 +0300 +++ b/latex/span-dep.tex 2018-05-16 19:14:46.215195514 +0300 @@ -1,9 +1,9 @@ \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} +client defined \localhref{constants.html}{constants} and \localhref{labels.html}{labels} in a program. An instruction whose immediate operand field contains a -constant or \href{labexp.html}{label expression} which +constant or \localhref{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 @@ -17,8 +17,8 @@ \begin{SML} signature \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS} = sig - structure I : \href{instructions.html}{INSTRUCTIONS} - structure C : \href{cells.html}{CELLS} + structure I : \localhref{instructions.html}{INSTRUCTIONS} + structure C : \localhref{cells.html}{CELLS} sharing I.C = C val branchDelayedArch : bool @@ -40,7 +40,7 @@ \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 \localhref{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. @@ -52,7 +52,7 @@ span depedennce resolution and code generation. \begin{SML} signature \mlrischref{backpatch/bbsched.sig}{BBSCHED} = sig - structure F : \href{cluster.html}{FLOWGRAPH} + structure F : \localhref{cluster.html}{FLOWGRAPH} val bbsched : F.cluster -> unit val finish : unit -> unit @@ -70,7 +70,7 @@ 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} + structure Emitter : \localhref{mc.html}{INSTRUCTION_EMITTER} sharing Emitter.P = Flowgraph.P sharing Flowgraph.I = Jumps.I = Emitter.I ): BBSCHED @@ -81,9 +81,9 @@ \begin{SML} functor SpanDependencyResolution (structure Flowgraph : \mlrischref{cluster/flowgraph.sig}{FLOWGRAPH} - structure Emitter : \href{mc.html}{INSTRUCTION_EMITTER} + structure Emitter : \localhref{mc.html}{INSTRUCTION_EMITTER} structure Jumps : \mlrischref{backpatch/sdi-jumps.sig}{SDI_JUMPS} - structure DelaySlot : \href{delayslots.html}{DELAY_SLOT_PROPERTIES} + structure DelaySlot : \localhref{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 @@ -91,15 +91,15 @@ \end{SML} Finally, functor \sml{BackPatch} is a span dependency resolution -module specially written for the \href{x86.html}{x86} architecture. +module specially written for the \localhref{x86.html}{x86} architecture. \begin{SML} 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} + structure Flowgraph : \localhref{cluster.html}{FLOWGRAPH} + structure Asm : \localhref{asm.html}{INSTRUCTION_EMITTER} sharing Emitter.I = Jumps.I = Flowgraph.I = Props.I = Asm.I) : BBSCHED \end{SML} diff -r -u a/latex/streams.tex b/latex/streams.tex --- a/latex/streams.tex 2018-05-16 17:50:06.728671941 +0300 +++ b/latex/streams.tex 2018-05-16 19:14:59.785036340 +0300 @@ -5,12 +5,12 @@ is an abstraction used by MLRISC to describe linearized instructions. This abstraction turns out to fit the function of many MLRISC modules. For example, -a phase such as \href{instrsel.html}{Instruction Selection} +a phase such as \localhref{instrsel.html}{Instruction Selection} can be viewed as taking an stream of -\href{mltree.html}{MLTREE} statements and return a -stream of \href{instructions.html}{instructions}. Similarly, -phases such as \href{asm.html}{assembly output} and -\href{mc.html}{machine code generation} can be seen +\localhref{mltree.html}{MLTREE} statements and return a +stream of \localhref{instructions.html}{instructions}. Similarly, +phases such as \localhref{asm.html}{assembly output} and +\localhref{mc.html}{machine code generation} can be seen as taking a stream of instructions and returning a stream of characters and a stream of bytes. @@ -19,7 +19,7 @@ \begin{SML} signature \mlrischref{instructions/stream.sig}{INSTRUCTION_STREAM} = sig - structure P : \href{pseudo-ops.html}{PSEUDO_OPS} + structure P : \localhref{pseudo-ops.html}{PSEUDO_OPS} datatype ('a,'b,'c,'d,'e,'f) stream = STREAM of @@ -38,8 +38,8 @@ end \end{SML} This type is specialized in other modules as such the -\href{asm.html}{assembler}, the \href{mc.html}{machine code emitter}, -and the \href{instrsel.html}{instruction selection modules}. +\localhref{asm.html}{assembler}, the \localhref{mc.html}{machine code emitter}, +and the \localhref{instrsel.html}{instruction selection modules}. \subsubsection{The protocol} All instruction streams, irrespective of their actual types, follow the following protocol: @@ -56,7 +56,7 @@ order: \begin{itemize} \item \sml{emit} -- this method emits an instruction. It takes - a \href{regmap.html}{regmap} as argument. + a \localhref{regmap.html}{regmap} as argument. \item \sml{pseudoOp} -- this method emits a pseudo op. \item \sml{defineLabel} -- this method defines a \emph{local} label, i.e. a label that is only referenced within the same compilation unit. diff -r -u a/latex/systems.tex b/latex/systems.tex --- a/latex/systems.tex 2018-05-16 17:50:05.592018752 +0300 +++ b/latex/systems.tex 2018-05-16 19:15:10.668242010 +0300 @@ -13,5 +13,5 @@ \end{itemize} \begin{small} -Please send additions to \href{mailto:leunga@cs.nyu.edu}{Allen Leung} +Please send additions to \localhref{mailto:leunga@cs.nyu.edu}{Allen Leung} \end{small} diff -r -u a/Makefile b/Makefile --- a/Makefile 2018-05-16 17:48:25.993199628 +0300 +++ b/Makefile 2018-05-17 14:04:50.956261352 +0300 @@ -1,13 +1,10 @@ -# -# Build all documentation -# - -all: - (cd pictures; make) - (cd html; make) - (cd latex; make) - +SUBDIRS=pictures latex +.PHONY: $(SUBDIRS) +all: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ clean: - (cd pictures; make clean) - (cd html; make clean) - (cd latex; make clean) + for dir in $(SUBDIRS); do \ + $(MAKE) clean -C $$dir; \ + done + diff -r -u a/pictures/fig/mlrisc-ir.fig b/pictures/fig/mlrisc-ir.fig --- a/pictures/fig/mlrisc-ir.fig 2018-05-16 17:51:30.271014682 +0300 +++ b/pictures/fig/mlrisc-ir.fig 2018-05-17 14:52:16.758990231 +0300 @@ -21,7 +21,7 @@ 4671 5364 5458 5364 5064 4596 4671 5364 4 0 7 0 0 0 12 0.0000 4 15 45 4050 7350 .\001 4 0 7 0 0 0 12 0.0000 4 15 45 6225 4425 .\001 -4 0 8 0 0 26 5 0.0000 4 120 555 5630 6004 Regions\001 -4 0 8 0 0 26 5 0.0000 4 90 630 5507 5620 Constants\001 -4 0 8 0 0 26 5 0.0000 4 120 765 5433 5108 Pseudo Ops\001 -4 0 8 0 0 26 5 0.0000 4 90 630 5605 6388 Core RTL\001 +4 0 8 0 0 26 7 0.0000 4 120 555 5630 6004 Regions\001 +4 0 8 0 0 26 7 0.0000 4 90 630 5507 5620 Constants\001 +4 0 8 0 0 26 7 0.0000 4 120 765 5433 5108 Pseudo Ops\001 +4 0 8 0 0 26 7 0.0000 4 90 630 5605 6388 Core RTL\001 diff -r -u a/pictures/Makefile b/pictures/Makefile --- a/pictures/Makefile 2018-05-16 17:51:10.747912848 +0300 +++ b/pictures/Makefile 2018-05-17 14:41:44.163430491 +0300 @@ -32,8 +32,13 @@ png/uncol1.png \ png/uncol2.png +PDF= pdf/trace.pdf \ + pdf/subgraph.pdf \ + pdf/mlrisc-IR.pdf \ + pdf/tail-duplication.pdf -all: mkdir $(EPS) $(PNG) + +all: mkdir $(EPS) $(PNG) $(PDF) clean: rm -f $(EPS) $(PNG) @@ -41,10 +46,13 @@ mkdir: @if [ ! -d png ]; then mkdir png; fi @if [ ! -d eps ]; then mkdir eps; fi + @if [ ! -d pdf ]; then mkdir pdf; fi eps/%.eps: fig/%.fig fig2dev -L ps $< $@ jpeg/%.jpg: fig/%.fig fig2dev -L jpeg $< $@ png/%.png: fig/%.fig - fig2dev -L png $< $@ + fig2dev -L png -m 4.0 $< $@ +pdf/%.pdf: fig/%.fig + fig2dev -L pdf $< $@ Only in b/pictures: pdf diff -r -u a/README b/README --- a/README 2018-05-16 17:48:26.266529721 +0300 +++ b/README 2018-05-17 14:47:37.955825403 +0300 @@ -3,14 +3,6 @@ 1. Perl 5.004 or more recent 2. LaTeX (I use the TeTeX distribution) 3. fig2dev 3.2 (from xfig) +4. latexmk -To build the documentation do the following: - -1. In this directory, type make -2. cd latex -3. make again -4. make again -5. make again (Three times to make LaTeX stablize on the cross references) - -The HTML pages will be in the directory html, starting from html/index.html -The LaTeX documents will be in the directory latex. +This builds only PDF files.