Program Representation
Dominator Relationships
Last Time
Dominators
Live variable analysis
Constant propagation
leads us to SSA and how to connect uses and def
Today
DOM(v) = the set of all vertices
Advanced Topics
Alias Analysis
Last Time
What is pointer analysis?
Experimental Methodology
For umanaged languages like C, C+, and
managed languages like C#, Java, Modula-3
Today
Goal: given two me
Interprocedural Analysis
Dealing with Procedures
Course so far:
Terminology
Control Flow Representation
Dataow Representation
SSA form
Classic DefUse and UseDef Chains
Optimizations
Scheduling
Advanced Topics
Which Loops are Parallel?
Optimization for parallel machines and memory
hierarchies
review
do I = 1, N
do J = 1, N
S1
A(I,J) = A(I,J-1) + 1
Last Time
do I = 1, N
do J = 1, N
S2
A(I,J)
Compiling for EDGE Architectures:
The TRIPS Prototype Compiler
KathrynMcKinley
DougBurger,SteveKeckler,
JimBurrill1,XiaChen,KatieCoons,SundeepKushwaha,BertMaher,Nick
Nethercote,AaronSmith,BillYoder
et
Compiling for EDGE Architectures:
The TRIPS Prototype Compiler
KathrynMcKinley
DougBurger,SteveKeckler,
JimBurrill1,XiaChen,KatieCoons,SundeepKushwaha,BertMaher,Nick
Nethercote,AaronSmith,BillYoder
et
CS 380C
Advanced Compiler
Techniques
KathrynSMcKinley
TheUniversityofTexasatAustin
Lecture26
CS380C
1
Goals
Intellectual development
Critical thinking and writing about original
source material
Sof
CS 380C: Advanced Topics in Compilers
Assignment 3: Loop analysis
Due: February 18th
February 11, 2016
Late submission policy: Submission can be at the most 2 days late. There will be a 10%
penalty fo
CS 380C: Advanced Topics in Compilers
Assignment 6: Assembly Code Generation
Due: March 31st
March 3, 2016
Late submission policy: Submission can be at the most 2 days late. There will be a 10%
penalt
Putting Data Flow Analysis to Work
Last Time
Iterative Worklist Algorithm via Reaching Denitions
Live Variable Analysis
Can a variable v at a point p be used before it is
redened along some path start
More Data Flow Analysis
Work List Iterative Algorithm
Last Time
for v V
/
IN(v) = 0
OUT(v) = GEN(v)
endfor
worklist v V
/
while ( worklist = 0 )
pick and remove a node v from worklist
Data Flow Analy
Data Flow Analysis and Optimizations
Last Time
Data Flow Analysis
Data ow analysis tells us things we want to know
about programs, for example:
Control Flow Graphs
Is this computation loop invariant
Control Flow Analysis
Computing Static Single Assignment (SSA) Form
Last Time
Overview
Constant propagation
What is SSA?
Dominator relationships
Advantages of SSA over use-def chains
Flavors of S
Optimization
Loop Optimization
Loops are important, they execute often
Last Time
Building SSA
typically, some regular access pattern
regularity opportunity for improvement
repetition savings are mult
More Optimizations
Common Subexpression Elimination (Example)
Given A[i][j] = A[i][j] + 1, and assuming
Last Time
Loop invariant code motion
1. row-major order
Loop induction variables
2. each array
Scheduling
What makes instruction scheduling hard?
Previously
Instruction data path
Value Numbering
IF
Reg
ALU
DM
Reg2
Today: Scheduling to Minimize Register pressure
IF: Instruction Fetch
Reg: Instr
Where we are
Register Allocation via Graph Coloring
Course so far
The abstraction
Program representation
G. J. Chaitin, M. A. Auslander, A. K. Chandra, J.
Cocke, M. E. Hopkins, and P. W. Markstein,
Graph Coloring Register Allocation
Rematerialization
Some expressions are especially simple to recompute:
Last Time
Chaitin et al.
Operands are constant
(though not necessarily known)
Briggs et al.
Dynamic Compilation
Inlining
Advanced Topics:
Benets and costs
Dynamic compilation
Direct benet: reduced call overhead
Today:
allocating and deallocating local variables
Finish How to Compile
sav
Solving fixpoint equations
Goal
Many problems in programming languages can be formulated as the
solution of a set of mutually recursive equations:
D: set, f,g:DxD D
x = f(x,y)
y = g(x,y)
Examples
Par