SCM Repository
Annotation of /sml/trunk/src/MLRISC/emit/cfgEmit.sml
Parent Directory
|
Revision Log
Revision 1017 - (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 : | george | 1017 | val CFG.INFO{annotations=an, data, ...} = #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 : | george | 1017 | and emitAn a = if Annotations.toString a = "" then () else annotation(a) |
32 : | george | 934 | in |
33 : | List.app emitAn (!an); | ||
34 : | george | 1017 | List.app emitIt blocks; |
35 : | List.app pseudoOp (rev (!data)) | ||
36 : | |||
37 : | george | 934 | end |
38 : | end | ||
39 : | |||
40 : | george | 984 | |
41 : | |||
42 : | |||
43 : | |||
44 : | |||
45 : | |||
46 : | |||
47 : | |||
48 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |