diff options
author | Camil Staps | 2016-12-18 00:35:05 +0100 |
---|---|---|
committer | Camil Staps | 2016-12-18 00:35:05 +0100 |
commit | c7a521534b5883ef2630525d8da52ac28a35abfd (patch) | |
tree | 8c2cd04b07274d67b09b941d6da8680424e5e193 | |
parent | Layout changes (diff) |
Figure placement
-rw-r--r-- | thesis/intro.tex | 2 | ||||
-rw-r--r-- | thesis/reg-alloc.tex | 54 |
2 files changed, 35 insertions, 21 deletions
diff --git a/thesis/intro.tex b/thesis/intro.tex index 180d215..7587ed4 100644 --- a/thesis/intro.tex +++ b/thesis/intro.tex @@ -48,7 +48,7 @@ ARM instructions have 4-bit register fields to address them. Some 16-bit Thumb instructions have 3-bit register fields that can only address the lowest eight registers. For these instructions there exist 32-bit variants that can address all sixteen registers. -\begin{figure*}[b] +\begin{figure*}[t] \centering \begin{subfigure}[b]{.2\linewidth} \centering 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, |