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/ir-archive/reducibility.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/ir-archive/reducibility.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 912 - (view) (download)

1 : george 912 (*
2 :     * This module tests for reducibility of a loop
3 :     *
4 :     * -- Allen
5 :     *)
6 :     functor Reducibility(Loop : LOOP_STRUCTURE) : REDUCIBILITY =
7 :     struct
8 :     structure Loop = Loop
9 :     structure Dom = Loop.Dom
10 :     structure G = Graph
11 :    
12 :     structure Derived = DerivedGraph(Dom)
13 :    
14 :     fun is_reducible(Loop) =
15 :     let val Dom = Loop.dom Loop
16 :     val headers = Loop.header Loop
17 :     val Derived as G.GRAPH derived = Derived.derived_graph Dom
18 :     val N = #capacity derived ()
19 :     val irreducible = BitSet.create N
20 :     fun markIrreducible([_],_) = () (* simple cycles are reducible *)
21 :     | markIrreducible(cycle,_) =
22 :     app (fn n => BitSet.set(irreducible,n)) cycle
23 :     val _ = GraphSCC.scc Derived markIrreducible ()
24 :     fun isReducible n =
25 :     let val h = Array.sub(headers,n)
26 :     in not(BitSet.contains(irreducible,n)) end
27 :     in isReducible
28 :     end
29 :     end

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