Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/IR/mlrisc-cfg-gen2.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/IR/mlrisc-cfg-gen2.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (view) (download)

1 : monnier 467 (*
2 :     * This module builds a CFG from a stream of instructions.
3 :     * We use the FLOWGRPAH_GEN interface here, which is the
4 :     * default interface used by the core MLRISC.
5 :     *
6 :     * -- Allen
7 :     *)
8 :    
9 :     functor CFGGen
10 :     (structure CFG : CONTROL_FLOW_GRAPH
11 :     structure InsnProps : INSN_PROPERTIES
12 :     structure MLTree : MLTREE
13 :     sharing CFG.I = InsnProps.I
14 :     sharing MLTree.Constant = InsnProps.I.Constant
15 :     sharing MLTree.PseudoOp = CFG.P
16 :     ) : FLOWGRAPH_GEN =
17 :     struct
18 :    
19 :     structure I = CFG.I
20 :     structure C = I.C
21 :     structure S = MLTree.Stream
22 :     structure T = MLTree
23 :     structure P = CFG.P
24 : george 545 structure Builder = ControlFlowGraphGen
25 : monnier 467 (structure CFG = CFG
26 :     structure Stream = S
27 :     structure InsnProps = InsnProps
28 :     )
29 :    
30 :     type flowgraph = CFG.cfg
31 :    
32 : monnier 498 fun newStream{compile,flowgraph} =
33 :     let val cfg = ref(case flowgraph of
34 : leunga 744 NONE => CFG.new()
35 : monnier 498 | SOME cfg => cfg
36 :     )
37 : monnier 467 val {stream,next} = Builder.builder(!cfg)
38 :     val S.STREAM{beginCluster,endCluster,pseudoOp,emit,exitBlock,
39 : leunga 815 getAnnotations,comment,annotation,
40 :     defineLabel,entryLabel,...}
41 : monnier 467 = stream
42 :     fun endCFG a =
43 :     let val _ = endCluster a
44 :     val oldCFG = !cfg
45 : leunga 744 val newCFG = CFG.new()
46 : monnier 467 in cfg := newCFG;
47 :     next newCFG;
48 : monnier 498 compile oldCFG
49 : monnier 467 end
50 :    
51 : leunga 815 in S.STREAM{beginCluster = beginCluster,
52 :     endCluster = endCFG,
53 :     pseudoOp = pseudoOp,
54 :     emit = emit,
55 :     exitBlock = exitBlock,
56 :     comment = comment,
57 :     annotation = annotation,
58 :     getAnnotations = getAnnotations,
59 :     defineLabel = defineLabel,
60 :     entryLabel = entryLabel
61 : monnier 467 }
62 :     end
63 :    
64 :     end
65 :    

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