Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/flowgraph/cfgExpandCopies.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/flowgraph/cfgExpandCopies.sml

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

revision 933, Wed Sep 19 19:31:19 2001 UTC revision 1016, Tue Jan 15 23:10:06 2002 UTC
# Line 7  Line 7 
7    
8  functor CFGExpandCopies  functor CFGExpandCopies
9     (structure CFG    : CONTROL_FLOW_GRAPH     (structure CFG    : CONTROL_FLOW_GRAPH
10      structure ExpandCopies : EXPAND_COPIES      structure Shuffle : SHUFFLE
11                          where I = CFG.I                          where I = CFG.I
12     ) : CFG_OPTIMIZATION =     ) : CFG_OPTIMIZATION =
13    struct    struct
14      structure CFG = CFG      structure CFG = CFG
15        structure I = CFG.I
16    
17      val name = "expand copies"      val name = "expand copies"
18    
19      fun run (cfg as Graph.GRAPH graph) = let      fun run (cfg as Graph.GRAPH graph) = let
20            fun expand (_, CFG.BLOCK{insns, ...}) =        fun expand(I.COPY{k,  dst, src, tmp, ...}) = let
21                  insns := List.foldr              val shuffle =
22                    (fn (i, rest) => List.revAppend(ExpandCopies.expandCopies i,rest))                  case k
23                      of CellsBasis.GP => Shuffle.shuffle
24                       | CellsBasis.FP => Shuffle.shufflefp
25                       | _ =>  MLRiscErrorMsg.error ("CFGExpandCopies", "shuffle")
26              in shuffle{dst=dst, src=src, tmp=tmp}
27              end
28            | expand(I.ANNOTATION{i,a}) =
29                map (fn i => I.ANNOTATION{i=i, a=a}) (expand i)
30            | expand i = [i]
31    
32          fun expandInstrs(_, CFG.BLOCK{insns, ...}) =
33              insns :=
34                List.foldr
35                  (fn (i, rest) => List.revAppend(expand(i), rest))
36                    []                    []
37                    (!insns)                    (!insns)
38            in            in
39              #forall_nodes graph expand;        #forall_nodes graph expandInstrs;
40              cfg              cfg
41            end            end
   
42    end    end

Legend:
Removed from v.933  
changed lines
  Added in v.1016

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