lecture-01

lecture-01 - ECE 468: Intro to Compilers & Translation...

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

View Full Document Right Arrow Icon
ECE 468: Intro to Compilers & Translation Systems Engineering Instructor: Milind Kulkarni (milind@purdue.edu) TA: Chenguang Sun (ece468@ecn.purdue.edu) http://www.engineering.purdue.edu/~milind/ece468/2010fall Monday, August 23, 2010
Background image of page 1

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

View Full DocumentRight Arrow Icon
Agenda Course administration What is a compiler? Structure of a compiler Simple compiler example Monday, August 23, 2010
Background image of page 2
Course information Syllabus handout Problem Set 0: Go to course webpage, Fll out information sheet, send it to me by email by next Monday. Worth 5 bonus points on Frst midterm Monday, August 23, 2010
Background image of page 3

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

View Full DocumentRight Arrow Icon
What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g., C++) to low-level assembly language that can be executed by hardware int a, b; a = 3; if (a < 4) { b = 2; } else { b = 3; } var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done Monday, August 23, 2010
Background image of page 4
Compilers are translators Fortran C C++ Java Text processing language HTML/XML Command & Scripting Languages Natural language Domain specific languages Machine code Virtual machine code Transformed source code Augmented source code Low-level commands Semantic components Another language translate Monday, August 23, 2010
Background image of page 5

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

View Full DocumentRight Arrow Icon
Compilers are optimizers Can perform optimizations to make a program more efFcient int a, b, c; b = a + 3; c = a + 3; var a var b var c mov a r1 addi 3 r1 mov r1 b mov a r2 addi 3 r2 mov r2 c var a var b var c mov a r1 addi 3 r1 mov r1 b mov r1 c Monday, August 23, 2010
Background image of page 6
Why do we need compilers? Compilers provide portability Old days: whenever a new machine was built, programs had to be rewritten to support new instruction sets IBM System/360 (1964): Common Instruction Set Architecture (ISA) — programs could be run on any machine which supported ISA Common ISA is a huge deal (note continued existence of x86) But still a problem: when new ISA is introduced (EPIC) or new extensions added (x86-64), programs would have to be rewritten Compilers bridge this gap: write new compiler for an ISA, and then simply recompile programs! Monday, August 23, 2010
Background image of page 7

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

View Full DocumentRight Arrow Icon
Why do we need compilers? (II) Compilers enable high performance and productivity Old: programmers wrote in assembly language, architectures were simple (no pipelines, caches, etc.) Close match between programs and machines — easier to achieve performance New: programmers write in high level languages (Ruby, Python), architectures are complex (superscalar, out-of- order execution, multicore) Compilers are needed to bridge this semantic gap Compilers let programmers write in high level languages and still get good performance on complex architectures Monday, August 23, 2010
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

lecture-01 - ECE 468: Intro to Compilers &amp; Translation...

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

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