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/branches/idlbasis-devel/src/MLRISC/emit/cfgEmit.sml
ViewVC logotype

Annotation of /sml/branches/idlbasis-devel/src/MLRISC/emit/cfgEmit.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1232 - (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 : blume 1232 val CFG.INFO{annotations=an, data, decls, ...} = #graph_info graph
24 : george 934 val E.S.STREAM{pseudoOp,defineLabel,emit,annotation,comment,...} =
25 :     E.makeStream (!an)
26 : george 984 fun emitIt (id, CFG.BLOCK{labels, annotations=a, align, insns, ...}) = (
27 :     case !align of NONE => () | SOME p => (pseudoOp p);
28 :     List.app defineLabel (!labels);
29 : george 934 List.app emitAn (!a);
30 :     List.app emit (rev (!insns)))
31 : blume 1232 and emitAn a = if Annotations.toString a = "" then () else annotation(a)
32 : george 934 in
33 :     List.app emitAn (!an);
34 : blume 1232 List.app pseudoOp (rev (!decls));
35 :     pseudoOp(PseudoOpsBasisTyp.TEXT);
36 :     List.app emitIt blocks;
37 :     List.app pseudoOp (rev (!data))
38 :    
39 : george 934 end
40 :     end
41 :    
42 : george 984
43 :    
44 :    
45 :    
46 :    
47 :    
48 :    
49 :    
50 :    

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