next up previous contents index
Next: On exact exceptions Up: Expression simplification Previous: Updates   Contents   Index

Expressions with conditional evaluation

Figure A.10: Simplification of conditional expressions.

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
{\it simplify...
...$$\mbox{\it INITS}_b$ \\
\verb$}$
\end{tabbing}\end{minipage}\end{displaymath}

Figures A.10, A.11, and A.12 give simplification schemes for the three kinds of expression in the language that require conditional evaluation of some subexpressions. Temporaries introduced in these subexpressions must themselves be initialized conditionally. So we need more complex initialization code, involving if statements.

In Figure A.10 we choose to replace any conditional expression returning a multiarray by an assignment to a temporary within an if statement. As an optimization one may anticipate this transformation, and arrange to have the simplify algorithm treat $e_t$ and $e_f$ as if they were originally on the right-hand sides of a top-level assignments. This will avoid the introduction of unnecessary temporaries if either of these subexpressions is composite.

Figure A.11: Simplification of conditional or expressions.

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
{\it simplify...
...$$\mbox{\it INITS}_1$ \\
\verb$}$
\end{tabbing}\end{minipage}\end{displaymath}

Figure A.12: Simplification of conditional and expressions.

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\begin{tabbing}
{\it simplify...
...$$\mbox{\it INITS}_1$ \\
\verb$}$
\end{tabbing}\end{minipage}\end{displaymath}


next up previous contents index
Next: On exact exceptions Up: Expression simplification Previous: Updates   Contents   Index
Bryan Carpenter 2003-04-15