KEMBAR78
Design of a two pass assembler | PPTX
SYSTEM PROGRAMMING
ALA
VARIANTS OF ASSEMBLERS, DESIGN OF TWO PASS ASSEMBLER
Dhananjaysinh Jhala
170410107027
TY CE 1 Batch B
DESIGN OF 2 PASS ASSEMBLER
• Tasks performed by the passes of a two pass
assembler are:
• Pass 1:
• Separate the symbol, mnemonic opcode and operand fields
• Build the symbol table
• Perform LC processing
• Construct intermediate representation
• Pass 2:
• Synthesize the target program
DESIGN OF 2 PASS ASSEMBLER
•Pass 1 uses the given data structures:
• OPTAB - table of mnemonic opcodes, class (IS,DL,AD)
and mnemonic info
• SYMTAB - symbol table
• LITTAB - table of literals used in the program
• POOLTAB - table of information concerning literal
pools
PROGRAM EXAMPLE
ALGORITHM FOR PASS 1
INTERMEDIATE CODE FORMS
• IC Consists of a sequence of IC units having 3 fields :
• Variant forms of intermediate codes, specifically the
operand and address fields are used. Information in
mnemonic code field has the same representation in
all variants.
VARIANT 1
• First operand is represented by a single digit number
which is either code used for register or condition
code itself.
• Second operand is a memory operand represented by
a pair of the form (operand class, code) where
operand class is C,S or L(constant, symbol or literal).
Note that for variant 1, 2 kinds of entries exist in the
symbol table at any time: (for defined symbol) and (for
forward references) i.e. We need to enter A in the symbol
table, suppose at entry number 'n', but at this point
address and length fields of A are not known.
VARIANT 2
• It differs from variant one because here the operand
field of intermediate code maybe in the processed
form or in the source form itself. For an AD/DL,
operand has to be in the processes form to support LC
processing.
• Symbolic references in the operand field of
intermediate statements are put in the source form
itself.
Design of a two pass assembler
Design of a two pass assembler
Design of a two pass assembler

Design of a two pass assembler

  • 1.
    SYSTEM PROGRAMMING ALA VARIANTS OFASSEMBLERS, DESIGN OF TWO PASS ASSEMBLER Dhananjaysinh Jhala 170410107027 TY CE 1 Batch B
  • 2.
    DESIGN OF 2PASS ASSEMBLER • Tasks performed by the passes of a two pass assembler are: • Pass 1: • Separate the symbol, mnemonic opcode and operand fields • Build the symbol table • Perform LC processing • Construct intermediate representation • Pass 2: • Synthesize the target program
  • 3.
    DESIGN OF 2PASS ASSEMBLER •Pass 1 uses the given data structures: • OPTAB - table of mnemonic opcodes, class (IS,DL,AD) and mnemonic info • SYMTAB - symbol table • LITTAB - table of literals used in the program • POOLTAB - table of information concerning literal pools
  • 4.
  • 6.
  • 8.
    INTERMEDIATE CODE FORMS •IC Consists of a sequence of IC units having 3 fields : • Variant forms of intermediate codes, specifically the operand and address fields are used. Information in mnemonic code field has the same representation in all variants.
  • 9.
    VARIANT 1 • Firstoperand is represented by a single digit number which is either code used for register or condition code itself. • Second operand is a memory operand represented by a pair of the form (operand class, code) where operand class is C,S or L(constant, symbol or literal).
  • 10.
    Note that forvariant 1, 2 kinds of entries exist in the symbol table at any time: (for defined symbol) and (for forward references) i.e. We need to enter A in the symbol table, suppose at entry number 'n', but at this point address and length fields of A are not known.
  • 11.
    VARIANT 2 • Itdiffers from variant one because here the operand field of intermediate code maybe in the processed form or in the source form itself. For an AD/DL, operand has to be in the processes form to support LC processing. • Symbolic references in the operand field of intermediate statements are put in the source form itself.