Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Tracker SCM

SCM Repository

[smlnj] Diff of /sml/branches/idlbasis-devel/src/MLRISC/cluster/clustergen.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/MLRISC/cluster/clustergen.sml

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

revision 858, Wed Jun 27 21:20:27 2001 UTC revision 859, Wed Jun 27 21:43:12 2001 UTC
# Line 37  Line 37 
37            case flowgraph of            case flowgraph of
38              SOME(F.CLUSTER{blkCounter, annotations, blocks,              SOME(F.CLUSTER{blkCounter, annotations, blocks,
39                             entry, exit, ...}) =>                             entry, exit, ...}) =>
40                    (ref(!blkCounter-2), !annotations, ref(rev blocks),                    (ref(!blkCounter-2), ref(!annotations), ref(rev blocks),
41                     entry, exit)                     entry, exit)
42            | NONE => (ref 0, [], ref [], NOBLOCK, NOBLOCK)            | NONE => (ref 0, ref [], ref [], NOBLOCK, NOBLOCK)
43    
44        val currBlock   = ref NOBLOCK        val currBlock   = ref NOBLOCK
45        val blockNames  = ref [] : Annotations.annotations ref        val blockNames  = ref [] : Annotations.annotations ref
# Line 82  Line 82 
82            | _ => currBlock := newBasicBlock [instr]            | _ => currBlock := newBasicBlock [instr]
83            ;            ;
84            case InsnProps.instrKind instr of            case InsnProps.instrKind instr of
85              InsnProps.IK_JUMP => (blocks := !currBlock :: !blocks;              (InsnProps.IK_JUMP | InsnProps.IK_CALL_WITH_CUTS) =>
86                 (blocks := !currBlock :: !blocks;
87                                    currBlock := NOBLOCK)                                    currBlock := NOBLOCK)
88            | _ => ()            | _ => ()
89           )           )
# Line 112  Line 113 
113        (* Add a comment *)        (* Add a comment *)
114        fun comment msg = annotation(#create MLRiscAnnotations.COMMENT msg)        fun comment msg = annotation(#create MLRiscAnnotations.COMMENT msg)
115    
116          (* Get the current list of annotations *)
117          fun getAnnotations() = annotations
118    
119        (* Mark a block as exit *)        (* Mark a block as exit *)
120        fun exitBlock cellset =        fun exitBlock cellset =
121        let fun findLiveOut(F.BBLOCK{liveOut, ...}::_) = liveOut        let fun findLiveOut(F.BBLOCK{liveOut, ...}::_) = liveOut
# Line 125  Line 129 
129        fun beginCluster _ = ()        fun beginCluster _ = ()
130    
131        (* End a cluster *)        (* End a cluster *)
132        fun endCluster blockAnnotations =        fun endCluster clusterAnnotations =
133        let exception LabelMap        let exception LabelMap
134            val labelMap : F.block IntHashTable.hash_table =            val labelMap : F.block IntHashTable.hash_table =
135                              IntHashTable.mkTable(16, LabelMap)                              IntHashTable.mkTable(16, LabelMap)
# Line 192  Line 196 
196                in  case !insns of                in  case !insns of
197                      lastInstr::_ =>                      lastInstr::_ =>
198                      (case InsnProps.instrKind lastInstr of                      (case InsnProps.instrKind lastInstr of
199                         InsnProps.IK_JUMP =>                         (InsnProps.IK_JUMP | InsnProps.IK_CALL_WITH_CUTS) =>
200                            succ := succBlocks                            succ := succBlocks
201                               (InsnProps.branchTargets lastInstr,[])                               (InsnProps.branchTargets lastInstr,[])
202                       | _ =>                       | _ =>
# Line 231  Line 235 
235            val _ = insertEntryEdges()            val _ = insertEntryEdges()
236    
237               (* create a new cluster *)               (* create a new cluster *)
238              val _ = annotations := clusterAnnotations @ (!annotations)
239            val cluster =            val cluster =
240                F.CLUSTER{blocks=allBlocks, entry=entryBlk, exit=exitBlk,                F.CLUSTER{blocks=allBlocks, entry=entryBlk, exit=exitBlk,
241                          blkCounter=ref(!blkCounter),                          blkCounter=ref(!blkCounter),
242                          annotations=ref(blockAnnotations @ annotations)}                          annotations=ref(!annotations)}
243    
244            val _         = blkCounter := 0            val _         = blkCounter := 0
245            val _         = entryLabels := []            val _         = entryLabels := []
246              val _         = annotations := []
247        in  compile cluster        in  compile cluster
248        end        end
249    
# Line 250  Line 256 
256           pseudoOp     = pseudoOp,           pseudoOp     = pseudoOp,
257           exitBlock    = exitBlock,           exitBlock    = exitBlock,
258           annotation   = annotation,           annotation   = annotation,
259             getAnnotations=getAnnotations,
260           comment      = comment           comment      = comment
261        }        }
262    end    end

Legend:
Removed from v.858  
changed lines
  Added in v.859

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