lec21 - CS415 Compilers Procedure Abstraction These slides...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS415 Compilers Procedure Abstraction These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Lecture 21 2 cs415, spring 10 Procedure Abstraction Chapter 6 in EAC The compiler must deal with interface between compile time and run time (static versus dynamic) Most of the tricky issues arise in implementing procedures Issues Compile-time versus run-time behavior Finding storage for EVERYTHING, and mapping names to addresses Generating code to compute addresses that the compiler cannot know ! Interfaces with other programs, other languages, and the OS Efficiency of implementation Lecture 21 3 cs415, spring 10 Where are we? The latter half of a compiler contains more open problems, more challenges, and more gray areas than the front half This is compilation, as opposed to parsing or translation Implementing promised behavior What defines the meaning of the program Managing target machine resources Registers, memory, issue slots, locality, power, These issues determine the quality of the compiler Errors Source Code Middle End Front End Machine code Back End IR IR Well understood Engineering Lecture 21 4 cs415, spring 10 The Procedure: Three Abstractions Control Abstraction Well defined entries & exits Mechanism to return control to caller Some notion of parameterization (usually) Clean Name Space Clean slate for writing locally visible names Local names may obscure identical, non-local names Local names cannot be seen outside External Interface Access is by procedure name & parameters Clear protection for both caller & callee Procedures permit a critical separation of concerns Lecture 21 5 cs415, spring 10 The Procedure ( Realists View ) Procedures allow us to use separate compilation Separate compilation allows us to build non-trivial programs Keeps compile times reasonable Lets multiple programmers collaborate Requires independent procedures Without separate compilation, we would not build large systems The procedure linkage convention Ensures that each procedure inherits a valid run-time environment and that the callers environment is restored on return The compiler must generate code to ensure this happens according to conventions established by the system Lecture 21 6 cs415, spring 10 The Procedure (More Abstract View) A procedure is an abstract structure constructed via software Underlying hardware directly supports little of the abstraction it understands bits, bytes, integers, reals, and addresses, but not: Entries and exits Interfaces Call and return mechanisms may be a special instruction to save context at point of call Name space Nested scopes All these are established by a carefully-crafted system of mechanisms provided by compiler, run-time system, linkage editor and loader, and OS Lecture 21 7 cs415, spring 10...
View Full 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 / 43

lec21 - CS415 Compilers Procedure Abstraction These slides...

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

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