08.11.2014 Views

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

avariable previously dened in lexicographic order, or a forward denition if it points to a<br />

variable denition that post-dominates the function.<br />

Our functions are classied into two groups, according to the kind of construction<br />

required by the function. The rst group of functions, which we redene as functions,<br />

replaces the functions required at the end of conditional statements and loops.<br />

Both<br />

parameters of functions have backward denitions. The other group of functions, which<br />

we redene as ' functions, replaces the functions required at the beginning of loops. '<br />

functions have one forward denition and one backward denition.<br />

In some cases, the use of a variable may nothave a previous denition in the lexicographic<br />

order of the program, as for example variable y in Statement S3 in the code segment<br />

presented in Figure 4.5(a).<br />

In these cases, when generating the and ' functions, the<br />

corresponding backward denitions are assumed to be null, as exemplied by Statement<br />

P1 in Figure 4.5(b) that presents the SSA representation for the same program. Thus, as<br />

shown in Statement P2, the ' function will have two parameters however, one points to an<br />

\actual" assignment, while the other points to an \articial" assignment tonull. These<br />

articial assignments are not necessary for the static inference mechanism, as the ' function<br />

could have just the forward parameter. However, its use facilitates the implementation by<br />

forcing all ' functions to have two parameters. It is also helpful during the dynamic phase,<br />

as discussed in Chapter 6.<br />

4.2.3 Extension of the SSA Representation to Support Indexed<br />

Array Assignments<br />

While it is easy to determine which denitions cover a given use in the case of scalars and<br />

full array assignments using the SSA representation, indexed array assignments require a<br />

more complex approach involving a new function. Consider, for example, the <strong>MATLAB</strong><br />

code segment presented in Figure 4.6, and assume that A is assigned in statements S2 and<br />

S4 only. In this code segment, S1 creates a matrix Z lled with zeros S2 creates a matrix<br />

37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!