Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/MLRISC/ppc/ra/ppcRewrite.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/ppc/ra/ppcRewrite.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 796, Tue Mar 6 00:04:33 2001 UTC revision 889, Thu Jul 19 20:35:20 2001 UTC
# Line 1  Line 1 
1  functor PPCRewrite(Instr : PPCINSTR) = struct  functor PPCRewrite(Instr : PPCINSTR) = struct
2    structure I = Instr    structure I = Instr
3    structure C = I.C    structure C = I.C
4      structure CB = CellsBasis
5    
6    fun ea(NONE, _, _) = NONE    fun ea(NONE, _, _) = NONE
7      | ea(e as SOME(I.Direct r), rs, rt) =      | ea(e as SOME(I.Direct r), rs, rt) =
8         if C.sameColor(r,rs) then SOME(I.Direct rt) else e         if CB.sameColor(r,rs) then SOME(I.Direct rt) else e
9      | ea(e as SOME(I.FDirect r), rs, rt) =      | ea(e as SOME(I.FDirect r), rs, rt) =
10         if C.sameColor(r,rs) then SOME(I.FDirect rt) else e         if CB.sameColor(r,rs) then SOME(I.FDirect rt) else e
11      | ea(e as SOME(I.Displace{base, disp}), rs, rt) =      | ea(e as SOME(I.Displace{base, disp}), rs, rt) =
12         if C.sameColor(base,rs) then SOME(I.Displace{base=rt, disp=disp})         if CB.sameColor(base,rs) then SOME(I.Displace{base=rt, disp=disp})
13         else e         else e
14    
15    fun rewriteUse(instr, rs, rt) = let    fun rewriteUse(instr, rs, rt) = let
16      fun rplac r = if C.sameColor(r,rs) then rt else r      fun rplac r = if CB.sameColor(r,rs) then rt else r
17      fun rwOperand(opnd as I.RegOp r) =      fun rwOperand(opnd as I.RegOp r) =
18           if C.sameColor(r,rs) then I.RegOp rt else opnd           if CB.sameColor(r,rs) then I.RegOp rt else opnd
19        | rwOperand opnd = opnd        | rwOperand opnd = opnd
20    in    in
21      case instr      case instr
# Line 51  Line 52 
52       | I.ANNOTATION{i,a} =>       | I.ANNOTATION{i,a} =>
53           I.ANNOTATION{i=rewriteUse(i,rs,rt),           I.ANNOTATION{i=rewriteUse(i,rs,rt),
54                          a=case a of                          a=case a of
55                             C.DEF_USE{cellkind=C.GP,defs,uses} =>                             CB.DEF_USE{cellkind=CB.GP,defs,uses} =>
56                               C.DEF_USE{cellkind=C.GP,uses=map rplac uses,                               CB.DEF_USE{cellkind=CB.GP,uses=map rplac uses,
57                                         defs=defs}                                         defs=defs}
58                            | _ => a}                            | _ => a}
59       | _ => instr       | _ => instr
60    end    end
61    
62    fun rewriteDef(instr, rs, rt) = let    fun rewriteDef(instr, rs, rt) = let
63      fun rplac r = if C.sameColor(r,rs) then rt else r      fun rplac r = if CB.sameColor(r,rs) then rt else r
64    in    in
65      case instr      case instr
66      of I.L {ld, rt, ra, d, mem} =>      of I.L {ld, rt, ra, d, mem} =>
# Line 83  Line 84 
84       | I.ANNOTATION{i,a} =>       | I.ANNOTATION{i,a} =>
85          I.ANNOTATION{i=rewriteDef(i,rs,rt),          I.ANNOTATION{i=rewriteDef(i,rs,rt),
86                          a=case a of                          a=case a of
87                             C.DEF_USE{cellkind=C.GP,defs,uses} =>                             CB.DEF_USE{cellkind=CB.GP,defs,uses} =>
88                               C.DEF_USE{cellkind=C.GP,uses=uses,                               CB.DEF_USE{cellkind=CB.GP,uses=uses,
89                                         defs=map rplac defs}                                         defs=map rplac defs}
90                            | _ => a}                            | _ => a}
91       | _ => instr       | _ => instr
92    end    end
93    
94    fun frewriteUse(instr, fs, ft) = let    fun frewriteUse(instr, fs, ft) = let
95      fun rplac r = if C.sameColor(r,fs) then ft else r      fun rplac r = if CB.sameColor(r,fs) then ft else r
96    in    in
97      case instr      case instr
98      of I.STF {st, fs, ra, d, mem} =>      of I.STF {st, fs, ra, d, mem} =>
# Line 112  Line 113 
113       | I.ANNOTATION{i,a} =>       | I.ANNOTATION{i,a} =>
114           I.ANNOTATION{i=frewriteUse(i,fs,ft),           I.ANNOTATION{i=frewriteUse(i,fs,ft),
115                          a=case a of                          a=case a of
116                             C.DEF_USE{cellkind=C.FP,defs,uses} =>                             CB.DEF_USE{cellkind=CB.FP,defs,uses} =>
117                               C.DEF_USE{cellkind=C.FP,uses=map rplac uses,                               CB.DEF_USE{cellkind=CB.FP,uses=map rplac uses,
118                                         defs=defs}                                         defs=defs}
119                            | _ => a}                            | _ => a}
120       | _ => instr       | _ => instr
# Line 121  Line 122 
122    
123    
124    fun frewriteDef(instr, fs, ft) = let    fun frewriteDef(instr, fs, ft) = let
125      fun rplac r = if C.sameColor(r,fs) then ft else r      fun rplac r = if CB.sameColor(r,fs) then ft else r
126    in    in
127      case instr      case instr
128      of I.LF{ld, ft, ra, d, mem} =>      of I.LF{ld, ft, ra, d, mem} =>
# Line 141  Line 142 
142       | I.ANNOTATION{i,a} =>       | I.ANNOTATION{i,a} =>
143          I.ANNOTATION{i=frewriteDef(i,fs,ft),          I.ANNOTATION{i=frewriteDef(i,fs,ft),
144                          a=case a of                          a=case a of
145                             C.DEF_USE{cellkind=C.FP,defs,uses} =>                             CB.DEF_USE{cellkind=CB.FP,defs,uses} =>
146                               C.DEF_USE{cellkind=C.FP,uses=uses,                               CB.DEF_USE{cellkind=CB.FP,uses=uses,
147                                         defs=map rplac defs}                                         defs=map rplac defs}
148                            | _ => a}                            | _ => a}
149       | _ => instr       | _ => instr

Legend:
Removed from v.796  
changed lines
  Added in v.889

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