diff options
Diffstat (limited to 'thesis/reg-alloc.tex')
-rw-r--r-- | thesis/reg-alloc.tex | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/thesis/reg-alloc.tex b/thesis/reg-alloc.tex index 83ec773..0a2e87b 100644 --- a/thesis/reg-alloc.tex +++ b/thesis/reg-alloc.tex @@ -154,25 +154,35 @@ In Clean programs, the ARM registers are used as follows~\parencite[\texttt{arms \begin{table*}[b!] \centering \newcommand{\highlight}[1]{\textcolor{red}{\textbf{#1}}} - \begin{tabular}{l >{\tt\footnotesize}c >{\tt\footnotesize}c} - Register & {\normalsize\normalfont ARM} & {\normalsize\normalfont Thumb-2} \\\hline - A3 & r11 & \highlight{r12} \\ - Heap counter & r5 & \highlight{r9} \\ - B4 & r0 & \highlight{r10} \\ - B3 & r1 & \highlight{r11} \\ - B2 & r2 & \highlight{r8} \\ - S1 & r14 & r14 \\ - B1 & r3 & r3 \\ - B pointer & sp & sp \\ - A2 & r8 & \highlight{r2} \\ - B0 & r4 & r4 \\ - A1 & r7 & r7 \\ - Heap pointer & r10 & \highlight{r1} \\ - A0 & r6 & r6 \\ - A pointer & r9 & \highlight{r5} \\ - S0 & r12 & \highlight{r0} \\ - \end{tabular} - \captionof{table}{Register allocation in the ARM and Thumb backends\label{tab:reg-alloc:arm-and-thumb}} + \begin{subfigure}{.5\linewidth} + \centering + \begin{tabular}{l >{\tt\footnotesize}c >{\tt\footnotesize}c} + & & \\ % Dummy row to align with other table + Register & {\normalsize\normalfont ARM} & {\normalsize\normalfont Thumb-2} \\\hline + A3 & r11 & \highlight{r12} \\ + Heap counter & r5 & \highlight{r9} \\ + B4 & r0 & \highlight{r10} \\ + B3 & r1 & \highlight{r11} \\ + B2 & r2 & \highlight{r8} \\ + S1 & r14 & r14 \\ + B1 & r3 & r3 \\ + \end{tabular} + \end{subfigure}% + \begin{subfigure}[t]{.5\linewidth} + \centering + \begin{tabular}{l >{\tt\footnotesize}c >{\tt\footnotesize}c} + Register & {\normalsize\normalfont ARM} & {\normalsize\normalfont Thumb-2} \\\hline + B pointer & sp & sp \\ + A2 & r8 & \highlight{r2} \\ + B0 & r4 & r4 \\ + A1 & r7 & r7 \\ + Heap pointer & r10 & \highlight{r1} \\ + A0 & r6 & r6 \\ + A pointer & r9 & \highlight{r5} \\ + S0 & r12 & \highlight{r0} \\ + \end{tabular} + \end{subfigure}% + \caption{Register allocation in the ARM and Thumb backends\label{tab:reg-alloc:arm-and-thumb}} \end{table*} In \cref{fig:reg-usage}, we count for each register the number of instructions it occurs in, in the code generated for the Clean compiler~\parencite{cocl}. @@ -193,7 +203,7 @@ The counting method used here is rather simplistic: A more accurate method would only count those instructions where using a high or low register actually makes a difference. This is much more complicated, and for a rough estimate the simplistic method used here will already allow us to shrink down the code size. -\begin{figure*}[b!] +\begin{figure*}[t] \small \centering \begin{tikzpicture} @@ -260,6 +270,10 @@ The heap counter and the A-stack pointer are swapped, as are A2 and B2. The registers for S0, B4, the heap pointer, B3 and A3 have been rotated. This way, all eight most often used registers are in the lower half except the B-stack pointer. +\subsection{The foreign function interface} +\label{sec:reg-alloc:ffi} +\todo{discuss how this allocation changes the FFI considering the calling convention.} + \subsection{Results} \label{sec:reg-alloc:results} To measure the code size improvement introduced by this optimisation, |