In the compilation of a PL/I program, the term “machine-independent optimization” refers to optimizations applied on an intermediate representation (IR) before code is tailored to a specific CPU. Which choice captures this idea most closely?

Difficulty: Medium

Correct Answer: creation of more optimal intermediate code (matrix) independent of the target machine

Explanation:


Introduction / Context:
Modern compilers typically divide optimization into two broad classes: machine-independent and machine-dependent. Machine-independent optimization operates on an intermediate representation (IR) and is agnostic of specific instruction sets, pipelines, or microarchitectural details. This question focuses on recognizing that distinction in the PL/I compilation pipeline.


Given Data / Assumptions:

  • PL/I or a similar high-level language.
  • Standard multi-phase compiler: lexical analysis, parsing, IR generation, optimization, and code generation.
  • “Matrix” refers to an IR form (three-address code, quadruples, or similar).


Concept / Approach:
Machine-independent optimizations include constant folding, common subexpression elimination, dead code elimination, copy propagation, loop-invariant code motion, and strength reduction performed on IR. They improve efficiency regardless of the final hardware, whereas machine-dependent steps tune instruction selection, scheduling, and register allocation to a particular target.


Step-by-Step Solution:

Separate concerns: front-end builds a correct IR; optimizer refines it in a target-neutral way.Identify examples: remove redundant calculations, fold constants, and hoist invariants in loops.Result: a “more optimal matrix/IR” ready for target-specific code generation.


Verification / Alternative check:
Compare outputs with and without optimization flags at the IR level; improvements are visible even before register allocation or instruction selection occur.


Why Other Options Are Wrong:

(a) Parsing reductions are part of syntax analysis, not optimization.(b) Lexical analysis creates tokens/uniform symbols; not optimization.(d) Macro processing is a separate preprocessing technique and is not the core of machine-independent optimization.(e) Incorrect because (c) correctly states the concept.


Common Pitfalls:
Conflating macro processing or parsing with optimization; assuming optimization must be tied to a specific CPU rather than performed generically on IR.


Final Answer:
creation of more optimal intermediate code (matrix) independent of the target machine.

More Questions from Language Processors

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion