Apr12 - CSE302: Compiler Design Instructor: Dr. Liang Cheng...

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

View Full Document Right Arrow Icon
CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering Lehigh University April 12, 2007
Background image of page 1

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

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/12/07 Outline ± Recap ± Intermediate code generation ± Type expression and storage ± Summary
Background image of page 2
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/12/07 How to Address Array Elements? ± Row-major order with index starting at 0 ± A[i] locates at base+i × w ± A[i1][i2] locates at base+i1 × w1 +i2 × w2 ± int[2][3]: w1=12, w2=4 ± L id [ E ] | L [ E ] ± SDT for array references
Background image of page 3

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

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/12/07 Translation of Array References ± L id [ E ] ± L.array = top.get(id.lexeme) ± L.type = L.array.type.elem ± L.addr = new Temp() ± gen(L.addr ‘=’ E.addr ‘*’ L.type.width) ± L L1 [ E ] ± L.array = L1.array ± L.type = L1.type.elem ± t = new Temp() ± L.addr = new Temp() ± gen(t ‘=’ E.addr ‘*’
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

Apr12 - CSE302: Compiler Design Instructor: Dr. Liang Cheng...

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

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