Difficulty: Medium
Correct Answer: Machine-independent optimization
Explanation:
Introduction / Context:
Compilers often translate source into an intermediate representation (IR) such as a graph or matrix-like structure (e.g., three-address code, quadruples). Improving this IR prior to target-specific steps is the domain of machine-independent optimizations.
Given Data / Assumptions:
Concept / Approach:
Machine-independent optimization applies algebraic simplification, constant folding, common subexpression elimination, dead-code elimination, loop optimizations, and data-flow improvements on the IR. These changes are target-agnostic and aim to reduce work regardless of the eventual machine.
Step-by-Step Solution:
Generate IR from the parsed PL/I program.Analyze data/control flow to identify redundancies and opportunities.Apply optimizations (CSE, DCE, loop-invariant code motion, strength reduction).Produce a refined IR (the “more optimal matrix”) for the backend.
Verification / Alternative check:
Comparing pre- and post-optimization IR typically shows fewer operations and improved locality, and later code generation emits shorter, faster target code without altering program semantics.
Why Other Options Are Wrong:
Assembly/output and code generation are target-dependent phases following optimization.Syntax analysis builds parse trees; it does not optimize the IR.
Common Pitfalls:
Final Answer:
Machine-independent optimization.
Discussion & Comments