Predicate Sensitive Dataflow Analysis - Lecture Slides - Fall 2006 | EECS 583, Study notes of Electrical and Electronics Engineering

Material Type: Notes; Professor: Mahlke; Class: Advanced Compilers; Subject: Electrical Engineering And Computer Science; University: University of Michigan - Ann Arbor; Term: Winter 2006;

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-ef9
koofers-user-ef9 🇺🇸

9 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EECS 583 – Class 9
Predicate Sensitive Dataflow
Analysis
University of Michigan
February 8, 2006
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Predicate Sensitive Dataflow Analysis - Lecture Slides - Fall 2006 | EECS 583 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

EECS 583 – Class 9 Predicate Sensitive DataflowAnalysis

University of Michigan February 8, 2006

  • 1 -

Reading Material

Y

Today’s class^ »

“Analysis Techniques for Predicated Code”, R. Johnson and M. Schlansker, MICRO-29, 1996

Y

Material for the next lecture^ »

Compilers: Principles, Techniques, and Tools

A. Aho, R. Sethi, and J. Ullman, Addison-Wesley, 1988, 9.9, 10.2, 10.3, 10.

»^

“Compiler Code Transformations for Superscalar-Based High-Performance Systems”, S. Mahlke et al., Supercomputing '92,Nov. 1992, pp. 808-817.

  • 3 -

Two Types of Analysis Y

Predicate relation analysis^ »

Properties about the values thatpredicates can take on »^

Disjoint

= 2 predicates never

true at the same time »^

Superset

= 1 predicate true

more often »^

Subset

= 1 predicate true less

often »^

Predicate query system

Y

Predicate-sensitive dataflowanalysis^ »

Calculate dataflow informationon predicated code »^

GEN/KILL now occur on acertain predicate (not always)

t = pclearx =p,q = cmpp.uc.un (a<b)t = cmpp.oc(a<b)x =

if p

x =

if q

r,s = cmpp.un.uc(c!=d)

if q

t = cmpp.on(c!=d)

if q

x =

if s

= y

if r

= x

if t

= x

  • 4 -

Predicate Relation Analysis Y

Execution trace

  • record of boolean

values assigned to predicates duringan execution of a predicate block^ »

1 = all execution traces

Y

Execution set

for predicate p – set

of traces in which p is True^ »

Denoted as P »^

P is a subset of 1

Y

Code segment^ »

Execution traces^ y

trace

p^

q^

r^

s^

t

y^

e

1

0

0

0

1

y^

e

0

1

1

0

1

y^

e

0

1

0

1

0

»^

Execution sets^ y

P = {e1}, Q = {e2,e3}, R = {e2}, S= {e3}, T = {e1,e2}, 1 ={e1,e2,e3}

t = pclear x = p,q = cmpp.uc.un (a<b) t = cmpp.oc(a<b) x =

if p

x =

if q

r,s = cmpp.un.uc(c!=d)

if q

t = cmpp.on(c!=d)

if q

x =

if s

= y

if r

= x

if t

= x

p^

q r^

s

t

  • 6 -

Class Problem – Create the Execution Sets^ r = pclear^ x =^ p,q = cmpp.un.uc (a == b)^ x =

if p

x =

if q

r,s = cmpp.on.uc(c < d)

if p

r,t = cmpp.on.uc(e > f)

if s

u,v = cmpp.un.uc

if r

x =

if s

x =

if v

= x

if r

x =

if t

= x

What is r + t??

  • 7 -

Partitioning by a CMPP

Y

m,n = cmpp.un.uc (i < k) if u^ »

If m or n is true, then u must be true

»^

If m is true, then n must be false (+ the reverse)

»^

If u is true, then one of m or n is true

»^

If u is false, then both m and n are false

Y

Execution sets^ »

M union N <= U

»^

M intersect N = Null

»^

U <= M union N

Y

U is partitioned into disjoint subsets M and N, U = M | N

u m

n

  • 9 -

Partition Graph Y

Partition Graph

  • Directed

acyclic graph where nodesrepresent execution sets andedges represent partitionrelations between nodes^ »

U = M | N

»^

Edge from U to M »^

Edge from U to N »^

U

Æ

M and U

Æ

N denoted to

come from same partition

Y

Complete

  • Contains a unique

node having no predecessorsfrom which all nodes arereachable

p = (a<b) * true q = !(a<b) * true r = (c>d) * p s = !(c>d) * p u = (e!=5) * true v = !(e!=5) * true

p^

q^

u^

v

r^

s

  • 10 -

Partition Graph Properties Y

Root

= unique node with no

predecessors

Y

Leaf

= node with no

successors

Y

Ancestor

of P = any node on

path from root to P

Y

Descendant

of P = any node

reachable from P

Y

Level

= shortest-path distance

from root^ »

Level(root) = 0

Y

Lowest common ancestor

node with largest level fromthe common ancestors

p = (a<b) * true q = !(a<b) * true r = (c>d) * p s = !(c>d) * p u = (e!=5) * true v = !(e!=5) * true

p^

q^

u^

v

r^

s

  • 12 -

Synthesizing New Partitions

1 p^

q r^

s

p^

q r^

s

t^

t^ lca(p,r) = 1^ 1 – t = 1 – (p + r) = 1 – p – r = s

Identify partition, U = M|N where U is not reachable from 1 If M,N are reachable from 1, then there exists a partition

lca(M,N) = U|V, where V is the relative complement

of U with respect to lca(M,N)

  • 13 -

Class Problem – Create the Partition Graph^ r = pclear^ x =^ p,q = cmpp.un.uc (a == b)^ x =

if p

x =

if q

r,s = cmpp.on.uc(c < d)

if p

r,t = cmpp.on.uc(e > f)

if s

u,v = cmpp.un.uc

if r

x =

if s

x =

if v

= x

if r

x =

if t

= x

  • 15 -

Implementing PQS Functions in 1-dnf

1 p^

q r^

s

is_disjoint(p,q) = if there is a partition with p on 1 side, q on the other, then disjoint is_subset(p,q) = if q is an ancestor, then p is a subset lub_sum(p, E) = return p + qi for all qi in E. (Remove redundant/subsumed terms)

t

Examples:

Are p and s disjoint? Are t and p disjoint? Is r a subset of p? Is s a subset of q? s + {q} =? r + {s} =? p + {r,s} =?

  • 16 -

Implementing PQS Functions in 1-dnf (2) lub_diff(E, p) = return Sum(qi-p) for all qi in E. 4 subcases

  1. qi <= p

Æ

qi removed, E += NULL

  1. p <= qi

Æ

E += rel_cmpl(p,qi)

  1. p,qi disjoint

Æ

E += qi

  1. otherwise

Æ

E += approx_diff(p,q)

/* q – p */ approx_diff(p,q)

relative_complement(p, lca(p,q)) relative_complement(p,q)

find a path from q to p E = false for each edge r

Æ

s on path do

let R = S|Ti be the partition

containing r

Æ

s

add Ti to E return E

1 p^

q r^

s

t

Examples: {q} – r =? {q} – p =? {t} – r =? {t} – s =?

  • 18 -

Predicate-Sensitive Liveness

Destination operands

GEN’

GEN’(x) = GEN(x) – Q KILL’(x) = KILL(x) + Q

x = y + 1 if q

Source (data) operands GEN’(y) = GEN(y) + Q KILL’(y) = KILL(y) - Q

GEN

Source (predicate) operands

backward analysis

GEN’(q) = GEN(q) + true = true KILL’(q) = KILL(q) – true = false

  • = lub_sum - = lub_diff
  • 19 -

What About UN/UC CMPP’s?

Destination operands

GEN’

GEN’(p) = GEN(p) – true = false KILL’(p) = KILL(p) + true = true

p = cmpp.un(a<1) if q

Source (data) operands GEN’(a) = GEN(a) + true = true KILL’(a) = KILL(a) – true = false

GEN

Source (predicate) operands

backward analysis

GEN’(q) = GEN(q) + true = true KILL’(q) = KILL(q) – true = false