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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

architectures and the use of the semantic information in order to facilitate the work of a<br />

parallelizing compiler.<br />

As described previously, due to its interactive nature, its extensive set of functions and<br />

higher-level operators, and its lack of requirements for specication of intrinsic type and<br />

dimensions of variables, <strong>MATLAB</strong> is a very powerful programming tool for prototyping algorithms<br />

and applications. This lack of \declarations", however, is one of the major challenges<br />

for the translation. The fact that the language is not typed simplies the programmer's job<br />

because every function and operator is polymorphic and, therefore, type casting or function<br />

cloning to accept dierent input and output types is not necessary.<br />

Consider, for example, the simple computation of a square root function ( p k). It may<br />

result in an integer, real, orcomplex output, depending on the value of k. In MAT-<br />

LAB, however, the user does not need to be concerned about the intrinsic type of the input<br />

variable to compute this function furthermore, the same statement works for any variable,<br />

independent of its intrinsic type, number of dimensions (rank), or size of each dimension<br />

(shape). Moreover, the intrinsic type, rank, and shape of the output variable are not important<br />

for the correct execution of the program. On the other hand, for a typed language such<br />

as Fortran and C, the user is required to know these properties for all the variables in order<br />

to select the correct method to compute the square root. Therefore, an inference mechanism<br />

is necessary to generate the declarations for a typed language.<br />

The inference mechanism developed for our <strong>MATLAB</strong> compiler combines static and dynamic<br />

inference methods, and is enhanced with symbolic and value propagation analyses.<br />

The goal of our inference system is to determine in a <strong>MATLAB</strong> program the following variable<br />

properties:<br />

intrinsic type: (e.g, complex or real)<br />

rank: (e.g., vector, matrix, scalar)<br />

shape: (i.e., size of each dimension) and<br />

5

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

Saved successfully!

Ooh no, something went wrong!