80 likes | 185 Views
ISA is a Contract. Compilers != Compilation. Compilation has multiple steps pre-processing (non-existent for java) finalizing the actual source listing typically used for includes in a C/C++ program translating (half-way done for java) from high-level or assembly language
E N D
Compilers != Compilation • Compilation has multiple steps • pre-processing (non-existent for java) • finalizing the actual source listing • typically used for includes in a C/C++ program • translating (half-way done for java) • from high-level or assembly language • to machine instructions • building • combine your parts and system parts
A Simple Translation Step • Most basic: two passes • first: collect and interpret symbols • second: line-by-line generation of instructions • Symbol = anything requiring interpretation • variable names • procedure/method names • your names and system names • opcodes and pseudo-instructions (in assembler)
Typical Translation • Most compilers today have 3 or 4 passes • Extra passes enable a compiler to • do extended error checking • do extra optimization of resulting code • Most projects have many pieces • each piece (e.g. .c or .cc) translated individually • files ending in .o on Unix • files ending in .obj on Windows
Linking • Once pieces translated, combine them • Each piece designed as relocatable module • External references get resolved • Complete executable built with parts • System parts often manifested as libraries • e.g. C library for unix applications • Shared libraries • Dynamically linked libraries
Total Workflow Loader Linker Assembler Compiler Preprocessor Editor or Code Generator