1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-29 06:20:30 +02:00

$primcall has a "param" member

* module/language/cps.scm ($primcall): Add "param" member, which will be
  a constant parameter to the primcall.  The idea is that constants used
  by primcalls as immediates don't need to participate in optimizations
  in any way -- they should not participate in CSE, have the same
  lifetime as the primcall so not part of DCE either, and don't need
  slot allocation.  Indirecting them through a named $const binding is
  complication for no benefit.  This change should eventually improve
  compilation time and memory usage, once we fully take advantage of it,
  as the number of labels and variables will go down.
* module/language/cps/closure-conversion.scm:
* module/language/cps/compile-bytecode.scm:
* module/language/cps/constructors.scm:
* module/language/cps/contification.scm:
* module/language/cps/cse.scm:
* module/language/cps/dce.scm:
* module/language/cps/effects-analysis.scm:
* module/language/cps/elide-values.scm:
* module/language/cps/handle-interrupts.scm:
* module/language/cps/licm.scm:
* module/language/cps/peel-loops.scm:
* module/language/cps/prune-bailouts.scm:
* module/language/cps/prune-top-level-scopes.scm:
* module/language/cps/reify-primitives.scm:
* module/language/cps/renumber.scm:
* module/language/cps/rotate-loops.scm:
* module/language/cps/self-references.scm:
* module/language/cps/simplify.scm:
* module/language/cps/slot-allocation.scm:
* module/language/cps/specialize-numbers.scm:
* module/language/cps/specialize-primcalls.scm:
* module/language/cps/split-rec.scm:
* module/language/cps/type-checks.scm:
* module/language/cps/type-fold.scm:
* module/language/cps/types.scm:
* module/language/cps/utils.scm:
* module/language/cps/verify.scm:
* module/language/tree-il/compile-cps.scm: Adapt all users.
This commit is contained in:
Andy Wingo 2017-11-01 11:57:16 +01:00
parent 2d8c75f9f2
commit c54c151eb6
29 changed files with 427 additions and 420 deletions

View file

@ -172,9 +172,9 @@ by a label, respectively."
(return (get-defs k) (intset-add (vars->intset args) proc)))
(($ $callk _ proc args)
(return (get-defs k) (intset-add (vars->intset args) proc)))
(($ $primcall name args)
(($ $primcall name param args)
(return (get-defs k) (vars->intset args)))
(($ $branch kt ($ $primcall name args))
(($ $branch kt ($ $primcall name param args))
(return empty-intset (vars->intset args)))
(($ $values args)
(return (get-defs k) (vars->intset args)))
@ -333,38 +333,40 @@ the definitions that are live before and after LABEL, as intsets."
(match exp
(($ $const)
empty-intset)
(($ $primcall (or 'load-f64 'load-u64 'load-s64) (val))
;; FIXME: Move all of these instructions to use $primcall
;; params.
(($ $primcall (or 'load-f64 'load-u64 'load-s64) #f (val))
empty-intset)
(($ $primcall 'free-ref (closure slot))
(($ $primcall 'free-ref #f (closure slot))
(defs+ closure))
(($ $primcall 'free-set! (closure slot value))
(($ $primcall 'free-set! #f (closure slot value))
(defs+* (intset closure value)))
(($ $primcall 'cache-current-module! (mod . _))
(($ $primcall 'cache-current-module! #f (mod . _))
(defs+ mod))
(($ $primcall 'cached-toplevel-box _)
(($ $primcall 'cached-toplevel-box #f _)
defs)
(($ $primcall 'cached-module-box _)
(($ $primcall 'cached-module-box #f _)
defs)
(($ $primcall 'resolve (name bound?))
(($ $primcall 'resolve #f (name bound?))
(defs+ name))
(($ $primcall 'make-vector/immediate (len init))
(($ $primcall 'make-vector/immediate #f (len init))
(defs+ init))
(($ $primcall 'vector-ref/immediate (v i))
(($ $primcall 'vector-ref/immediate #f (v i))
(defs+ v))
(($ $primcall 'vector-set!/immediate (v i x))
(($ $primcall 'vector-set!/immediate #f (v i x))
(defs+* (intset v x)))
(($ $primcall 'allocate-struct/immediate (vtable nfields))
(($ $primcall 'allocate-struct/immediate #f (vtable nfields))
(defs+ vtable))
(($ $primcall 'struct-ref/immediate (s n))
(($ $primcall 'struct-ref/immediate #f (s n))
(defs+ s))
(($ $primcall 'struct-set!/immediate (s n x))
(($ $primcall 'struct-set!/immediate #f (s n x))
(defs+* (intset s x)))
(($ $primcall (or 'add/immediate 'sub/immediate
'uadd/immediate 'usub/immediate 'umul/immediate
'ursh/immediate 'ulsh/immediate)
'ursh/immediate 'ulsh/immediate) #f
(x y))
(defs+ x))
(($ $primcall 'builtin-ref (idx))
(($ $primcall 'builtin-ref #f (idx))
defs)
(_
(defs+* (get-uses label))))))