code generation
DESCRIPTION
Code Generation. Tiger Compiler Project. By Mu Li. Phases. Book chapter. Chapter 9-12 Codes about chapter 8 are provided. MIPS. move sw, lw add, sub, mul, div and, or jal, j, beq, bne, bgt… li, la addi, subi, … (optional) more refer to “The MIPS Info Sheet”. MIPS Registers. - PowerPoint PPT PresentationTRANSCRIPT
Tiger Compiler Project
By Mu LiBy Mu Li
2007-6-6Li, Mu([email protected]) 2
Chapter 9-12 Codes about chapter 8 are provided
2007-6-6Li, Mu([email protected]) 3
move sw, lw add, sub, mul, div and, or jal, j, beq, bne, bgt… li, la addi, subi, … (optional) more refer to “The MIPS Info Sheet”
2007-6-6Li, Mu([email protected]) 4
2007-6-6Li, Mu([email protected]) 5
2007-6-6Li, Mu([email protected]) 6
2007-6-6Li, Mu([email protected]) 7
Machine independent
Algorithm: Maximal Munch
2007-6-6Li, Mu([email protected]) 8
2007-6-6Li, Mu([email protected]) 9
Codegen generates assemble codes from IR tree, which implements Maximal Munch
2007-6-6Li, Mu([email protected]) 10
NP-hard Using a simple greed algorithm to get proper solution
Spilling is optional
2007-6-6Li, Mu([email protected]) 11
2007-6-6Li, Mu([email protected]) 12
Construct AssemFlowGraph by InstrList
Liveness analysis Generate InterferenceGraph Coloring
2007-6-6Li, Mu([email protected]) 13
Add runtime.s at end of your codes
2007-6-6Li, Mu([email protected]) 14
1. 我发现你在 XX包内写了一个 YY变量,请问这个变量干什么用的 ?
2(a) 如果我要增加一种 ZZ语句,你打算 ?
2(b) 请你说说你是怎么翻译 initArray的 ?
3(a) 杀手题…… 3(b) 为什么你和张三的程序如此像 ?
2007-6-6Li, Mu([email protected]) 15
Deadline is 30th June NO cheating!
ftp://compiler:[email protected]/Final/
2007-6-6Li, Mu([email protected]) 16
Plz find out the comments written by Qian, Feng
2007-6-6Li, Mu([email protected]) 17