Professional Documents
Culture Documents
Lecture 03 The-Backend (CC)
Lecture 03 The-Backend (CC)
CONSTRUCTION
Lecture 3
SYNTAX TREE goal
x+2-y expr
expr op term
3
ABSTRACT SYNTAX TREES
+ <id,y>
<id,x> <number,2>
4
ABSTRACT SYNTAX TREES
–
+ <id,y>
<id,x> <number,2>
+ <id,y>
<id,x> <number,2>
errors
7
THE BACK END
8
THE BACK END
9
THE BACK END
errors
Instruction Selection:
•Produce fast, compact code.
10
THE BACK END
IR Instruction IR Register IR Instruction machine
selection allocation scheduling code
errors
Instruction Selection:
• Take advantage of target features such as
addressing modes.
11
THE BACK END
IR Instruction IR Register IR Instruction machine
selection allocation scheduling code
errors
Instruction Selection:
• Usually viewed as a pattern matching
problem – dynamic programming.
12
THE BACK END
errors
Register Allocation:
•Have each value in a register when
it is used. 13
THE BACK END
errors
Register Allocation:
•Manage a limited set of resources –
register file. 14
THE BACK END
errors
Instruction Scheduling:
•Avoid hardware stalls and
interlocks. 15
THE BACK END
errors
Instruction Scheduling:
•Use all functional units
productively. 16