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 /MLRISC/trunk/IR/mlrisc-cfg2cluster.sml
ViewVC logotype

Diff of /MLRISC/trunk/IR/mlrisc-cfg2cluster.sml

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

revision 545, Thu Feb 24 13:56:44 2000 UTC revision 624, Fri Apr 21 03:06:21 2000 UTC
# Line 101  Line 101 
101        | id_of(F.ENTRY{blknum,...})  = blknum        | id_of(F.ENTRY{blknum,...})  = blknum
102        | id_of(F.EXIT{blknum,...})   = blknum        | id_of(F.EXIT{blknum,...})   = blknum
103    
     fun delete_preentries (ENTRY,CFG as G.GRAPH cfg) =  
     let val CFG.INFO{regmap,...} = #graph_info cfg  
         fun remove (ENTRY,i,_) =  
         let val block as CFG.BLOCK{labels,kind,insns,...} = #node_info cfg i  
         in  if kind = CFG.FUNCTION_ENTRY then  
             let val [(i,j,e)] = #out_edges cfg i  
                 val CFG.BLOCK{labels=l,...} = #node_info cfg j  
             in  case !insns of  
                    [] => ()  
                 |  _  => (print (CFG.show_block [] regmap block);  
                           error "delete_preentries");  
                 #add_edge cfg (ENTRY,j,e);  
                 l := !labels @ !l;  
                 #remove_node cfg i  
             end  
             else ()  
         end  
     in  app remove (#out_edges cfg ENTRY)  
     end  
   
104      fun remove_entry_to_exit (ENTRY,EXIT,CFG) =      fun remove_entry_to_exit (ENTRY,EXIT,CFG) =
105          Graph.remove_edge CFG (ENTRY,EXIT)          Graph.remove_edge CFG (ENTRY,EXIT)
106    
# Line 139  Line 119 
119                          [EXIT] => EXIT                          [EXIT] => EXIT
120                        | _ => raise Graph.NotSingleExit                        | _ => raise Graph.NotSingleExit
121          val CFG.INFO{regmap,annotations,...} = #graph_info cfg          val CFG.INFO{regmap,annotations,...} = #graph_info cfg
         (* val _       = delete_preentries(ENTRY,CFG) *)  
122          val _       = remove_entry_to_exit(ENTRY,EXIT,CFG)          val _       = remove_entry_to_exit(ENTRY,EXIT,CFG)
123          val A       = A.array(M,dummyNode)          val A       = A.array(M,dummyNode)
124          val nodes   = List.filter(fn (i,CFG.BLOCK{kind,...}) =>          val nodes   = List.filter(fn (i,CFG.BLOCK{kind,...}) =>
125                             i <> ENTRY andalso i <> EXIT andalso                             i <> ENTRY andalso i <> EXIT)
                            kind <> CFG.FUNCTION_ENTRY)  
126                                   (#nodes cfg ())                                   (#nodes cfg ())
127          val blocks  = List.concat(          val blocks  = List.concat(
128                          map (bblock A) (nodes @ [(EXIT,#node_info cfg EXIT)]))                          map (bblock A) (nodes @ [(EXIT,#node_info cfg EXIT)]))
# Line 180  Line 158 
158          val EXIT    = case #exits cfg () of          val EXIT    = case #exits cfg () of
159                          [EXIT] => EXIT                          [EXIT] => EXIT
160                        | _ => raise Graph.NotSingleExit                        | _ => raise Graph.NotSingleExit
         (* val _        = delete_preentries(ENTRY,CFG) *)  
161          val CFG.INFO{firstBlock,regmap=regmap,annotations,...} =          val CFG.INFO{firstBlock,regmap=regmap,annotations,...} =
162                 #graph_info cfg                 #graph_info cfg
163          val A        = A.array(M,dummyNode)    (* new id -> F.block *)          val A        = A.array(M,dummyNode)    (* new id -> F.block *)

Legend:
Removed from v.545  
changed lines
  Added in v.624

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