next up previous contents
Next: Translation of array sections Up: Basic Translation Scheme Previous: Translation of the overall   Contents


Translation of element access in multiarrays

Figure 4.14 represents a general schema for translating element access. Here we only need to consider the case where the array reference is a multiarray. The macro OFFSET is defined as

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
$$OFFSET$\displaystyle \left(a, e_0, \ldots, e_{R-1}\right) \equiv$\ \\
\\
\verb$ $$...
...({\bf T}_{R-1}\left[{a}\right], e_{R-1}\right)$
\end{tabbing}
\end{minipage}
$

There are three cases for the macro OFFSET_DIM depending on whether the subscript argument is a distributed index, a shifted index, or an integer subscripts (in a sequential dimension). We will only illustrate the case where $ e_r$ is a distributed index $ i$. Then

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{tabbing}
$\mbo...
...erb$.stride * $$\mbox{\it sub}$
\end{tabbing}
\end{minipage}
\end{displaymath}

where sub is the local subscript variable for this index (see the last section).

Figure 4.15: Translation of array section with no scalar subscripts.

SOURCE:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
$v$\verb$ = $$a$\verb$ [[$$$subs$\displaystyle _0 \verb$, $ \ldots \verb$, $$subs$\displaystyle _{R-1}$\verb$]] ;$
\end{tabbing}
\end{minipage}
$

TRANSLATION:

$\displaystyle \begin{minipage}[t]{\linewidth}\small\begin{tabbing}
\verb$int $...
...eft[{a}\right]$\verb$.group, $$b$\verb$) ;$ \\
\end{tabbing}
\end{minipage}
$

where:




Bryan Carpenter 2004-06-09