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 651 - (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 :     NONE => CFG.new(I.C.regmap())
35 :     | SOME cfg => cfg
36 :     )
37 : monnier 467 val {stream,next} = Builder.builder(!cfg)
38 :     val S.STREAM{beginCluster,endCluster,pseudoOp,emit,exitBlock,
39 :     comment,annotation,defineLabel,entryLabel,alias,phi,...}
40 :     = stream
41 :     fun endCFG a =
42 :     let val _ = endCluster a
43 :     val oldCFG = !cfg
44 :     val newCFG = CFG.new(I.C.regmap())
45 :     in cfg := newCFG;
46 :     next newCFG;
47 : monnier 498 compile oldCFG
48 : monnier 467 end
49 :    
50 :     in S.STREAM{beginCluster= beginCluster,
51 :     endCluster = endCFG,
52 :     pseudoOp = pseudoOp,
53 :     emit = emit,
54 : george 545 exitBlock = exitBlock,
55 : monnier 467 comment = comment,
56 :     annotation = annotation,
57 :     defineLabel = defineLabel,
58 :     entryLabel = entryLabel,
59 :     alias = alias,
60 :     phi = phi
61 :     }
62 :     end
63 :    
64 :     end
65 :    

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