Transcript ppt

Pointer Analysis for
CASH Compiler Framework
Deepak Garg
Himanshu Jain
Spring 2005
Project Goals
• Andersen’s Pointer Analysis for CASH
– Flow sensitive formulation on Pegasus circuits
– Context insensitive
– Intra-procedural
• Constraint based formulation
– Solve using Banshee
• Use points-to sets to remove token edges
between loads and stores
Andersen’s Analysis (without SSA)
a
a = &b
b = &c
b
d
c
e
a = &d
d = &e
Points-to relationships
Flow Insensitive
Andersen’s Analysis (with SSA)
a
a’
b
d
c
e
a = &b
b = &c
a’ = &d
d = &e
Points-to relationships
Flow Sensitive
Implementing Andersen’s for
PEGASUS circuit
• Assign a type x to each wire x
• x has the form ref (lx, Px)
• lx is the name of a location (register/memory)
• Px is a set of types that x can point to
• Types are sets
Assignment constraint
ref (ly, Py)
Constraint: Py µ Px
copy
x=y
ref (lx, Px)
copy = hold/nop/reg/cast/eta
Join nodes
ref (ly, Py)
ref (lz, Pz)
x =  (y, z)
Constraints:
Py µ Px
Pz µ Px
ref (lx, Px)
join = mu/mux/switch
Call nodes
<malloc.0>
ref (lw, ref (“malloc”, Y))
op_cal
ref (lv, ref (lx, Px))
lx, Px and X are new
Any function name
ref (lw, _)
op_cal
ref (lv, U)
U is the universal set
Store and load
w
w
ref (lw, ref(lx, Px))
y
ref (lw, ref(lx, Px))
ref (ly, Py)
z = *w
ref (lz, Pz)
*w = y
z
Constraint: Py µ Px
Constraint: Px µ Pz
Token Dependencies
• Token dependencies depict temporal
dependence between operations
• Unnecessary token edges reduce
parallelization
• Token dependencies between load and
store operations can be removed using
points-to sets
Identifying Token Dependencies
• Just looking at token edges is not enough
load
tkand
Indirect
dependence
store
Take the
transitive closure
of token edges
Removing Token Dependencies
• Identify read and write sets for each load
and store node
load
x = *y
Read1 = {y, pts_to(y)}
Write1 = {x}
store
*u = v
Read2 = {v, u}
Write2 = {pts_to(u)}
Dependence is false
when
Read1 Å Write2 = 
Read2 Å Write1 = 
Write1 Å Write2 = 
Implementation
• Constraints are solved using Banshee
framework
• Implementation reports false dependencies
between nodes
• Very useful in detecting false dependencies
with malloc() calls
• Tested on small examples, plan to run on
real benchmarks