Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/codegen/codegen-util.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/codegen/codegen-util.sml

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

revision 3925, Fri Jun 3 17:30:49 2016 UTC revision 3926, Sat Jun 4 05:01:29 2016 UTC
# Line 8  Line 8 
8    
9  structure CodeGenUtil : sig  structure CodeGenUtil : sig
10    
11      (* generate unique variable names *)
12        val tmpVar : unit -> CLang.var
13        val freshVar : string -> CLang.var
14    
15    (* is an expression "simple" (i.e., a variable or literal)? *)    (* is an expression "simple" (i.e., a variable or literal)? *)
16      val isSimple : TreeIR.exp -> bool      val isSimple : TreeIR.exp -> bool
17    
# Line 33  Line 37 
37      structure CL = CLang      structure CL = CLang
38      structure Env = CodeGenEnv      structure Env = CodeGenEnv
39    
40      (* generate new variables *)
41        local
42          val count = ref 0
43        in
44        fun freshVar prefix = let
45              val n = !count
46              in
47                count := n+1;
48                concat[prefix, "_", Int.toString n]
49              end
50        fun tmpVar () = freshVar "tmp"
51        end (* local *)
52    
53      fun isSimple e = (case e      fun isSimple e = (case e
54             of IR.E_Global _ => true             of IR.E_Global _ => true
55              | IR.E_State(NONE, _) => true              | IR.E_State(NONE, _) => true

Legend:
Removed from v.3925  
changed lines
  Added in v.3926

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