|
@@ -35,7 +35,7 @@ the keywords in to an action.
|
|
|
|
|
|
|
|
\section{Design}
|
|
\section{Design}
|
|
|
|
|
|
|
|
-There are two general types of of optimizations of the assembly code, global
|
|
|
|
|
|
|
+There are two general types of optimizations of the assembly code, global
|
|
|
optimizations and optimizations on a so-called basic block. These optimizations
|
|
optimizations and optimizations on a so-called basic block. These optimizations
|
|
|
will be discussed separately
|
|
will be discussed separately
|
|
|
|
|
|
|
@@ -99,6 +99,14 @@ Appendix \ref{opt}.
|
|
|
A more advanced optimization is common subexpression elimination. This means
|
|
A more advanced optimization is common subexpression elimination. This means
|
|
|
that expensive operations as a multiplication or addition are performed only
|
|
that expensive operations as a multiplication or addition are performed only
|
|
|
once and the result is then `copied' into variables where needed.
|
|
once and the result is then `copied' into variables where needed.
|
|
|
|
|
+\begin{verbatim}
|
|
|
|
|
+non-optimized:
|
|
|
|
|
+addu $2,$2,$3
|
|
|
|
|
+addu $4,$2,$3
|
|
|
|
|
+
|
|
|
|
|
+optimized:
|
|
|
|
|
+
|
|
|
|
|
+\end{verbatim}
|
|
|
|
|
|
|
|
A standard method for doing this is the creation of a DAG or Directed Acyclic
|
|
A standard method for doing this is the creation of a DAG or Directed Acyclic
|
|
|
Graph. However, this requires a fairly advanced implementation. Our
|
|
Graph. However, this requires a fairly advanced implementation. Our
|