package-defs.scm 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. ; Copyright (c) 1993-2007 by Richard Kelsey. See file COPYING.
  2. ; The intermediate language (node tree)
  3. ; The structures VARIABLE and PRIMOP are contained in NODE. They are used
  4. ; in client language code where the NODE- names conflict.
  5. (define-structures ((node node-interface)
  6. (variable variable-interface)
  7. (primop primop-interface))
  8. (open scheme big-scheme comp-util arch parameters
  9. defrecord)
  10. (for-syntax (open scheme big-scheme let-nodes))
  11. (begin
  12. (define-syntax let-nodes
  13. (lambda (form rename compare)
  14. (expand-let-nodes form rename compare)))
  15. (define-syntax new-lambda
  16. (lambda (form rename compare)
  17. (expand-new-lambda form rename compare)))
  18. (define-syntax new-call
  19. (lambda (form rename compare)
  20. (expand-new-call form rename compare))))
  21. (files (node node) ; variable and node data structures
  22. (node primop) ; primop data structure
  23. (node node-util) ; various small utilities
  24. (node node-equal))) ; node equality
  25. ;(define node
  26. ; (let ()
  27. ; (define-structure let-nodes (export expand-let-nodes)
  28. ; (open scheme big-scheme arch)
  29. ; (files (node let-nodes)))
  30. ; (define-structures ((node node-interface)
  31. ; (variable variable-interface)
  32. ; (primop primop-interface))
  33. ; (open scheme big-scheme comp-util arch parameters)
  34. ; (for-syntax (open scheme big-scheme let-nodes))
  35. ; (begin
  36. ; (define-syntax let-nodes
  37. ; (lambda (form rename compare)
  38. ; (expand-let-nodes form rename compare))))
  39. ; (files (node node) ; variable and node data structures
  40. ; (node primop) ; primop data structure
  41. ; (node node-util) ; various small utilities
  42. ; (node node-equal) ; node equality
  43. ; (node leftovers))) ; more node utilities
  44. ; node))
  45. ; Pretty printer
  46. (define-structure pp-cps (export pp-cps)
  47. (open scheme big-scheme comp-util node structure-refs)
  48. (access i/o) ; force-output
  49. (files (node pp-cps)))
  50. ; Expander for LET-NODES, a macro for creating interconnected nodes.
  51. (define-structure let-nodes (export expand-let-nodes
  52. expand-new-lambda
  53. expand-new-call)
  54. (open scheme big-scheme arch)
  55. (files (node let-nodes)))
  56. ; Compiler Parameters
  57. ; This allows client languages to supply parameters to the compiler
  58. ; without introducing circular module dependencies.
  59. (define-structures ((parameters parameter-interface)
  60. (set-parameters (export set-compiler-parameter!)))
  61. (open scheme big-scheme)
  62. (files param))
  63. ; An enumerated type defining the standard primops.
  64. (define-structure arch (export (primop :syntax) primop-count)
  65. (open scheme enumerated)
  66. (files (node arch)))
  67. ; linearizing node trees for later reuse
  68. (define-structure node-vector (export node->vector
  69. vector->node
  70. vector->leaf-node)
  71. (open scheme big-scheme comp-util node parameters
  72. defrecord)
  73. (files (node vector)))
  74. ; Translating the input forms into simplified node trees
  75. (define-structures ((front front-interface)
  76. (front-debug front-debug-interface))
  77. (open scheme big-scheme comp-util node simplify parameters jump
  78. remove-cells flow-values)
  79. (files (front top))) ; main entry points and debugging utilities
  80. (define-structure cps-util (export cps-call cps-sequence)
  81. (open scheme big-scheme comp-util node
  82. define-record-types)
  83. (files (front cps)))
  84. ; Converting tail-recursive calls to jumps
  85. (define-structure jump (export integrate-jump-procs!
  86. find-jump-procs
  87. procs->jumps)
  88. (open scheme big-scheme comp-util node parameters ssa
  89. define-record-types)
  90. (files (front jump)))
  91. ; Program simplification and partial evaluation
  92. (define-structures ((simplify (export simplify-node))
  93. (simplify-internal simplify-internal-interface))
  94. (open scheme big-scheme comp-util node parameters node-vector)
  95. (for-syntax (open scheme big-scheme simp-patterns))
  96. (begin
  97. (define-syntax pattern-simplifier
  98. (lambda (form rename compare)
  99. (make-pattern-simplifier (cdr form) rename compare))))
  100. (files (simp simplify) ; main entry point and driver
  101. (simp call))) ; simplifiers for some of the standard primops
  102. ; Simplifying calls to lambda nodes
  103. (define-structure simplify-let (export simplify-let)
  104. (open scheme big-scheme comp-util node parameters
  105. simplify-join simplify-internal)
  106. (files (simp let)))
  107. ; Substituting lambda nodes that are bound by calls to lambda nodes,
  108. ; trying to maximize the further simplification opportunites while
  109. ; minimizing code expansion.
  110. (define-structure simplify-join (export substitute-join-arguments)
  111. (open scheme big-scheme comp-util node)
  112. (files (simp join)))
  113. ; The expander for PATTERN-SIMPLIFIER, a macro for writing algebraic
  114. ; transformations.
  115. (define-structure simp-patterns (export make-pattern-simplifier)
  116. (open scheme big-scheme defrecord fluids)
  117. (files (simp pattern)))
  118. ; Replacing cells with values passed as parameters, currently empty
  119. ; and unused (the code has not been made compatible with the current
  120. ; version of the compiler).
  121. (define-structure remove-cells (export remove-cells-from-tree)
  122. (open scheme big-scheme)
  123. (begin
  124. (define (remove-cells-from-tree . stuff)
  125. (error "REMOVE-CELLS-FROM-TREE is undefined"))))
  126. ; Flow analysis, also currently empty and unused for the same reason.
  127. (define-structure flow-values (export flow-values)
  128. (open scheme big-scheme)
  129. (begin
  130. (define (flow-values . stuff)
  131. (error "FLOW-VALUES is undefined"))))
  132. ; A random collection of utilities.
  133. (define-structure comp-util utilities-interface
  134. (open scheme big-scheme defrecord structure-refs expanding-vectors)
  135. (for-syntax (open scheme big-scheme))
  136. (access primitives features)
  137. (files (util syntax) ; macro for defining subrecords
  138. (util util))) ; random utilities
  139. (define-structure expanding-vectors (export make-xvector
  140. xvector-length
  141. xvector-ref
  142. xvector-set!
  143. xvector-length
  144. xvector->vector)
  145. (open scheme define-record-types)
  146. (files (util expand-vec)))
  147. (define-interface transitive-interface
  148. (export make-graph-from-predecessors
  149. make-graph-from-successors
  150. transitive-or! transitive-or-with-kill! transitive-or-with-pass!
  151. transitive-and! transitive-and-with-kill! transitive-and-with-pass!))
  152. (define-structure transitive transitive-interface
  153. (open scheme big-scheme integer-sets defrecord)
  154. (optimize auto-integrate)
  155. (files (util transitive)))
  156. (define-interface integer-set-interface
  157. (export make-empty-integer-set
  158. add-to-integer-set
  159. integer-set-not
  160. integer-set-ior
  161. integer-set-and
  162. integer-set-subtract
  163. integer-set-equal?
  164. map-over-integer-set))
  165. (define-structure integer-sets integer-set-interface
  166. (open scheme bitwise bigbit)
  167. (optimize auto-integrate)
  168. (files (util z-set)))
  169. (define-structure strongly-connected (export strongly-connected-components)
  170. (open scheme big-scheme defrecord)
  171. (optimize auto-integrate)
  172. (files (util strong)))
  173. (define-structure dominators (export find-dominators!)
  174. (open scheme big-scheme comp-util
  175. define-record-types)
  176. (optimize auto-integrate)
  177. (files (util dominators)))
  178. (define-structure ssa (export graph->ssa-graph! find-joins)
  179. (open scheme big-scheme dominators
  180. define-record-types)
  181. (optimize auto-integrate)
  182. (files (util ssa)))
  183. ; Vectors of bytes, a renaming of Scheme 48's code vectors.
  184. (define-structure compiler-byte-vectors compiler-byte-vector-interface
  185. (open scheme byte-vectors bitwise signals)
  186. (optimize auto-integrate)
  187. (files (util byte-vector)))
  188. ; A version of READ that annotates pairs with source file, line, and
  189. ; column information.
  190. (define-structure annotated-read annotated-read-interface
  191. ; this is correct for linking, but doesn't work when loading
  192. ;(open defrecord extended-ports primitives scheme assembler)
  193. (open scheme big-scheme primitives fluids assembler)
  194. (files (prescheme track-read)))