Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

DAG- Directed Acyclic Graphs

• Depicts the structure of basic blocks


• Helps to see the flow of values flowing among the basic blocks, and
offers optimization too
• Provides easy transformation on basic blocks
• Gives a pictorial view of how the value computed by a statement is
used in subsequent statements
• DAG can be represented as:
• Leaf nodes represent identifiers, variable names and constants
• Interior nodes are labelled with an operator
• Interior nodes also represent the results of expressions or the
identifiers/name where the values are to be stored or assigned

09/04/2022 1
Applications of DAG

• We can
• Automatically detect common sub expressions
• Determine which identifiers have their values used in the
block
• Determine which statements compute values that could
be used outside the block

09/04/2022 2
Example
t0 = a + b
t1 = t0 + c
d = t0 + t1

3
4
5
09/04/2022 6
09/04/2022 7
09/04/2022 8

You might also like