1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- .NH 2
- External representation of the intermediate code
- .PP
- The syntax of the intermediate code was given
- in the previous section.
- In this section we will make some remarks about
- the representation of the code in sequential files.
- .sp
- We use sequential files in order to avoid
- the bookkeeping of complex file indices.
- As a consequence of this decision
- we can't store all components
- of the intermediate code
- in one file.
- If a phase wishes to change some attribute
- of a procedure,
- or wants to add or delete entire procedures
- (inline substitution may do the latter),
- the procedure table will only be fully updated
- after the entire EM text has been scanned.
- Yet, the next phase undoubtedly wants
- to read the procedure table before it
- starts working on the EM text.
- Hence there is an ordering problem, which
- can be solved easily by putting the
- procedure table in a separate file.
- Similarly, the data block table is kept
- in a file of its own.
- .PP
- The control flow graphs (CFGs) could be mixed
- with the EM text.
- Rather, we have chosen to put them
- in a separate file too.
- The control flow graph file should be regarded as a
- file that imposes some structure on the EM-text file,
- just as an overhead sheet containing a picture
- of a Flow Chart may be put on an overhead sheet
- containing statements.
- The loop tables are also put in the CFG file.
- A loop imposes an extra structure on the
- CFGs and hence on the EM text.
- So there are four files:
- .IP -
- the EM-text file
- .IP -
- the procedure table file
- .IP -
- the object table file
- .IP -
- the CFG and loop tables file
- .LP
- Every table is preceded by its length, in order to
- tell where it ends.
- The CFG file also contains the number of instructions of
- every basic block,
- indicating which part of the EM text belongs
- to that block.
- .DS
- .UL syntax
- .TS
- lw(1i) l l.
- intermediate_code:
- object_table_file
- proctable_file
- em_text_file
- cfg_file ;
- object_table_file:
- LENGTH -- number of objects
- object_table ;
- proctable_file:
- LENGTH -- number of procedures
- procedure_table ;
- em_text_file:
- em_text ;
- cfg_file:
- {per_proc} ; -- one for every procedure
- per_proc:
- BLENGTH -- number of basic blocks
- LLENGTH -- number of loops
- control_flow_graph
- looptable ;
- .TE
- .DE
|