VARIANT 1 :-
1) We may have IS, AD , DL in our program so we have to write ( class, its number )
2) Operand registers are written with single digit.
3) The second operand which is a memory operand, is represented by a pair of the form ( operand class, code ) Where operand class is one of C, S and L standing for constant, symbol and literal respectively.
4) The first operands may be register value for instruction. If the instruction is BC then first operand is having value 1 to 6 .
Q. Write Intermediate Representation ( IR ) and machine code for following assembly language program . (6 m)
VARIANT 2 :-
1) Variant 2 will be same for AD and DL. Only for IS the first operand is written as it is. For second operand only for literal they follow VARIANT format, rest all is written as it is from input.
Q. Compare variant 1 and variant 2 of Intermediate representation.
|Sr. No.||VARIANT 1||VARIANT 2|
|1||Extra work required in pass 1||Pass 1 performs simple task|
|2||IR is very much compact||IR is not compact.|
|3||Pass 2 per forms simple task.||Pass 2 requires extra work.|
|4||Wastage of memory takes place||Memory saving accurs.|
- WikiNote Foundation