GATE / CS ARCHIVE

GATE CSE 2014 SET 3 / QUESTION 17

GATE CSE 2014 Set 3 Q17

Compiler Design · Code Optimization & Data-Flow Analysis · Full GATE CSE 2014 Set 3 paper

GATE 2014 Set 3, Q17 1 mark · MCQ
Report issue

Code Optimization & Data-Flow Analysis

Question 17, GATE 2014: Which is a purpose of intermediate code in a compiler? A simplify parsing and semantic analysis; B improve error recovery/reporting; C increase reuse of a machine-independent optimizer across compilers; D improve register allocation.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step 1: Separate a compiler into a source-language front end, an optimizer and a target-machine back end. A shared intermediate representation gives the middle portion a common input/output language. Step 2: The same machine-independent optimization passes can then be used for several source languages or machine targets. This directly explains C. Step 3: Parsing and semantic analysis are primarily front-end tasks, and register allocation is a later target-related task. Intermediate code may assist a design, but the other choices do not state its principal reuse motivation.

Original paper, page 56 · Answer key