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/hppa/ra/hppaRewrite.sml
ViewVC logotype

Diff of /sml/trunk/src/MLRISC/hppa/ra/hppaRewrite.sml

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

revision 1002, Fri Nov 30 17:11:33 2001 UTC revision 1003, Fri Dec 7 02:45:32 2001 UTC
# Line 12  Line 12 
12    fun error msg = MLRiscErrorMsg.error("HppaRewrite",msg)    fun error msg = MLRiscErrorMsg.error("HppaRewrite",msg)
13    
14    fun rewriteUse(instr, rs, rt) = let    fun rewriteUse(instr, rs, rt) = let
15        fun hppaUse(instr) = let
16      fun replc r = if CB.sameColor(r,rs) then rt else r      fun replc r = if CB.sameColor(r,rs) then rt else r
17    in    in
18      case instr      case instr
# Line 66  Line 67 
67          I.FLOAD{fl=fl, b=replc b, d=d, t=t, mem=mem}          I.FLOAD{fl=fl, b=replc b, d=d, t=t, mem=mem}
68       | I.FLOADX{flx, b, x, t, mem} =>       | I.FLOADX{flx, b, x, t, mem} =>
69          I.FLOADX{flx=flx, b=replc b, x=replc x, t=t, mem=mem}          I.FLOADX{flx=flx, b=replc b, x=replc x, t=t, mem=mem}
      | I.ANNOTATION{i,a} =>  
         I.ANNOTATION{i=rewriteUse(i,rs,rt),  
                         a=case a of  
                            CB.DEF_USE{cellkind=CB.GP,defs,uses} =>  
                              CB.DEF_USE{cellkind=CB.GP,uses=map replc uses,  
                                        defs=defs}  
                           | _ => a}  
70       | _ => instr       | _ => instr
71    end    end
72      in
73          case instr
74           of (I.ANNOTATION{i, ...}) => rewriteUse(i, rs, rt)
75            | I.LIVE{regs, spilled} =>
76                I.LIVE{regs=C.addReg(rt, C.rmvReg(rs, regs)), spilled=spilled}
77            | I.INSTR(i) => I.INSTR(hppaUse(i))
78            | _ => error "rewriteUse"
79      end
80    
81    fun rewriteDef(instr, rs, rt) = let    fun rewriteDef(instr, rs, rt) = let
82        fun hppaDef(instr) = let
83      fun replc r = if CB.sameColor(r,rs) then rt else r      fun replc r = if CB.sameColor(r,rs) then rt else r
84      fun ea (SOME(I.Direct r)) = SOME(I.Direct (replc r))      fun ea (SOME(I.Direct r)) = SOME(I.Direct (replc r))
85        | ea x = x        | ea x = x
# Line 113  Line 116 
116       | I.LDO{i, b, t} => I.LDO{i=i, b=b, t=replc t}       | I.LDO{i, b, t} => I.LDO{i=i, b=b, t=replc t}
117       | I.COPY{dst, src, impl, tmp} =>       | I.COPY{dst, src, impl, tmp} =>
118            I.COPY{dst=map replc dst, src=src, impl=impl, tmp=ea tmp}            I.COPY{dst=map replc dst, src=src, impl=impl, tmp=ea tmp}
      | I.ANNOTATION{i,a} =>  
           I.ANNOTATION{i=rewriteDef(i,rs,rt),  
                         a=case a of  
                            CB.DEF_USE{cellkind=CB.GP,defs,uses} =>  
                              CB.DEF_USE{cellkind=CB.GP,uses=uses,  
                                        defs=map replc defs}  
                           | _ => a}  
119       | _ => instr       | _ => instr
120    end    end
121      in
122          case instr
123           of (I.ANNOTATION{i, ...}) => rewriteDef(i, rs, rt)
124            | I.KILL{regs, spilled} =>
125                I.KILL{regs=C.addReg(rt, C.rmvReg(rs, regs)), spilled=spilled}
126            | I.INSTR(i) => I.INSTR(hppaDef(i))
127            | _ => error "rewriteDef"
128      end
129    
130    
131    fun frewriteUse(instr, fs, ft) = let    fun frewriteUse(instr, fs, ft) = let
132        fun hppaUse(instr) = let
133      fun replc r = if CB.sameColor(r,fs) then ft else r      fun replc r = if CB.sameColor(r,fs) then ft else r
134    in    in
135      case instr      case instr
# Line 145  Line 151 
151       | I.BL{lab, t, defs, uses, mem, cutsTo, n} =>       | I.BL{lab, t, defs, uses, mem, cutsTo, n} =>
152          I.BL{lab=lab, t=t, defs=defs, cutsTo=cutsTo,          I.BL{lab=lab, t=t, defs=defs, cutsTo=cutsTo,
153               uses=CS.map {from=fs,to=ft} uses, mem=mem, n=n}               uses=CS.map {from=fs,to=ft} uses, mem=mem, n=n}
      | I.ANNOTATION{i,a} =>  
         I.ANNOTATION{i=frewriteUse(i,fs,ft),  
                         a=case a of  
                            CB.DEF_USE{cellkind=CB.FP,defs,uses} =>  
                              CB.DEF_USE{cellkind=CB.FP,uses=map replc uses,  
                                        defs=defs}  
                           | _ => a}  
154       | _ => instr       | _ => instr
155      (*esac*)      (*esac*)
156    end    end
157      in
158          case instr
159           of (I.ANNOTATION{i, ...}) => frewriteUse(i, fs, ft)
160            | I.INSTR(i) => I.INSTR(hppaUse(i))
161            | I.LIVE{regs, spilled} =>
162                I.LIVE{regs=C.addFreg(ft, C.rmvFreg(fs, regs)), spilled=spilled}
163            | _ => error "frewriteUse"
164      end
165    
166    fun frewriteDef(instr, fs, ft) = let    fun frewriteDef(instr, fs, ft) = let
167        fun hppaDef(instr) = let
168      fun replc r = if CB.sameColor(r,fs) then ft else r      fun replc r = if CB.sameColor(r,fs) then ft else r
169      fun ea (SOME(I.FDirect f)) = SOME(I.FDirect(replc f))      fun ea (SOME(I.FDirect f)) = SOME(I.FDirect(replc f))
170        | ea x  = x        | ea x  = x
# Line 177  Line 185 
185       | I.BL{lab, t, defs, uses, mem, cutsTo, n} =>       | I.BL{lab, t, defs, uses, mem, cutsTo, n} =>
186          I.BL{lab=lab, t=t, cutsTo=cutsTo,          I.BL{lab=lab, t=t, cutsTo=cutsTo,
187               defs=CS.map {from=fs,to=ft} defs, uses=uses, mem=mem, n=n}               defs=CS.map {from=fs,to=ft} defs, uses=uses, mem=mem, n=n}
      | I.ANNOTATION{i,a} =>  
         I.ANNOTATION{i=frewriteDef(i,fs,ft),  
                         a=case a of  
                            CB.DEF_USE{cellkind=CB.FP,defs,uses} =>  
                              CB.DEF_USE{cellkind=CB.FP,uses=uses,  
                                        defs=map replc defs}  
                           | _ => a}  
188       | _ => instr       | _ => instr
189      (*esac*)      (*esac*)
190    end    end
191      in
192          case instr
193           of (I.ANNOTATION{i, ...}) => frewriteDef(i, fs, ft)
194            | I.INSTR(i) => I.INSTR(hppaDef(i))
195            | I.KILL{regs, spilled} =>
196                I.KILL{regs=C.addFreg(ft, C.rmvFreg(fs, regs)), spilled=spilled}
197            | _ => error "frewriteDef"
198      end
199  end  end
200    

Legend:
Removed from v.1002  
changed lines
  Added in v.1003

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