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/branches/idlbasis-devel/src/MLRISC/backpatch/spanDep.sml
ViewVC logotype

Diff of /sml/branches/idlbasis-devel/src/MLRISC/backpatch/spanDep.sml

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

revision 1231, Mon Jun 3 18:32:08 2002 UTC revision 1232, Tue Jun 4 21:11:15 2002 UTC
# Line 18  Line 18 
18                          where I = CFG.I                          where I = CFG.I
19       structure Props     : INSN_PROPERTIES       structure Props     : INSN_PROPERTIES
20                          where I = CFG.I                          where I = CFG.I
      structure Placement : BLOCK_PLACEMENT  
                         where CFG = CFG  
21       ) : BBSCHED =       ) : BBSCHED =
22  struct  struct
23    
# Line 62  Line 60 
60    val dataList : P.pseudo_op list ref = ref []    val dataList : P.pseudo_op list ref = ref []
61    fun cleanUp() = (clusterList := []; dataList := [])    fun cleanUp() = (clusterList := []; dataList := [])
62    
63    fun bbsched(cfg as G.GRAPH graph) = let    fun bbsched(G.GRAPH graph, blocks : CFG.node list) = let
64        val blocks = map #2 blocks
65    
66      fun maxBlockId (CFG.BLOCK{id, ...}::rest, curr) =      fun maxBlockId (CFG.BLOCK{id, ...}::rest, curr) =
67         if id > curr then maxBlockId(rest, id) else maxBlockId(rest, curr)         if id > curr then maxBlockId(rest, id) else maxBlockId(rest, curr)
68       | maxBlockId([], curr) = curr       | maxBlockId([], curr) = curr
     val blocks = map #2 (Placement.blockPlacement(cfg))  
69      val N = maxBlockId(blocks, #capacity graph ())      val N = maxBlockId(blocks, #capacity graph ())
70    
71      (* Order of blocks in code layout *)      (* Order of blocks in code layout *)
# Line 280  Line 279 
279            in  strategy1()            in  strategy1()
280            end            end
281    
282              and process(instrs, others) = let
           and process([],others) = others  
             | process(instrs as jmp::body,others) = let  
283                 fun alignIt(chunks) =                 fun alignIt(chunks) =
284                   (case !align of NONE => chunks | SOME p => PSEUDO(p)::chunks)                   (case !align of NONE => chunks | SOME p => PSEUDO(p)::chunks)
285                val code =
286                  (case instrs
287                    of [] => []
288                     | jmp::body =>
289                        (case Props.instrKind jmp
290                           of Props.IK_JUMP => fitDelaySlot(jmp, body)
291                            | _ => scan(instrs, [], 0, [])
292                        (*esac*))
293                  (*esac*))
294                in                in
295                  alignIt                  alignIt
296                     (map LABEL (!labels) @                     (map LABEL (!labels) @
297                        CODE                     CODE (A.sub(labelMap, id), code) :: others)
298                          (A.sub(labelMap, id),  
                          case Props.instrKind jmp  
                           of Props.IK_JUMP => fitDelaySlot(jmp,body)  
                            | _             => scan(instrs,[],0,[])  
                          )::others)  
299                end                end
300          in          in
301            process(!insns,compress rest)            process(!insns,compress rest)
# Line 423  Line 425 
425    
426      val E.S.STREAM{defineLabel,pseudoOp,emit,beginCluster,...} =      val E.S.STREAM{defineLabel,pseudoOp,emit,beginCluster,...} =
427          E.makeStream []          E.makeStream []
428    
429        val debug = MLRiscControl.mkFlag ("dump-cfg-after-spandep",
430                                          "whether flow graph is shown after spandep phase")
431    
432      fun emitCluster(CLUSTER{comp},loc) = let      fun emitCluster(CLUSTER{comp},loc) = let
433        val emitInstrs = app emit        val emitInstrs = app emit
434        fun nops 0 = ()        fun nops 0 = ()

Legend:
Removed from v.1231  
changed lines
  Added in v.1232

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