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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/cl-target/cl-target.sml

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

revision 1282, Mon Jun 6 19:22:54 2011 UTC revision 1285, Tue Jun 7 10:33:17 2011 UTC
# Line 14  Line 14 
14      structure RN = RuntimeNames      structure RN = RuntimeNames
15      structure ToCL = TreeToCL      structure ToCL = TreeToCL
16    
17      type var = ToCL.var    (* C variable translation *)
18        structure TrCVar =
19          struct
20            type env = CL.typed_var TreeIL.Var.Map.map
21            fun lookup (env, x) = (case V.Map.find (env, x)
22                   of SOME(CL.V(_, x')) => x'
23                    | NONE => raise Fail(concat["TrCVar.lookup(_, ", V.name x, ")"])
24                  (* end case *))
25          (* translate a variable that occurs in an l-value context (i.e., as the target of an assignment) *)
26            fun lvalueVar (env, x) = (case V.kind x
27                   of IL.VK_Global => CL.mkIndirect(CL.mkVar "diderotGlobals", lookup(env, x))
28                    | IL.VK_State strand => raise Fail "unexpected strand context"
29                    | IL.VK_Local => CL.mkVar(lookup(env, x))
30                  (* end case *))
31          (* translate a variable that occurs in an r-value context *)
32            val rvalueVar = lvalueVar
33          end
34    
35        structure ToC = TreeToCFn (TrCVar)
36    
37        type var = CL.typed_var
38      type exp = CL.exp      type exp = CL.exp
39      type stm = CL.stm      type stm = CL.stm
40    

Legend:
Removed from v.1282  
changed lines
  Added in v.1285

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