ic4 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .NH 2
  2. External representation of the intermediate code
  3. .PP
  4. The syntax of the intermediate code was given
  5. in the previous section.
  6. In this section we will make some remarks about
  7. the representation of the code in sequential files.
  8. .sp
  9. We use sequential files in order to avoid
  10. the bookkeeping of complex file indices.
  11. As a consequence of this decision
  12. we can't store all components
  13. of the intermediate code
  14. in one file.
  15. If a phase wishes to change some attribute
  16. of a procedure,
  17. or wants to add or delete entire procedures
  18. (inline substitution may do the latter),
  19. the procedure table will only be fully updated
  20. after the entire EM text has been scanned.
  21. Yet, the next phase undoubtedly wants
  22. to read the procedure table before it
  23. starts working on the EM text.
  24. Hence there is an ordering problem, which
  25. can be solved easily by putting the
  26. procedure table in a separate file.
  27. Similarly, the data block table is kept
  28. in a file of its own.
  29. .PP
  30. The control flow graphs (CFGs) could be mixed
  31. with the EM text.
  32. Rather, we have chosen to put them
  33. in a separate file too.
  34. The control flow graph file should be regarded as a
  35. file that imposes some structure on the EM-text file,
  36. just as an overhead sheet containing a picture
  37. of a Flow Chart may be put on an overhead sheet
  38. containing statements.
  39. The loop tables are also put in the CFG file.
  40. A loop imposes an extra structure on the
  41. CFGs and hence on the EM text.
  42. So there are four files:
  43. .IP -
  44. the EM-text file
  45. .IP -
  46. the procedure table file
  47. .IP -
  48. the object table file
  49. .IP -
  50. the CFG and loop tables file
  51. .LP
  52. Every table is preceded by its length, in order to
  53. tell where it ends.
  54. The CFG file also contains the number of instructions of
  55. every basic block,
  56. indicating which part of the EM text belongs
  57. to that block.
  58. .DS
  59. .UL syntax
  60. .TS
  61. lw(1i) l l.
  62. intermediate_code:
  63. object_table_file
  64. proctable_file
  65. em_text_file
  66. cfg_file ;
  67. object_table_file:
  68. LENGTH -- number of objects
  69. object_table ;
  70. proctable_file:
  71. LENGTH -- number of procedures
  72. procedure_table ;
  73. em_text_file:
  74. em_text ;
  75. cfg_file:
  76. {per_proc} ; -- one for every procedure
  77. per_proc:
  78. BLENGTH -- number of basic blocks
  79. LLENGTH -- number of loops
  80. control_flow_graph
  81. looptable ;
  82. .TE
  83. .DE