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 1124, Thu Mar 7 19:49:22 2002 UTC revision 1125, Thu Mar 7 21:04:13 2002 UTC
# Line 2  Line 2 
2   *   *
3   * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies   * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
4   *)   *)
5    
6  signature CONTROL_FLOWGRAPH_GEN =  signature CONTROL_FLOWGRAPH_GEN =
7  sig  sig
8    
# Line 22  Line 23 
23  end  end
24    
25    
   
   
26  functor BuildFlowgraph  functor BuildFlowgraph
27    (structure Props  : INSN_PROPERTIES    (structure Props  : INSN_PROPERTIES
28     structure Stream : INSTRUCTION_STREAM     structure Stream : INSTRUCTION_STREAM
# Line 74  Line 73 
73      val reorder      = ref [] : Annotations.annotations ref      val reorder      = ref [] : Annotations.annotations ref
74    
75      (* noblock or invalid block has id of ~1 *)      (* noblock or invalid block has id of ~1 *)
76      val noBlock = CFG.newBlock(~1, ref 0)      val noBlock = CFG.newBlock(~1, ref 0.0)
77    
78      (* current block being built up *)      (* current block being built up *)
79      val currentBlock = ref noBlock      val currentBlock = ref noBlock
# Line 96  Line 95 
95    
96      (* get current basic block *)      (* get current basic block *)
97      fun getBlock () =      fun getBlock () =
98       (case !currentBlock of CFG.BLOCK{id= ~1, ...} => newBlock(1) | blk => blk)       (case !currentBlock of CFG.BLOCK{id= ~1, ...} => newBlock(1.0) | blk => blk)
99    
100    
101      (* ------------------------cluster---------------------------*)      (* ------------------------cluster---------------------------*)
# Line 145  Line 144 
144        val EXIT = hd(#exits graph ())        val EXIT = hd(#exits graph ())
145    
146        fun addEdge(from, to, kind) =        fun addEdge(from, to, kind) =
147          #add_edge graph (from, to, CFG.EDGE{k=kind, w=ref 0, a=ref[]})          #add_edge graph (from, to, CFG.EDGE{k=kind, w=ref 0.0, a=ref[]})
148    
149        fun target lab =        fun target lab =
150          (case (IntHashTable.find labelMap (hashLabel lab))          (case (IntHashTable.find labelMap (hashLabel lab))
# Line 200  Line 199 
199        (* XXX: Bug: EMPTYBLOCK does not really generate an empty block        (* XXX: Bug: EMPTYBLOCK does not really generate an empty block
200         *        but merely terminates the current block. Contradicts the comment         *        but merely terminates the current block. Contradicts the comment
201         *  in instructions/mlriscAnnotations.sig.         *  in instructions/mlriscAnnotations.sig.
202         *  It should be (newBlock(1); newBlock(1); ())         *  It should be (newBlock(1.0); newBlock(1.0); ())
203         *)         *)
204    
205        (* Add a new annotation *)        (* Add a new annotation *)
206        fun addAnnotation a =        fun addAnnotation a =
207         (case a         (case a
208           of MLRiscAnnotations.BLOCKNAMES names =>           of MLRiscAnnotations.BLOCKNAMES names =>
209               (blockNames := names;  newBlock(1); ())               (blockNames := names;  newBlock(1.0); ())
210            | MLRiscAnnotations.EMPTYBLOCK => (newBlock(1); ())            | MLRiscAnnotations.EMPTYBLOCK => (newBlock(1.0); ())
211            | MLRiscAnnotations.EXECUTIONFREQ f =>            | MLRiscAnnotations.EXECUTIONFREQ f =>
212               (case !currentBlock               (case !currentBlock
213                 of CFG.BLOCK{id= ~1, ...} => (newBlock(f); ())                 of CFG.BLOCK{id= ~1, ...} => (newBlock(real f); ())
214                  | CFG.BLOCK{freq, ...} => freq := f                  | CFG.BLOCK{freq, ...} => freq := real f
215               (*esac*))               (*esac*))
216            | a => let            | a => let
217                 val CFG.BLOCK{annotations,...} = getBlock()                 val CFG.BLOCK{annotations,...} = getBlock()
# Line 245  Line 244 
244          fun addAlignment () =          fun addAlignment () =
245            (case !segmentF            (case !segmentF
246             of TEXT => let             of TEXT => let
247                  val CFG.BLOCK{align, ...} = newBlock(1)                  val CFG.BLOCK{align, ...} = newBlock 1.0
248                in align := SOME p                in align := SOME p
249                end                end
250              | _ => data := p :: !data              | _ => data := p :: !data
# Line 282  Line 281 
281                of TEXT => error "addPseudoOp: SECTION in TEXT segment"                of TEXT => error "addPseudoOp: SECTION in TEXT segment"
282                 | _ => data := p :: !data                 | _ => data := p :: !data
283              (*esac*))              (*esac*))
284           | PB.REORDER => (reorder := []; newBlock(1); ())           | PB.REORDER => (reorder := []; newBlock 1.0; ())
285           | PB.NOREORDER =>           | PB.NOREORDER =>
286               (reorder := [#create MLRiscAnnotations.NOREORDER ()]; newBlock(1); ())               (reorder := [#create MLRiscAnnotations.NOREORDER ()]; newBlock 1.0; ())
287    
288           | PB.INT _    => chkAddData("INT")           | PB.INT _    => chkAddData("INT")
289           | PB.FLOAT _  => chkAddData("FLOAT")           | PB.FLOAT _  => chkAddData("FLOAT")
# Line 304  Line 303 
303                 of NONE => let                 of NONE => let
304                      fun newBlk () =                      fun newBlk () =
305                        (case !currentBlock                        (case !currentBlock
306                          of CFG.BLOCK{id= ~1, ...} => newBlock(1)                          of CFG.BLOCK{id= ~1, ...} => newBlock 1.0
307                           | CFG.BLOCK{insns=ref[], ...} => !currentBlock (* probably aligned block *)                           | CFG.BLOCK{insns=ref[], ...} => !currentBlock (* probably aligned block *)
308                           | _ => newBlock(1)                           | _ => newBlock 1.0
309                        (*esac*))                        (*esac*))
310                      val CFG.BLOCK{id, labels, ...} = newBlk()                      val CFG.BLOCK{id, labels, ...} = newBlk()
311                    in                    in

Legend:
Removed from v.1124  
changed lines
  Added in v.1125

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