






















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Mahlke; Class: Advanced Compilers; Subject: Electrical Engineering And Computer Science; University: University of Michigan - Ann Arbor; Term: Winter 2003;
Typology: Study notes
1 / 30
This page cannot be seen from the preview
Don't miss anything!























Compiler Backend IR – Our input^ Y^ Variable home location
All temporaries put into registers y All local scalars put into registers, except those accessed via & y All globals, local arrays/structs, unpromotable local scalars put inmemory. Accessed via load/store.
Virtual registers – infinite number of these X Special registers – stack pointer, pc, etc (macro regs) X Literals – compile-time constants
Basic Block (BB)^ Y^ Group operations into units with equivalent executionconditions^ Y^ Defn: Basic block
Identifying BBs - Example
Weighted CFG^ Y^ Profiling
edge profile y block profile
Optimize for the commoncase » Make educated guess
Entry^20 BB1 BB2^ BB3^ BB4 BB5 BB6^ BB7^ Exit 10
Dominator^ Y^ Defn: Dominator
Dominator Analysis^ Y^ Compute dom(BBi) = set ofBBs that dominate BBi^ Y^ Initialization
change = false y for each BB (except theentry BB)^ X^ tmp(BB) = BB + {intersectof Dom of all predecessorBB’s}^ X^ if (tmp(BB) != dom(BB))^ ± dom(BB) = tmp(BB) ± change = true
Entry^ BB1 BB2^ BB3^ BB4 BB5 BB6^ BB7^ Exit
Immediate Dominator^ Y^ Defn: Immediate dominator^ (idom)– Each node n has aunique immediate dominator mthat is the last dominator of non any path from the initialnode to n »^ Closest node that dominates
Entry^ BB1 BB2^ BB3^ BB4 BB5 BB6^ BB7^ Exit
Post Dominator^ Y^ Reverse of dominator^ Y^ Defn: Post Dominator
Post Dominator Examples
Entry^ BB1 BB2^ BB3^ BB4 BB5 BB6^ BB7^ Exit
Entry
BB1 BB6 Exit
Immediate Post Dominator^ Y^ Defn: Immediate post^ dominator
Entry^ BB1 BB2^ BB3^ BB4 BB5 BB6^ BB7^ Exit
Class Problem 2
Entry^ BB
Calculate the PDOM set for each BB
BB6 BB7 Exit
Natural Loops^ Y^ Cycle suitable for optimization
Header dominates
all blocks in the loop
Backedge Example
Entry
BB1 BB6 Exit