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/emit/cfgEmit.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/emit/cfgEmit.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 934 - (view) (download)

1 : george 934 (* cfgEmit.sml
2 :     *
3 :     * COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
4 :     *
5 :     * This module takes a flowgraph and an assembly emitter module and
6 :     * ties them together into one. The output is sent to AsmStream.
7 :     * --Allen
8 :     *)
9 :    
10 :     functor CFGEmit
11 :     (structure CFG : CONTROL_FLOW_GRAPH
12 :     structure E : INSTRUCTION_EMITTER
13 :     where I = CFG.I and P = CFG.P) : ASSEMBLY_EMITTER =
14 :     struct
15 :    
16 :     structure CFG = CFG
17 :    
18 :     fun asmEmit (Graph.GRAPH graph, blocks) = let
19 :     val CFG.INFO{annotations=an, ...} = #graph_info graph
20 :     val E.S.STREAM{pseudoOp,defineLabel,emit,annotation,comment,...} =
21 :     E.makeStream (!an)
22 :     fun emitAn a = if Annotations.toString a = "" then () else annotation(a)
23 :     fun emitData (CFG.LABEL lab) = defineLabel lab
24 :     | emitData (CFG.PSEUDO pOp) = pseudoOp pOp
25 :     fun emitIt (id, CFG.BLOCK{data, labels, annotations=a, insns, ...}) = (
26 :     List.app emitData (!data);
27 :     (* List.app defineLabel (!labels); *) (* JHR *)
28 :     List.app emitAn (!a);
29 :     List.app emit (rev (!insns)))
30 :     in
31 :     List.app emitAn (!an);
32 :     List.app emitIt blocks
33 :     end
34 :     end
35 :    

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