Machine-translated by Google. Questions are authored in English.
Top

Intermediate Code Generation Questions and Answers

Answer: C

Actions emit instructions as productions are reduced or procedures return. Forward references are handled by backpatching, since the destination may not yet be known. Nothing can be revisited once the parser has moved past it.

Please log in or register to report this question.

82.

Consider the following statements about three address code.
1. Each instruction names at most three addresses.
2. Temporaries are introduced for intermediate results.
3. The form is tied to a particular target instruction set.

Answer: D

Correct answer: 1 and 2 only

Statements 1 and 2 give the form correctly: at most three addresses per instruction, with temporaries introduced for intermediate results. Statement 3 denies the whole purpose of the representation - it is deliberately machine independent, which is what allows one optimiser and many back ends.

Please log in or register to report this question.

Answer: A

Instruction selection and scheduling work on a sequence. A tree must be linearised first, which is one of the tasks the intermediate code generator performs. Flattening also fixes the evaluation order, which the tree left open.

Please log in or register to report this question.

Answer: B

Rewriting a construct means rearranging nodes rather than renumbering instructions. Source level transformations are therefore normally done before the program is flattened. Loop interchange and unrolling are far easier to express on a tree.

Please log in or register to report this question.

Answer: C

Correct answer: fix the order in which the operands are evaluated

Once an operand has a side effect, the order in which the operands are evaluated changes what the program does. Generating code fixes that order, so the compiler must choose one consistent with whatever the language guarantees - and where the language leaves it unspecified, two conforming compilers may legitimately differ.

Please log in or register to report this question.

Answer: D

There is nothing to optimise until the representation exists. Machine independent optimisation sits between generation and code generation for exactly this reason. Each phase operates on the representation best suited to what it does.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Intermediate Code Generation Questions and Answers || Intermediate Code Generation MCQ Questions and Answers || Intermediate Code Generation GK Questions and Answers || Intermediate Code Generation GK MCQ Questions || Intermediate Code Generation Multiple Choice Questions and Answers || Intermediate Code Generation GK || GK on Intermediate Code Generation || Compiler Design Questions and Answers || Compiler Design MCQ Questions and Answers || Compiler Design GK Questions and Answers || GK on Compiler Design