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

SCM Repository

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

Diff of /branches/vis15/src/compiler/cxx-util/tree-to-cxx.sml

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

revision 3809, Tue May 3 21:27:40 2016 UTC revision 3810, Tue May 3 23:26:44 2016 UTC
# Line 15  Line 15 
15   * the C names in the environment, so their kind and type are irrelevant.   * the C names in the environment, so their kind and type are irrelevant.
16   *)   *)
17      local      local
18        fun new name = TreeIL.Var.new (name, TreeIL.Ty.IntTy)        fun new name = TreeIR.Var.new (name, TreeIR.Ty.IntTy)
19      in      in
20      val selfIn = new "$selfIn"      val selfIn = new "$selfIn"
21      val selfOut = new "$selfOut"      val selfOut = new "$selfOut"
# Line 25  Line 25 
25    
26  structure TreeToC : sig  structure TreeToC : sig
27    
28      type env = CLang.typed_var TreeIL.Var.Map.map      type env = CLang.typed_var TreeIR.Var.Map.map
29    
30      val empty : env      val empty : env
31    
32      val trType : TreeIL.Ty.ty -> CLang.ty      val trType : TreeTypes.t -> CLang.ty
33    
34      val trBlock : env * TreeIL.block -> CLang.stm      val trBlock : env * TreeIR.block -> CLang.stm
35    
36      val trFragment : env * TreeIL.block -> env * CLang.stm list      val trFragment : env * TreeIR.block -> env * CLang.stm list
37    
38      val trExp : env * TreeIL.exp -> CLang.exp      val trExp : env * TreeIR.exp -> CLang.exp
39    
40    (* translate an expression to a variable form; return the variable (as an expresison)    (* translate an expression to a variable form; return the variable (as an expresison)
41     * and the (optional) declaration.     * and the (optional) declaration.
42     *)     *)
43      val expToVar : env * CLang.ty * string * TreeIL.exp -> CLang.exp * CLang.stm list      val expToVar : env * CLang.ty * string * TreeIR.exp -> CLang.exp * CLang.stm list
44    
45      val trAssign : env * CLang.exp * TreeIL.exp -> CLang.stm list      val trAssign : env * CLang.exp * TreeIR.exp -> CLang.stm list
46    
47    end = struct    end = struct
48    
# Line 53  Line 53 
53      structure V = IR.Var      structure V = IR.Var
54    
55      datatype var = datatype CL.typed_var      datatype var = datatype CL.typed_var
56      type env = CL.typed_var TreeIL.Var.Map.map      type env = CL.typed_var TreeIR.Var.Map.map
57    
58      val empty = V.Map.empty      val empty = V.Map.empty
59    
# Line 63  Line 63 
63            (* end case *))            (* end case *))
64    
65    
66    (* Translate a TreeIL operator application to a CLang expression *)    (* Translate a TreeIR operator application to a CLang expression *)
67      fun trOp (rator, args) = (case (rator, args)      fun trOp (rator, args) = (case (rator, args)
68              | (Op.IAdd, [a, b]) => CL.mkBinOp(a, CL.#+, b)              | (Op.IAdd, [a, b]) => CL.mkBinOp(a, CL.#+, b)
69              | (Op.ISub, [a, b]) => CL.mkBinOp(a, CL.#-, b)              | (Op.ISub, [a, b]) => CL.mkBinOp(a, CL.#-, b)

Legend:
Removed from v.3809  
changed lines
  Added in v.3810

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