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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/c-util/tree-to-c.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/c-util/tree-to-c.sml

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

revision 2047, Sun Oct 21 14:53:47 2012 UTC revision 2048, Sun Oct 21 17:43:32 2012 UTC
# Line 660  Line 660 
660      val trBlock = trBlk      val trBlock = trBlk
661    
662    end    end
663    
664    (* FIXME: once we can consolidate the OpenCL and C backends, then we can get rid of the
665     * functor application.
666     *)
667    local
668      structure IL = TreeIL
669      structure V = IL.Var
670      structure CL = CLang
671    (* variable translation *)
672      structure TrVar =
673        struct
674          type env = CL.typed_var V.Map.map
675          fun lookup (env, x) = (case V.Map.find (env, x)
676                 of SOME(CL.V(_, x')) => x'
677                  | NONE => raise Fail(concat["lookup(_, ", V.name x, ")"])
678                (* end case *))
679        (* translate a variable that occurs in an l-value context (i.e., as the target of an assignment) *)
680          fun lvalueVar (env, x) = CL.mkVar(lookup(env, x))
681        (* translate a variable that occurs in an r-value context *)
682          fun rvalueVar (env, x) = CL.mkVar(lookup(env, x))
683        (* translate a variable that occurs in an l-value context (i.e., as the target of an assignment) *)
684          fun lvalueVar (env, x) = (case V.kind x
685                 of IL.VK_Local => CL.mkVar(lookup(env, x))
686                  | _ => CL.mkIndirect(CL.mkVar "glob", lookup(env, x))
687                (* end case *))
688        (* translate a variable that occurs in an r-value context *)
689          fun rvalueVar (env, x) = (case V.kind x
690                 of IL.VK_Local => CL.mkVar(lookup(env, x))
691                  | _ => CL.mkIndirect(CL.mkVar "glob", lookup(env, x))
692                (* end case *))
693        (* translate a strand state variable that occurs in an l-value context *)
694          fun lvalueStateVar x = CL.mkIndirect(CL.mkVar "selfOut", IL.StateVar.name x)
695        (* translate a strand state variable that occurs in an r-value context *)
696          fun rvalueStateVar x = CL.mkIndirect(CL.mkVar "selfIn", IL.StateVar.name x)
697        end
698    in
699    structure TreeToC = TreeToCFn (TrVar)
700    end

Legend:
Removed from v.2047  
changed lines
  Added in v.2048

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