COMPILER DESIGN

SEMANTIC ANALYSIS

TYPE CHECKING

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
DAG helps in detecting
A
Common sub expression elimination
B
Constant propagation
C
Constant folding
D
None
Explanation: 

Detailed explanation-1: -DAG is used to find common subexpressions. It is used to determine the names used within the block and the names computed outside the block. It determines which statements in the block’s computed value may be used outside the block.

Detailed explanation-2: -DAG provides a good way to determine the common sub-expression. It gives a picture representation of how the value computed by the statement is used in subsequent statements.

Detailed explanation-3: -DAGs are useful for representing many different types of flows, including data processing flows. By thinking about large-scale processing flows in terms of DAGs, one can more clearly organize the various steps and the associated order for these jobs.

Detailed explanation-4: -Dead Code Elimination The operation on DAG’s that corresponds to dead-code elimination can be im-plemented as follows. We delete from a DAG any root (node with no ancestors) that has no live variables attached. Repeated application of this transformation will remove all nodes from the DAG that correspond to dead code.

There is 1 question to complete.