hw9 - CS 415 Compilers: Problem Set 9 Due date: Monday, May...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 415 Compilers: Problem Set 9 Due date: Monday, May 3, before class Problem 1 – Code Generation for Expressions var a[100][50] of integer; for (i=0; i<100; i++) { for (j=0, j<50; j++) { = ... a[i][j] /*1*/ } } 1. Generate ILOC code for the reference to two-dimensional array a at program point /*1*/ assuming (a) row-major order, (b) column-major order, (c) a data layout as used in Java (index vectors) You do not need to show the enclosing code for the loop. You can use the symbolic address @a to represent the base address of the array. The indexing is 0-based, i.e., a[0][0] is the first array element. Problem 2 – Procedure Linkage and Lexical Scoping program main; var a, b: integer; procedure foo(var x:integer; y:integer); begin x: =a+1 ; y: =x+b ; writeln(y) end; begin a=1;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Generate ILOC code with physical registers for the program above. The ARP value is stored in physical register r 0 and needs to be initialized to an appropriate value within the
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/29/2010 for the course CS 198:415 taught by Professor Kremer,u. during the Spring '10 term at Rutgers.

Page1 / 2

hw9 - CS 415 Compilers: Problem Set 9 Due date: Monday, May...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online