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

SCM Repository

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

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

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

revision 1043, Mon May 2 03:04:52 2011 UTC revision 1044, Mon May 2 03:05:12 2011 UTC
# Line 47  Line 47 
47        = NoScope        = NoScope
48        | GlobalScope        | GlobalScope
49        | InitiallyScope        | InitiallyScope
50        | StrandScope        | StrandScope of TreeIL.var list  (* strand initialization *)
51        | MethodScope of TreeIL.var list  (* method body; vars are state variables *)        | MethodScope of TreeIL.var list  (* method body; vars are state variables *)
52    
53    (* the supprted widths of vectors of reals on the target.  For the GNU vector extensions,    (* the supprted widths of vectors of reals on the target.  For the GNU vector extensions,
# Line 65  Line 65 
65    (* TreeIL to target translations *)    (* TreeIL to target translations *)
66      structure Tr =      structure Tr =
67        struct        struct
68          fun block (ENV{vMap, scope, ...}, blk) = (case scope          fun saveState cxt stateVars (env, args, stm) = (
                of MethodScope stateVars => let  
                     fun saveState (env, args, stm) =  
69                            ListPair.foldrEq                            ListPair.foldrEq
70                              (fn (x, e, stms) => ToC.trAssign(env, x, e)@stms)                              (fn (x, e, stms) => ToC.trAssign(env, x, e)@stms)
71                                [stm]                                [stm]
72                                  (stateVars, args)                                  (stateVars, args)
73                      in                ) handle ListPair.UnequalLengths =>
74                        ToC.trBlock (vMap, saveState, blk)                  raise Fail(concat["saveState ", cxt, ": length mismatch"])
75  handle ex => raise ex          fun block (ENV{vMap, scope, ...}, blk) = (case scope
76                      end                 of StrandScope stateVars => ToC.trBlock (vMap, saveState "StrandScope" stateVars, blk)
77                  | _ => ToC.trBlock (vMap, fn _ => raise Fail "unexpected state save", blk)                  | MethodScope stateVars => ToC.trBlock (vMap, saveState "MethodScope" stateVars, blk)
78                    | _ => ToC.trBlock (vMap, fn (_, _, stm) => [stm], blk)
79                (* end case *))                (* end case *))
80          fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e)          fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e)
81        end        end
# Line 114  Line 113 
113          fun setScope scope (ENV{info, vMap, ...}) = ENV{info=info, vMap=vMap, scope=scope}          fun setScope scope (ENV{info, vMap, ...}) = ENV{info=info, vMap=vMap, scope=scope}
114          val scopeGlobal = setScope GlobalScope          val scopeGlobal = setScope GlobalScope
115          val scopeInitially = setScope InitiallyScope          val scopeInitially = setScope InitiallyScope
116          fun scopeStrand (env, strand) = setScope StrandScope env          fun scopeStrand (env, svars) = setScope (StrandScope svars) env
117          fun scopeMethod (env, svars) = setScope (MethodScope svars) env          fun scopeMethod (env, svars) = setScope (MethodScope svars) env
118        (* bind a TreeIL varaiable to a target variable *)        (* bind a TreeIL varaiable to a target variable *)
119          fun bind (ENV{info, vMap, scope}, x, x') = ENV{          fun bind (ENV{info, vMap, scope}, x, x') = ENV{

Legend:
Removed from v.1043  
changed lines
  Added in v.1044

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