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

SCM Repository

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

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

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

revision 4151, Sat Jul 2 17:42:55 2016 UTC revision 4163, Thu Jul 7 09:45:19 2016 UTC
# Line 65  Line 65 
65      val {getFn = getStateVar, ...} = SV.newProp mkStateVar      val {getFn = getStateVar, ...} = SV.newProp mkStateVar
66      end      end
67    
68      (* associate Tree IL function variables with Low IL variables using properties *)
69        local
70          fun mkFuncVar f = let
71                val (resTy, paramTys) = IR.Func.ty f
72                in
73    (* QUESTION: what about vector result/arguments? *)
74                  TreeFunc.new (IR.Func.name f, U.trType resTy, List.map U.trType paramTys)
75                end
76        in
77        val {getFn = getFuncVar, ...} = IR.Func.newProp mkFuncVar
78        end
79    
80    (* for variables that are in an equivalence class (see UnifyVars), we use a single    (* for variables that are in an equivalence class (see UnifyVars), we use a single
81     * TreeIR variable (or vector of variables) to represent them.     * TreeIR variable (or vector of variables) to represent them.
82     *)     *)
# Line 654  Line 666 
666                        | VEC xs => raise Fail "inconsistent"                        | VEC xs => raise Fail "inconsistent"
667                      (* end case *)                      (* end case *)
668                    end                    end
669                  | IR.APPLY(f, args) => let
670                      val (es, stms) = singleArgs (env, args)
671                      in
672                        Env.bindVar (env, lhs, Env.TREE(T.E_Apply(getFuncVar f, es)));
673                        stms
674                      end
675                | rhs => raise Fail(concat["unexpected ", IR.RHS.toString rhs, " in LowIR code"])                | rhs => raise Fail(concat["unexpected ", IR.RHS.toString rhs, " in LowIR code"])
676              (* end case *)              (* end case *)
677            end            end
# Line 834  Line 852 
852    
853      fun trCFG info cfg = ScopeVars.assignScopes ([], trCFGWithEnv (Env.new info, cfg))      fun trCFG info cfg = ScopeVars.assignScopes ([], trCFGWithEnv (Env.new info, cfg))
854    
855        fun trFunc info (IR.Func{name, params, body}) = let
856              val name' = getFuncVar name
857              val params' = List.map U.newParamVar params
858              val body' = trCFG info body
859              in
860                T.Func{name = name', params = params', body = body'}
861              end
862    
863    (* Build a strand method from a TreeIR block.  We need to check for language features    (* Build a strand method from a TreeIR block.  We need to check for language features
864     * that require the world pointer (e.g., printing) and for references to global variables.     * that require the world pointer (e.g., printing) and for references to global variables.
865     *)     *)
# Line 932  Line 958 
958            val prog = Flatten.transform prog            val prog = Flatten.transform prog
959            val LowIR.Program{            val LowIR.Program{
960                    props, consts, inputs, constInit, globals,                    props, consts, inputs, constInit, globals,
961                    globInit, strand, create, init, update                    funcs, globInit, strand, create, init, update
962                  } = prog                  } = prog
963            val trCFG = trCFG info            val trCFG = trCFG info
964            in            in
# Line 943  Line 969 
969                  inputs = List.map (Inputs.map mkGlobalVar) inputs,                  inputs = List.map (Inputs.map mkGlobalVar) inputs,
970                  constInit = trCFG constInit,                  constInit = trCFG constInit,
971                  globals = List.map mkGlobalVar globals,                  globals = List.map mkGlobalVar globals,
972                    funcs = List.map (trFunc info) funcs,
973                  globInit = trCFG globInit,                  globInit = trCFG globInit,
974                  strand = trStrand info strand,                  strand = trStrand info strand,
975                  create = Create.map trCFG create,                  create = Create.map trCFG create,

Legend:
Removed from v.4151  
changed lines
  Added in v.4163

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