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

Diff of /sml/trunk/src/MLRISC/cluster/clustergen.sml

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

revision 429, Wed Sep 8 09:47:00 1999 UTC revision 469, Wed Nov 10 22:42:52 1999 UTC
# Line 13  Line 13 
13       sharing Flowgraph.I = InsnProps.I       sharing Flowgraph.I = InsnProps.I
14       sharing MLTree.Constant = InsnProps.I.Constant       sharing MLTree.Constant = InsnProps.I.Constant
15       sharing MLTree.PseudoOp = Flowgraph.P       sharing MLTree.PseudoOp = Flowgraph.P
      sharing Flowgraph.B = MLTree.BNames  
16    ) : FLOWGRAPH_GEN =    ) : FLOWGRAPH_GEN =
17  struct  struct
18    
# Line 23  Line 22 
22    structure C = I.C    structure C = I.C
23    
24    structure T = MLTree    structure T = MLTree
   structure B = MLTree.BNames  
25    structure P = T.PseudoOp    structure P = T.PseudoOp
26    structure S = T.Stream    structure S = T.Stream
27    
# Line 36  Line 34 
34    fun newStream() =    fun newStream() =
35    let val bblkCnt = ref 0    let val bblkCnt = ref 0
36        val entryLabels = ref ([] : Label.label list)        val entryLabels = ref ([] : Label.label list)
       val blkName  = ref B.default  
37        val regmap  = ref NONE        val regmap  = ref NONE
38        fun can'tUse _ = error "unimplemented"        fun can'tUse _ = error "unimplemented"
39        val aliasF  = ref can'tUse : (T.alias -> unit) ref        val aliasF  = ref can'tUse : (T.alias -> unit) ref
# Line 45  Line 42 
42        val blockList : F.block list ref = ref []        val blockList : F.block list ref = ref []
43    
44        fun nextBlkNum () = !bblkCnt before bblkCnt := !bblkCnt + 1        fun nextBlkNum () = !bblkCnt before bblkCnt := !bblkCnt + 1
       fun blockName name =  
         (case !currBlock  
          of blk as F.BBLOCK _ =>  
              (currBlock := NOBLOCK; blockList := blk:: !blockList)  
           | _ => ()  
          (*esac*);  
          blkName := name)  
45    
46        (** Note - currBlock will always be a reference to a F.BBLOCK{..} **)        (** Note - currBlock will always be a reference to a F.BBLOCK{..} **)
47        fun newBasicBlk init =        fun newBasicBlk init =
48            F.BBLOCK{blknum=nextBlkNum(),            F.BBLOCK{blknum=nextBlkNum(),
49                     freq=ref 0,                     freq=ref 1,
50                     annotations=ref [],                     annotations=ref [],
                    name= !blkName,  
51                     liveIn=ref C.empty,                     liveIn=ref C.empty,
52                     liveOut=ref C.empty,                     liveOut=ref C.empty,
53                     succ=ref [],                     succ=ref [],
# Line 148  Line 137 
137              | fillLabTbl(_::blks) = fillLabTbl(blks)              | fillLabTbl(_::blks) = fillLabTbl(blks)
138              | fillLabTbl [] = ()              | fillLabTbl [] = ()
139    
140            val exitBlk = F.EXIT{blknum=nextBlkNum(), pred=ref [], freq=ref 0}            val exitBlk = F.EXIT{blknum=nextBlkNum(), pred=ref [], freq=ref 1}
141    
142            (** update successor and predecessor information **)            (** update successor and predecessor information **)
143            fun graphEdges((blk as F.BBLOCK{blknum,insns,succ,...})::blks) = let            fun graphEdges((blk as F.BBLOCK{blknum,insns,succ,...})::blks) = let
# Line 192  Line 181 
181              val blocks =              val blocks =
182                   map (fn Label.Label{id,...} => (lookupLabTbl id,ref 0))                   map (fn Label.Label{id,...} => (lookupLabTbl id,ref 0))
183                         (!entryLabels)                         (!entryLabels)
184              val entryBlk = F.ENTRY{blknum=nextBlkNum(), freq=ref 0,              val entryBlk = F.ENTRY{blknum=nextBlkNum(), freq=ref 1,
185                                     succ=ref blocks}                                     succ=ref blocks}
186            in            in
187              app (fn (F.BBLOCK{pred, ...},w) =>              app (fn (F.BBLOCK{pred, ...},w) =>
# Line 221  Line 210 
210        let val map = C.regmap()        let val map = C.regmap()
211        in  entryLabels := [];        in  entryLabels := [];
212            bblkCnt := 0;            bblkCnt := 0;
           blkName := B.default;  
213            blockList := [];            blockList := [];
214            currBlock := NOBLOCK;            currBlock := NOBLOCK;
215            regmap := SOME map;            regmap := SOME map;
# Line 229  Line 217 
217            map            map
218        end        end
219    
220        fun comment msg = annotation(BasicAnnotations.COMMENT msg)        fun comment msg = annotation(#create BasicAnnotations.COMMENT msg)
221        fun alias(v,r) = !aliasF(v,r)        fun alias(v,r) = !aliasF(v,r)
222    
223     in S.STREAM     in S.STREAM
# Line 240  Line 228 
228          entryLabel  = entryLabel,          entryLabel  = entryLabel,
229          pseudoOp    = pseudoOp,          pseudoOp    = pseudoOp,
230          exitBlock   = exitBlock,          exitBlock   = exitBlock,
         blockName   = blockName,  
231          annotation  = annotation,          annotation  = annotation,
232          comment     = comment,          comment     = comment,
233          alias       = alias,          alias       = alias,

Legend:
Removed from v.429  
changed lines
  Added in v.469

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