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

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

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

revision 932, Tue Sep 18 19:35:32 2001 UTC revision 933, Wed Sep 19 19:31:19 2001 UTC
# Line 9  Line 9 
9     structure S   : INSTRUCTION_STREAM     structure S   : INSTRUCTION_STREAM
10     structure I   : INSTRUCTIONS     structure I   : INSTRUCTIONS
11     structure CFG : CONTROL_FLOW_GRAPH     structure CFG : CONTROL_FLOW_GRAPH
12                    where I = I
13     sharing CFG.I = I                    and P = S.P
    sharing CFG.P = S.P  
14       (*       (*
15      * This creates an emitter which can be used to build a CFG incrementally      * This creates an emitter which can be used to build a CFG incrementally
16      *)      *)
17     type instrStream =     type instrStream =
18       (I.instruction, Annotations.annotations, I.C.cellset, CFG.cfg) S.stream       (I.instruction, Annotations.annotations, I.C.cellset, CFG.cfg) S.stream
19    
20     val build : CFG.cfg option -> instrStream     val build : unit -> instrStream
21    
22  end  end
23    
# Line 47  Line 46 
46    
47    val hashLabel = Word.toInt o Label.hash    val hashLabel = Word.toInt o Label.hash
48    
49    (* The control flow graph may be built up incrementally. *)    fun build ()  = let
50    fun build cfgOpt  = let      val cfg as ref(G.GRAPH graph) = ref(CFG.new())
     val cfg as ref(G.GRAPH graph) = ref(Option.getOpt(cfgOpt, CFG.new()))  
51    
52      (* list of blocks generated so far *)      (* list of blocks generated so far *)
53      val blockList   = ref ([] : CFG.block list)      val blockList   = ref ([] : CFG.block list)
# Line 76  Line 74 
74         blockList := [];         blockList := [];
75         entryLabels := [];         entryLabels := [];
76         IntHashTable.clear labelMap;         IntHashTable.clear labelMap;
        #forall_nodes cfg  
           (fn (blockId,CFG.BLOCK{labels, ...}) =>  
                   app (fn lab => addLabel(hashLabel lab, blockId))  
                       (!labels));  
77         blockNames := [];         blockNames := [];
78         currentBlock := noBlock         currentBlock := noBlock
79      end      end

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

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