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/flowgraph/cfgCountCopies.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/flowgraph/cfgCountCopies.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 933 - (view) (download)

1 : george 933 (*
2 :     * This module counts the number of copies (in bytes)
3 :     * generated after register allocation. Mainly useful for fine-tuning.
4 :     *)
5 :     functor CFGCountCopies
6 :     ( structure CFG : CONTROL_FLOW_GRAPH
7 :     structure InsnProps : INSN_PROPERTIES
8 :     where I = CFG.I
9 :     structure SdiJumps : SDI_JUMPS
10 :     where I = CFG.I
11 :     ) : CFG_OPTIMIZATION =
12 :     struct
13 :     structure CFG = CFG
14 :     structure G = Graph
15 :    
16 :     val name = "count copies"
17 :    
18 :     val copies = MLRiscControl.getCounter "copies"
19 :    
20 :     fun run (cfg as G.GRAPH graph) = let
21 :     val blocks = map #2 (#nodes graph ())
22 :     fun loc _ = 0
23 :     fun count(CFG.BLOCK{insns, ...}, n) = let
24 :     fun scan([], n) = n
25 :     | scan(i::is, n) =
26 :     if InsnProps.moveInstr i then
27 :     scan(is, n + SdiJumps.sdiSize(i, loc, 0))
28 :     else scan(is, n)
29 :     in scan(!insns, n)
30 :     end
31 :     in
32 :     copies := !copies + foldr count 0 blocks;
33 :     cfg
34 :     end
35 :     end

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