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/SSA/ssa-copy.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/SSA/ssa-copy.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 228 - (view) (download)

1 : monnier 221 (*
2 :     * Some utilities for dealing for parallel copies
3 :     *)
4 :     signature SSA_COPIES =
5 :     sig
6 :    
7 :     structure SP : SSA_PROPERTIES
8 :     structure C : CELLS
9 :     sharing SP.C = C
10 :    
11 :     val simplifyCopy' : C.register list * C.register list ->
12 :     C.register list * C.register list
13 :     val simplifyCopy : SP.opn list * SP.opn list -> SP.opn list * SP.opn list
14 :    
15 :     end
16 :    
17 :     functor SSACopiesFn(SP : SSA_PROPERTIES) : SSA_COPIES =
18 :     struct
19 :    
20 :     structure SP = SP
21 :     structure C = SP.C
22 :    
23 :     fun error msg = MLRiscErrorMsg.impossible("SSACopies."^msg)
24 :    
25 :     fun simplifyCopy'(dst,src) =
26 :     let fun f(d::ds,s::ss,dst,src) =
27 :     if d = s then f(ds,ss,dst,src)
28 :     else f(ds,ss,d::dst,s::src)
29 :     | f([],[],dst,src) = (dst,src)
30 :     | f _ = error "simplifyCopy'"
31 :     in f(dst,src,[],[]) end
32 :    
33 :     fun simplifyCopy(dst,src) =
34 :     let fun f([],[],dst,src) = (dst,src)
35 :     | f(d::ds,s::ss,dst,src) =
36 :     if (case (d,s) of
37 :     (SP.REG(x,_),SP.REG(y,_)) => x=y
38 :     | (SP.FIX(x,_),SP.FIX(y,_)) => x=y
39 :     | _ => false)
40 :     then f(ds,ss,dst,src)
41 :     else f(ds,ss,d::dst,s::src)
42 :     | f _ = error "simplifyCopy"
43 :     in f(dst,src,[],[])
44 :     end
45 :    
46 :     end
47 :    
48 :     (*
49 : monnier 227 * $Log$
50 : monnier 221 *)

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