Machine-Level Representation of Programs I
1 Machine-Level Representation of Programs I
Outline Compiler drivers History of the intel IA-32 architecture Assembly code and object code Memory and Registers Addressing Mode Data Formats Suggested reading -chap1.2,1.4.1.1.7.3.3.1,3.2,3.3,3.4.1
2 Outline • Compiler drivers • History of the Intel IA-32 architecture • Assembly code and object code • Memory and Registers • Addressing Mode • Data Formats • Suggested reading – Chap 1.2, 1.4.1, 1.7.3, 3.1, 3.2, 3.3, 3.4.1
The hello program It begins life as a high-level C program Can be read and understand by human beings The individual c statements must be translated by compiler drivers So that the hello program can run on a computer system Compiler:编译器
3 The Hello Program • It begins life as a high-level C program – Can be read and understand by human beings • The individual C statements must be translated by compiler drivers – So that the hello program can run on a computer system – Compiler:编译器
The hello program The C programs are translated into A sequence of low-level machine-language instructions These instructions are then packaged in a form called an object program Object program are stored as a binary disk file Also referred to as executable object files
4 The Hello Program • The C programs are translated into – A sequence of low-level machine-language instructions • These instructions are then packaged in a form – called an object program • Object program are stored as a binary disk file – Also referred to as executable object files
The Context of a Compiler (gcc)Figure 1.3P5 hello.c Source program(text) Preprocessor(cpp hello. i Modified source program(text) Compiler(cc1) hello.s Assembly program(text) Assembler(as) hello. o Relocatable object program(binary Linker(Id) Compiler:编译器 hello Executable object program(binary) Assembler:汇编器 Linker:连接器
5 The Context of a Compiler (gcc) hello.c Source program (text) Preprocessor (cpp) hello.i Modified source program (text) Assembly program (text) Compiler (cc1) hello.s Assembler (as) hello.o Relocatable object program (binary) Linker (ld) hello Executable object program (binary) Figure 1.3 P5 Compiler:编译器 Assembler:汇编器 Linker:连接器