| 1 |
\section{Architecture of MLRISC} |
| 2 |
|
| 3 |
\subsection{Core Components} |
| 4 |
|
| 5 |
The core components of MLRISC allow the client to quickly construct |
| 6 |
an backend for various architectures. These components include: |
| 7 |
\begin{itemize} |
| 8 |
\item The \href{mltree.html}{MLTREE} language, |
| 9 |
which is a RTL-like intermediate language |
| 10 |
that is used by the client |
| 11 |
to communicate to the MLRISC system. A client is |
| 12 |
responsible for writing the module that generates MLTREE from |
| 13 |
the source program representation. |
| 14 |
\item \href{instrsel.html}{Instruction selection modules}, |
| 15 |
which generates target machine |
| 16 |
instructions from MLTREE. |
| 17 |
\item The \href{ra.html}{Register Allocator}, |
| 18 |
which performs register allocation. |
| 19 |
\item \href{asm.html}{Assemblers}, which emits assembly code. |
| 20 |
\end{itemize} |
| 21 |
|
| 22 |
For systems that require direct machine code generation, the following |
| 23 |
modules are included: |
| 24 |
\begin{itemize} |
| 25 |
\item \href{span-dep.html}{Span dependency resolution} |
| 26 |
modules, which compute addresses |
| 27 |
from symbolic addresses, |
| 28 |
fill delay slots, and expand instructions that are |
| 29 |
\newdef{span dependent} |
| 30 |
\item \href{mc.html}{Machine code emitters}, |
| 31 |
which emit executable machine code into a binary stream. |
| 32 |
\end{itemize} |
| 33 |
|
| 34 |
\subsection{Optimization Modules} |
| 35 |
|
| 36 |
In addition, MLRISC has been enhanced to support various types of |
| 37 |
machine level optimizations. These include: |
| 38 |
|
| 39 |
\begin{itemize} |
| 40 |
\item Core optimizations, which includes |
| 41 |
various types of control flow transformation, |
| 42 |
and architectural specific peephole optimizations. |
| 43 |
\item SSA based scalar optimizations |
| 44 |
\item ILP optimizations for superscalars |
| 45 |
\item ILP optimizations for VLIW/EPIC architectures |
| 46 |
\item GC safety analysis |
| 47 |
\end{itemize} |
| 48 |
|
| 49 |
\subsection{Basic Concepts} |
| 50 |
|
| 51 |
Basic concepts in MLRISC are: |
| 52 |
\begin{itemize} |
| 53 |
\item \href{instructions.html}{Instructions} -- |
| 54 |
the instruction set of the target architecture. |
| 55 |
\item \href{cells.html}{Cells} -- which describes registers, |
| 56 |
memory and other mutable resources in the machine. |
| 57 |
\item \href{regions.html}{Regions} -- a client defined |
| 58 |
abstract type used to represent aliasing information available from |
| 59 |
the front-end. |
| 60 |
\item \href{constants.html}{Constants} -- a client defined |
| 61 |
place holder used to represent constants whose values are unknown |
| 62 |
in the front-end. |
| 63 |
\item \href{pseudo-ops.html}{Pseudo Ops} -- a client defined |
| 64 |
|
| 65 |
\item \href{annotations.html}{Annotations} -- this is |
| 66 |
a generic mechinism for propagating information in the MLRISC sstem. |
| 67 |
The client may attach arbitrary annotation of various granularity |
| 68 |
to MLRISC's program representation, |
| 69 |
which can then be propagated to later phases. |
| 70 |
These can be information related to profiling frequency, dependence, |
| 71 |
comments, and/or types. |
| 72 |
The same mechanism is also used to propagate |
| 73 |
analysis information one optimization phase to |
| 74 |
another. |
| 75 |
\item \href{streams.html}{Instruction Streams} -- an abstraction |
| 76 |
for describing a stream of instructions. Instruction streams are |
| 77 |
used to connect modules such as instruction selection, assembler, |
| 78 |
machine code emitter, and |
| 79 |
control flow graph builder. |
| 80 |
\item \href{regmap.html}{Regmap} -- a mapping between registers |
| 81 |
names. MLRISC register allocators represent the result of register |
| 82 |
allocation as a regmap. |
| 83 |
\item \href{labels.html}{Labels} -- a type representing |
| 84 |
symbolic labels. |
| 85 |
\item \href{labelexp.html}{Label Expressions} -- a type representing |
| 86 |
constant expressions |
| 87 |
involving symbolic labels. |
| 88 |
\end{itemize} |
| 89 |
|
| 90 |
\subsection{How Things Are Fit Together} |
| 91 |
|
| 92 |
MLRISC uses two different program representations, clusters and MLRISC IR. |
| 93 |
\begin{itemize} |
| 94 |
\item \href{cluster.html}{Cluster} is light-weight representation |
| 95 |
that is used when only the most basic optimizations are required. |
| 96 |
\item \href{mlrisc-ir.html}{MLRISC IR} is more heavy-weight |
| 97 |
representation that is built from the |
| 98 |
\href{graphs.html}{MLRISC graph library} and the |
| 99 |
\href{compiler-graphs.html}{MLRISC compiler graph library}. |
| 100 |
MLRISC IR allows more complex transformations and analysis of the |
| 101 |
program graph. |
| 102 |
\end{itemize} |
| 103 |
Conversion modules between the two representations are provided. |
| 104 |
|
| 105 |
In general MLRISC optimization phases are transformations applied on one |
| 106 |
of these representations. Optimizations may be chained together to form |
| 107 |
a compiler backend. For example, a minimal backend consists of |
| 108 |
\begin{itemize} |
| 109 |
\item the instruction selection module, which translates |
| 110 |
\href{mltree.html}{MLTree} into target instructions, |
| 111 |
\item the flowgraph builder, which conversts a stream of target instructions |
| 112 |
into a cluster, |
| 113 |
\item the register allocator, which performs register allocation, and |
| 114 |
\item the assembly code emitter, which generates assembly output |
| 115 |
\end{itemize} |