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 984 - (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 : george 984 *
9 :     * TODO: Need to check for the REORDER/NOREORDER annotation on
10 :     * blocks and call P.Client.AsmPseudoOps.toString function to
11 :     * print out the appropriate assembler directive. -- Lal.
12 : george 934 *)
13 :    
14 :     functor CFGEmit
15 : george 984 (structure E : INSTRUCTION_EMITTER
16 :     structure CFG : CONTROL_FLOW_GRAPH
17 :     where I = E.I
18 :     and P = E.S.P) : ASSEMBLY_EMITTER =
19 : george 934 struct
20 :     structure CFG = CFG
21 :    
22 :     fun asmEmit (Graph.GRAPH graph, blocks) = let
23 :     val CFG.INFO{annotations=an, ...} = #graph_info graph
24 :     val E.S.STREAM{pseudoOp,defineLabel,emit,annotation,comment,...} =
25 :     E.makeStream (!an)
26 :     fun emitAn a = if Annotations.toString a = "" then () else annotation(a)
27 : george 984 fun emitIt (id, CFG.BLOCK{labels, annotations=a, align, insns, ...}) = (
28 :     case !align of NONE => () | SOME p => (pseudoOp p);
29 :     List.app defineLabel (!labels);
30 : george 934 List.app emitAn (!a);
31 :     List.app emit (rev (!insns)))
32 :     in
33 :     List.app emitAn (!an);
34 :     List.app emitIt blocks
35 :     end
36 :     end
37 :    
38 : george 984
39 :    
40 :    
41 :    
42 :    
43 :    
44 :    
45 :    
46 :    

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