GATE / CS ARCHIVE

GATE CSE 1992 / QUESTION 3(ii.b)

Literal-table insertion pass

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 1992 paper

GATE 1992, Q3(ii.b) Descriptive
Report issue

Compiler Phases, Linking & Loading

Question 3(ii.b), GATE 1992: In a conventional two-pass assembler, in which pass are literals added to the literal table?
Question 3(ii.b), GATE 1992: In a conventional two-pass assembler, in which pass are literals added to the literal table?
Question 3(ii.b), GATE 1992: In a conventional two-pass assembler, in which pass are literals added to the literal table?
Tap to enlarge
Answer & solution

Answer: Pass1 (no official key was published)

When pass1 encounters a literal operand, it records its value and storage needs in the literal table. Literal-pool directives or the end of a section determine placement, which must be included in layout before addresses are finalized. Pass2 can then use the assigned literal addresses while emitting instructions and literal data. Adding the literals only after computing all addresses would require revising the layout. Thus entry into the table is a first-pass activity, distinct from outputting its bytes.

Original paper, page 4