lecture-01-6up

lecture-01-6up - Announcements ECE 468: Intro to Compilers...

Info iconThis preview shows pages 1–3. 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: Eric Villasenor (ece468@ecn.purdue.edu) http://www.engineering.purdue.edu/~milind/ece468/2011fall Monday, August 8, 2011 Announcements “Problem Set” 0 online Short questionnaire Monday, August 8, 2011 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 8, 2011 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 8, 2011 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 8, 2011 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 8, 2011
Background image of page 1

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 8, 2011 Semantic Gap AMD Barcelona architecture def index @posts = Post.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } end end Snippet of Ruby-on-rails code
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

lecture-01-6up - Announcements ECE 468: Intro to Compilers...

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

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