w6Color - Announcements Final exam information Mon 12/14...

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

View Full Document Right Arrow Icon
Announcements • Final exam information: – Mon 12/14 08:00a - 10:00a in PHYS • First exam is Monday, Oct. 5, in-class – Open book – Open notes • Will announce review session for first exam soon, as soon as I have room reservations. 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
2 Expressions • Three semantic actions needed: – eval_binary – eval_unary – process_op • process_op creates a token record that records the type of the operation • eval_binary accepts a token record and two dataobject records • eval_unary accepts a token record and one databoject record. • Both eval actions return a dataobject .
Background image of page 2
3 Expressions Two interesting semantic actions needed: – eval_binary – eval_unary Need to check if inputs are error records – Propagate if so Or inputs are both constants – Do the operation at compile time if possible Or inputs require code to be generated – Call code generation routines. Returned data object contains a temporary that holds the result of the generated code or the compile-time operation.
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Temporaries Can be thought of as an unlimited pool of registers (with memory to be allocated sometime) Need to declare them like variables Name should be something that cannot appear in the program (i.e. preface with an “illegal” character. Memory must be allocated if address of the temporary can be taken (this info should be in the symbol table entry for the temporary) -- won’t happen with project compiler For variable based temporaries, might want to keep a count of how often it is referenced to assist in register allocation (to occur later) Temporaries can hold either L-values or R-values.
Background image of page 4
5 L-values and R-values Consider the statement a := a; “a” on the RHS refers to a value that is contained in the memory location named “a” (sometimes called the R- value) “a” on the LHS refers to the memory location (i.e. an address) referred to by “a” (sometimes called the L- value) Use of load and store/load indirect instructions to access these reflects this difference. A[i+1] generates a temporary containing the L-value which is the addressOf( A) + (i+1)*elementSize . L-values cause the indirect flag of the dataobject semantic record to be set to true.
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 Arrays and records • Consider the record reference A.f • Address of A is retrieved from the symbol table, or an entry is made to have the linker fill this in) • Offset of f from the start of the record is retrieved from the symbol table entry for f) and added to the base of f . This yields an L-value.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/19/2012 for the course ECE 468 taught by Professor Test during the Fall '08 term at Purdue.

Page1 / 23

w6Color - Announcements Final exam information Mon 12/14...

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

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