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/branches/SMLNJ/src/MLRISC/x86/ra/x86Spill.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/MLRISC/x86/ra/x86Spill.sml

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

revision 428, Wed Sep 8 09:47:00 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 30  Line 30 
30     *)     *)
31    structure I = Instr    structure I = Instr
32    structure C = I.C    structure C = I.C
33      structure SL = SortedList
34    
35    fun error msg = MLRiscErrorMsg.impossible("X86Spill: "^ msg)    fun error msg = MLRiscErrorMsg.impossible("X86Spill: "^ msg)
36    
# Line 65  Line 66 
66      fun rewrite new old = if old=reg then new else old      fun rewrite new old = if old=reg then new else old
67      fun spillIt instr =      fun spillIt instr =
68      case instr      case instr
69      of I.CALL(opnd, (r,f,c), uses, mem) => let      of I.CALL(opnd, defs, uses, mem) =>
70           val tmpR = newReg()           {proh=[],
71         in            instr=SOME(I.CALL(opnd, C.rmvReg(reg,defs), uses, mem)),
72           {proh=[tmpR],            code=[] }
           instr=SOME(I.CALL(opnd, (map (rewrite tmpR) r,f,c), uses, mem)),  
           code=[I.MOVE{mvOp=I.MOVL, src=I.Direct tmpR, dst=spillLoc}] }  
        end  
73       | I.MOVE{mvOp=I.MOVZX, src, dst} => let(* dst must always be a register *)       | I.MOVE{mvOp=I.MOVZX, src, dst} => let(* dst must always be a register *)
74           val tmpR = newReg()           val tmpR = newReg()
75         in         in
# Line 167  Line 165 
165       | I.JCC{opnd=I.Direct _, cond} => done[I.JCC{opnd=spillLoc, cond=cond}]       | I.JCC{opnd=I.Direct _, cond} => done[I.JCC{opnd=spillLoc, cond=cond}]
166       | I.JCC{opnd, cond} =>       | I.JCC{opnd, cond} =>
167          withTmp(fn tmpR => I.JCC{opnd=operand(tmpR, opnd), cond=cond})          withTmp(fn tmpR => I.JCC{opnd=operand(tmpR, opnd), cond=cond})
168       | I.CALL(opnd, defs, uses as (r,f,c), mem) =>       | I.CALL(opnd, defs, uses, mem) => let
169          withTmp(fn tmpR =>           val tmpR = newReg()
170                    I.CALL(operand(tmpR, opnd), defs,         in
171                           (map (rewrite tmpR) r, f,c), mem))           {code=[I.CALL(operand(tmpR, opnd), defs, C.rmvReg(reg,uses), mem)],
172              proh=[tmpR]}
173           end
174       | I.MOVE{mvOp, src, dst as I.Direct _} =>       | I.MOVE{mvOp, src, dst as I.Direct _} =>
175          withTmp(fn tmpR =>I.MOVE{mvOp=mvOp, src=operand(tmpR, src), dst=dst})          withTmp(fn tmpR =>I.MOVE{mvOp=mvOp, src=operand(tmpR, src), dst=dst})
176       | I.MOVE{mvOp, src as I.Direct _, dst} =>       | I.MOVE{mvOp, src as I.Direct _, dst} =>
# Line 219  Line 219 
219    fun fspill(instr, reg, spillLoc) =    fun fspill(instr, reg, spillLoc) =
220      (case instr      (case instr
221        of I.FSTP _ => {proh=[], instr=NONE, code=[I.FSTP spillLoc]}        of I.FSTP _ => {proh=[], instr=NONE, code=[I.FSTP spillLoc]}
222           | I.CALL(opnd, defs, uses, mem) =>
223             {proh=[],
224              instr=SOME(I.CALL(opnd, C.rmvFreg(reg,defs), uses, mem)),
225              code=[] }
226         | I.ANNOTATION{i,a} => fspill(i, reg, spillLoc)         | I.ANNOTATION{i,a} => fspill(i, reg, spillLoc)
227         | _ => error "fspill"         | _ => error "fspill"
228      (*esac*))      (*esac*))
# Line 231  Line 235 
235               {code=[I.FBINARY{binOp=binOp, src=spillLoc, dst=dst}],               {code=[I.FBINARY{binOp=binOp, src=spillLoc, dst=dst}],
236                proh=[]}                proh=[]}
237             else error "freload:FBINARY"             else error "freload:FBINARY"
238           | I.CALL(opnd, defs, uses, mem) =>
239             {proh=[],
240              code=[I.CALL(opnd, C.rmvFreg(reg,defs), uses, mem)]}
241         | I.ANNOTATION{i,a} => freload(i, reg, spillLoc)         | I.ANNOTATION{i,a} => freload(i, reg, spillLoc)
242         | _  => error "freload"         | _  => error "freload"
243      (*esac*))      (*esac*))

Legend:
Removed from v.428  
changed lines
  Added in v.429

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