April 3 Lecture Outline Notes I. Tasks of compilation - Convert high-level language to machine code Obey semantics of source language Make efficent use of target machine resources Compiler must be adequately efficient too - Main tasks Data placement Instruction selection Fixed resource allocation (e.g., registers) Runtime system design and implementation - Historically, high-level language design has been heavily influenced by what people think compiler can do well. II. Charcteristics of Modern Target Architectures - (nearly) universal characteristics of machines Stored program model (program is just another kind of data) Addressable memory Indexed set of registers Core of arithmetic/logical operations on integers, usually also FP Conditional branches for control flow - IA32 (X86, Pentium) Small number of registers (effectively 6, with some special restrictions) Complex instruction set (many addressing modes) Lots of optimization (e.g., superscalar issue, out-of-order issue, register shadowing) done in hardware - SPARC (32 or 64 bit versions) Larger number of registers (about 30) Simple instruction set Instruction latencies exposed, so scheduling can make a difference - Key fact of life (this decade): main memory is slow! Caches absolutely essential Keeping miss rates low is essential Processors are pipelined => branches are bad, and unknown branches are very bad Data layout can have big impact on miss rates - standard Operating System assumptions Virtual memory (except in embedded systems) Separation of static data, growable heap, stack. System calls for I/O, etc. Multiprocessing with separate address spaces (using hardware support) - other models to remember: embedded processors, IA64, parallel processors