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/cfg.sml
ViewVC logotype

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

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

revision 1118, Wed Mar 6 15:30:25 2002 UTC revision 1125, Thu Mar 7 21:04:13 2002 UTC
# Line 18  Line 18 
18      structure I = I      structure I = I
19      structure P = Asm.S.P      structure P = Asm.S.P
20      structure C = I.C      structure C = I.C
     structure W = Freq  
21      structure G = Graph      structure G = Graph
22      structure A = Annotations      structure A = Annotations
23      structure S = Asm.S      structure S = Asm.S
24    
25      type weight = W.freq      type weight = real
26    
27      datatype block_kind =      datatype block_kind =
28          START          (* entry node *)          START          (* entry node *)
# Line 144  Line 143 
143      fun emitHeader (S.STREAM{comment,annotation,...})      fun emitHeader (S.STREAM{comment,annotation,...})
144                     (BLOCK{id,kind,freq,annotations,...}) =                     (BLOCK{id,kind,freq,annotations,...}) =
145         (comment(kindName kind ^"["^Int.toString id^         (comment(kindName kind ^"["^Int.toString id^
146                      "] ("^W.toString (!freq)^")");                      "] ("^Real.toString (!freq)^")");
147          nl();          nl();
148          app annotation (!annotations)          app annotation (!annotations)
149         )         )
# Line 203  Line 202 
202          (case #entries cfg () of          (case #entries cfg () of
203             [] =>             [] =>
204             let val i     = #new_id cfg ()             let val i     = #new_id cfg ()
205                 val start = newStart(i,ref 0)                 val start = newStart(i,ref 0.0)
206                 val _     = #add_node cfg (i,start)                 val _     = #add_node cfg (i,start)
207                 val j     = #new_id cfg ()                 val j     = #new_id cfg ()
208                 val stop  = newStop(j,ref 0)                 val stop  = newStop(j,ref 0.0)
209                 val _     = #add_node cfg (j,stop)                 val _     = #add_node cfg (j,stop)
210             in (*  #add_edge cfg (i,j,EDGE{k=ENTRY,w=ref 0,a=ref []}); *)             in (*  #add_edge cfg (i,j,EDGE{k=ENTRY,w=ref 0,a=ref []}); *)
211                 #set_entries cfg [i];                 #set_entries cfg [i];
# Line 299  Line 298 
298                    | FLOWSTO     => "flowsto"                    | FLOWSTO     => "flowsto"
299                  (* end case *))                  (* end case *))
300            in            in
301              F.format "%s(%d)" [F.STR kind, F.INT(!w)]              F.format "%s(%d)" [F.STR kind, F.REAL(!w)]
302            end            end
303    
304      fun getString f x = let      fun getString f x = let
# Line 324  Line 323 
323              | prList (h::t) = (pr (h ^ ", "); prList t)              | prList (h::t) = (pr (h ^ ", "); prList t)
324            val Asm.S.STREAM{emit,defineLabel,annotation,...} =            val Asm.S.STREAM{emit,defineLabel,annotation,...} =
325                  AsmStream.withStream outS Asm.makeStream []                  AsmStream.withStream outS Asm.makeStream []
326            fun showFreq (ref w) = F.format "[%s]" [F.STR(W.toString w)]            fun showFreq (ref w) = F.format "[%f]" [F.REAL w]
327            fun showEdge (blknum,e) =            fun showEdge (blknum,e) =
328                  F.format "%d:%s" [F.INT blknum, F.STR(show_edge e)]                  F.format "%d:%s" [F.INT blknum, F.STR(show_edge e)]
329            fun showSucc (_, x, e) = showEdge(x,e)            fun showSucc (_, x, e) = showEdge(x,e)

Legend:
Removed from v.1118  
changed lines
  Added in v.1125

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