Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/compiler/FLINT/opt/collect.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/FLINT/opt/collect.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 158, Mon Oct 12 02:41:33 1998 UTC revision 159, Mon Oct 12 02:45:03 1998 UTC
# Line 1  Line 1 
1  (* copyright 1998 YALE FLINT PROJECT *)  (* copyright 1998 YALE FLINT PROJECT *)
2    (* monnier@cs.yale.edu *)
3    
4  signature COLLECT =  signature COLLECT =
5  sig  sig
6    
7      (* Collect information about variables and function uses      (* Collect information about variables and function uses.
8       * the info is accumulated in the map `m' *)       * The info is accumulated in the map `m' *)
9      val collect : FLINT.fundec -> unit      val collect : FLINT.fundec -> unit
10    
11      (* query functions *)      (* query functions *)
# Line 29  Line 30 
30      (* when creating a new var.  Used when alpha-renaming *)      (* when creating a new var.  Used when alpha-renaming *)
31      (* val copy   : FLINT.lvar * FLINT.lvar -> unit *)      (* val copy   : FLINT.lvar * FLINT.lvar -> unit *)
32    
33      (* fix up function to keep counts up-to-date when getting rid of a function.      (* fix up function to keep counts up-to-date when getting rid of code.
34       * the fun arg is only called for free variables becoming dead. *)       * the arg is only called for *free* variables becoming dead.
35      val unusefdec : (FLINT.lvar -> unit) -> (FLINT.lvar * FLINT.lvar list * FLINT.lexp) -> unit       * the first function returned just unuses an exp, while the
36         * second unuses a function declaration (f,args,body) *)
37        val unuselexp : (FLINT.lvar -> unit) ->
38            ((FLINT.lexp -> unit) *
39             ((FLINT.lvar * FLINT.lvar list * FLINT.lexp) -> unit))
40      (* function to collect info about a newly created lexp *)      (* function to collect info about a newly created lexp *)
41      val uselexp : FLINT.lexp -> unit      val uselexp : FLINT.lexp -> unit
42    
# Line 62  Line 67 
67  fun ASSERT (true,_) = ()  fun ASSERT (true,_) = ()
68    | ASSERT (FALSE,msg) = bug ("assertion "^msg^" failed")    | ASSERT (FALSE,msg) = bug ("assertion "^msg^" failed")
69    
   
70  datatype info  datatype info
71    (* for functions we keep track of calls and escaping uses    (* for functions we keep track of calls and escaping uses
72     * and separately for external and internal (recursive) references *)     * and separately for external and internal (recursive) references *)
# Line 270  Line 274 
274   * Once its scope has been processed, we can completely get rid of   * Once its scope has been processed, we can completely get rid of
275   * the variable and corresponding info (after verifying that the count   * the variable and corresponding info (after verifying that the count
276   * is indeed exactly 1 (accomplished by the "kill" calls) *)   * is indeed exactly 1 (accomplished by the "kill" calls) *)
277  fun unusefdec undertaker = let  fun unuselexp undertaker = let
278      (* val use = if inc then use else unuse *)      (* val use = if inc then use else unuse *)
279      fun uncall lv = unuse undertaker true lv      fun uncall lv = unuse undertaker true lv
280      val unuse = fn F.VAR lv => unuse undertaker false lv | _ => ()      val unuse = fn F.VAR lv => unuse undertaker false lv | _ => ()
# Line 347  Line 351 
351    
352            | le => buglexp("unexpected lexp", le)            | le => buglexp("unexpected lexp", le)
353  in  in
354      cfun      (cexp, cfun)
355  end  end
356    
357  val uselexp = census new use NONE  val uselexp = census new use NONE

Legend:
Removed from v.158  
changed lines
  Added in v.159

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0