清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8.6 Code Generation in Commercial Compilers:Two Case Studies

COMPILER CONSTRUCTION Principles and practice Kenneth C. louden
COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden

8. Code Generation
8. Code Generation

Contents Part One 8. 1 Intermediate Code and Data Structure for code Generation 8.2 Basic Code Generation Techniques Part Two 8.3 Code generation of data Structure Reference 8.4 Code generation of Control Statements and logical Expression 8.5 Code generation of procedure and function calls Part Three 8.6 Code Generation on Commercial Compilers: Two Case studies 8.7TM: A Simple Target Machine 8.8 A Code Generator for the TINY Language 8.9A Survey of Code optimization Techniques 8.10 Simple Optimizations for tINY Code Generator
Contents Part One 8.1 Intermediate Code and Data Structure for code Generation 8.2 Basic Code Generation Techniques Part Two 8.3 Code Generation of Data Structure Reference 8.4 Code Generation of Control Statements and Logical Expression 8.5 Code Generation of Procedure and Function calls Part Three 8.6 Code Generation on Commercial Compilers: Two Case Studies 8.7 TM: A Simple Target Machine 8.8 A Code Generator for the TINY Language 8.9 A Survey of Code Optimization Techniques 8.10 Simple Optimizations for TINY Code Generator

8. 6 Code generation in commercial Compilers: Two Case Studies Borlands c compiler for 80X86 Suns c compiler for sparc Stations
8.6 Code Generation in Commercial Compilers: Two Case Studies Borland’s C Compiler for 80X86 Sun’s C Compiler for SparcStations

For example, onsider the c procedure Void f( int char c) i int a[10; double y;
For example, Consider the C procedure Void f ( int x, char c) { int a[10]; double y; … }

The activation record for a call to f would appear as Offset ofx Control linl fp Offset of c Return address a0] Offset of a Offset of
Offset of x fp Offset of c Offset of a Offset of y The activation record for a call to f would appear as x c Control link Return address a[9] … a[1] a[0] y

Assuming two bytes for integers, four bytes for addresses one byte for character and eight bytes for double-precision floating point, we would have the following offset values Name Offset +5 +4 24 32 Now, an access of, would require the computation of the address (-24+2*1)(fp)
Name Offset x +5 c +4 a -24 y -32 Assuming two bytes for integers, four bytes for addresses, one byte for character and eight bytes for double-precision floating point, we would have the following offset values: Now, an access of a[i], would require the computation of the address: (-24+2*i)(fp)

For the expression: (X=X+3)+ 4, the p code and three-address code Lad x Lod x Ldc 3 Adi t1=x+3 Stn X=tl Ldc 4 Adi t2=t1+4
• For the expression: ( x = x +3 ) + 4, the pcode and three-address code: Lad x Lod x Ldc 3 Adi t1=x+3 Stn x=t1 Ldc 4 Adi t2=t1+4

8.6.1 The borland 3.0 C Compiler for the 80X86
8.6.1 The Borland 3.0 C Compiler for the 80X86

Consider the examples of the output of this compiler with the following assignment (X=x+3)+4 The assembly code for this expression as produced by the borland 3.0 compiler for the Intel 80X86 is as follows mov ax, word ptr [bp-2 add ax. 3 mov word ptr [bp-2, ax add ax. 4 Notes The bp is used as the frame pointer The static simulation method is used to convert the intermediate code into the target code
• Consider the examples of the output of this compiler with the following assignment (x = x +3 ) + 4 • The assembly code for this expression as produced by the Borland 3.0 compiler for the Intel 80x86 is as follows: mov ax, word ptr [bp-2] add ax, 3 mov word ptr [bp-2], ax add ax, 4 • Notes: – The bp is used as the frame pointer. – The static simulation method is used to convert the intermediate code into the target code
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8.1 Intermediate Code and Data.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 8 Code Generation.ppt
- 《NFS报文分析》讲义.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)What makes a good manager.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)Ten attributes of a good employee.doc
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:9 Project Procurement Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:8 Project Risk Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:7 Project Communication Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:6 Project HR Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:5 Project Cost Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:4 Project Time Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:3 Project Scope Management.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:2 Project The Project Management Context and Processes.ppt
- 华中科技大学:《IT项目管理》(本科)(英文版)Topic:1 Introduction to Project Management.ppt
- 深圳职业技术学院:《C语言程序设计》第九单元:共用体,枚举(乌云高娃).pdf
- 深圳职业技术学院:《C语言程序设计》第八单元:结构体(乌云高娃).pdf
- 深圳职业技术学院:《C语言程序设计》第八单元(3):指针与结构体(乌云高娃).pdf
- 深圳职业技术学院:《C语言程序设计》第八单元(2):结构体数组(乌云高娃).pdf
- 深圳职业技术学院:《C语言程序设计》第八单元(1):结构体变量的定义、引用、初始化(乌云高娃).pdf
- 深圳职业技术学院:《C语言程序设计》第七单元:指针及其应用(乌云高娃).pdf
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 5.1 Overview of Bottom-UpParsing.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 5.3 SLR(1)Parsing.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 4.1 Top-Down Parsing by Recursive-Descent.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 4.1 Top-Down Parsing byRecursive-Descent.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 1.1 Why? A Brief History.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 7.1 Memory Organization During Program Execution.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 7.4 Dynamic Memory.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 6.1 Attributes and AttributeGrammars.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 6.3 The Symbol Table.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 3.1 The Parsing Process.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 2.1 The Scanning Process.ppt
- 清华大学:《编译原理》课程教学资源_(英文译文)Chapter 2.4 From Regular Expression To DFAs.ppt
- 《多媒体技术》课程教学资源(PPT课件讲稿).ppt
- 《JAVA基础实例200题》Java例题(一).pdf
- 《JAVA基础实例200题》Java例题(二).pdf
- 《JAVA基础实例200题》Java例题(三).pdf
- 《JAVA基础实例200题》Java例题(四).pdf
- 《JAVA基础实例200题》Java例题(五).pdf
- 《JAVA基础实例200题》练习题.pdf
- 长江大学:《微型计算机技术及应用课件》第一章习题答案(李华贵).doc