0
0
Compiler Designknowledge~10 mins

Available expressions analysis in Compiler Design - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define an expression as available at a program point if it has been computed and not invalidated.

Compiler Design
An expression is considered available at a point if it has been computed on all paths leading to that point and [1].
Drag options to blanks, or click blank then click option'
Anot modified afterwards
Brecomputed later
Cnever used
Dalways constant
Attempts:
3 left
💡 Hint
Common Mistakes
Assuming an expression is available if it was computed once anywhere.
Ignoring changes to variables used in the expression.
2fill in blank
medium

Complete the code to represent the transfer function for available expressions in a basic block.

Compiler Design
OUT[B] = GEN[B] ∪ (IN[B] [1] KILL[B])
Drag options to blanks, or click blank then click option'
A*
B-
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using union instead of difference for removing killed expressions.
Confusing arithmetic operators with set operations.
3fill in blank
hard

Fix the error in the data flow equation for IN[B] in available expressions analysis.

Compiler Design
IN[B] = [1](OUT[P]) for all predecessors P of B
Drag options to blanks, or click blank then click option'
Aunion
Bsymmetric_difference
Cdifference
Dintersection
Attempts:
3 left
💡 Hint
Common Mistakes
Using union instead of intersection, which overestimates availability.
Using difference or symmetric difference which are incorrect here.
4fill in blank
hard

Fill both blanks to complete the iterative algorithm step for available expressions.

Compiler Design
IN[B] = [1](OUT[P]) for all predecessors P of B
OUT[B] = GEN[B] ∪ (IN[B] [2] KILL[B])
Drag options to blanks, or click blank then click option'
Aintersection
Bunion
C-
D+
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing union and intersection in the wrong places.
Using addition instead of set difference.
5fill in blank
hard

Fill all three blanks to define the initial conditions and transfer function for available expressions analysis.

Compiler Design
For entry block E:
IN[E] = [1]
For other blocks B:
IN[B] = [2](OUT[P]) for all predecessors P of B
OUT[B] = GEN[B] ∪ (IN[B] [3] KILL[B])
Drag options to blanks, or click blank then click option'
Aempty set
Bintersection
C-
Duniversal set
Attempts:
3 left
💡 Hint
Common Mistakes
Assuming entry block has all expressions available initially.
Using union instead of intersection for IN[B].
Using addition instead of set difference for OUT[B].