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/compiler/CodeGen/x86/x86CG.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/compiler/CodeGen/x86/x86CG.sml

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

revision 474, Wed Nov 10 22:59:58 1999 UTC revision 475, Wed Nov 10 22:59:58 1999 UTC
# Line 11  Line 11 
11      structure MachSpec   = X86Spec      structure MachSpec   = X86Spec
12      structure PseudoOps  = X86PseudoOps      structure PseudoOps  = X86PseudoOps
13      structure CpsRegs    = X86CpsRegs      structure CpsRegs    = X86CpsRegs
14      structure InsnProps  = X86Props(X86Instr)      structure InsnProps  = X86Props
15      structure Asm        = X86AsmEmitter      structure Asm        = X86AsmEmitter
16    
17      val stack = I.Region.stack      val stack = I.Region.stack
# Line 97  Line 97 
97        val getFregLoc = X86StackSpills.getFregLoc        val getFregLoc = X86StackSpills.getFregLoc
98    
99        (* spill floating point *)        (* spill floating point *)
100        fun spillF{instr, reg, spillLoc, node, kill=true, regmap, annotations} =        fun spillF{instr, reg, spillLoc, graph, kill, regmap, annotations} = let
           let fun f (I.CALL _ | I.RET _ | I.POP _ | I.FXCH) =  
                   spillF{instr=instr, reg=reg, spillLoc=spillLoc, node=node,  
                          kill=false, regmap=regmap, annotations=annotations}  
                   | f(I.ANNOTATION{i,...}) = f i  
                   | f _ = {code=[], proh=[], instr=NONE}  
             in  f instr end  
          | spillF{instr, reg, spillLoc, node, kill, regmap, annotations} = let  
101            val _ = floatSpillCnt := !floatSpillCnt + 1            val _ = floatSpillCnt := !floatSpillCnt + 1
102            val slot = I.Displace{base=esp, disp=getFregLoc spillLoc, mem=stack}            val slot = I.Displace{base=esp, disp=getFregLoc spillLoc, mem=stack}
103            fun spillInstr(r) = [I.FLD(I.FDirect(r)), I.FSTP(slot)]            fun spillInstr(r) = [I.FLD(I.FDirect(r)), I.FSTP(slot)]
# Line 131  Line 124 
124        end        end
125    
126        (* reload floating point *)        (* reload floating point *)
127        fun reloadF{instr, reg, spillLoc, node, regmap, annotations} =        fun reloadF{instr, reg, spillLoc, graph, regmap, annotations} =
128        let val _ = floatReloadCnt := !floatReloadCnt + 1        let val _ = floatReloadCnt := !floatReloadCnt + 1
129            val slot = I.Displace{base=esp, disp=getFregLoc spillLoc, mem=stack}            val slot = I.Displace{base=esp, disp=getFregLoc spillLoc, mem=stack}
130            fun reloadInstr(r, rest) = I.FLD(slot) :: I.FSTP(I.FDirect r) :: rest            fun reloadInstr(r, rest) = I.FLD(slot) :: I.FSTP(I.FDirect r) :: rest
# Line 165  Line 158 
158    
159        val getRegLoc = X86StackSpills.getRegLoc        val getRegLoc = X86StackSpills.getRegLoc
160    
161        fun spillR32{instr, reg, spillLoc, node, kill=true, regmap, annotations} =        fun spillR32{instr, reg, spillLoc, graph, kill, regmap, annotations} =
           let fun f (I.CALL _ | I.RET _ | I.POP _ | I.FXCH) =  
                   spillR32{instr=instr, reg=reg, spillLoc=spillLoc, node=node,  
                            kill=false, regmap=regmap, annotations=annotations}  
                 | f(I.ANNOTATION{i,...}) = f i  
                 | f _ = {code=[], proh=[], instr=NONE}  
           in  f instr end  
         | spillR32{instr, reg, spillLoc, node, kill, regmap, annotations} =  
162            let val _ = intSpillCnt := !intSpillCnt + 1            let val _ = intSpillCnt := !intSpillCnt + 1
163                val slot = I.Displace{base=esp, disp=getRegLoc spillLoc,mem=stack}                val slot = I.Displace{base=esp, disp=getRegLoc spillLoc,mem=stack}
164                fun spillInstr(r) =                fun spillInstr(r) =
# Line 199  Line 185 
185                | _ => X86Spill.spill(instr, reg, slot)                | _ => X86Spill.spill(instr, reg, slot)
186            end            end
187    
188        fun reloadR32{instr, reg, spillLoc, node, regmap, annotations} =        fun reloadR32{instr, reg, spillLoc, graph, regmap, annotations} =
189        let val _ = intReloadCnt := !intReloadCnt + 1        let val _ = intReloadCnt := !intReloadCnt + 1
190            val slot = I.Displace{base=esp, disp=getRegLoc spillLoc, mem=stack}            val slot = I.Displace{base=esp, disp=getRegLoc spillLoc, mem=stack}
191            fun reloadInstr(r, rest) =            fun reloadInstr(r, rest) =
# Line 230  Line 216 
216        end        end
217    
218         (* register allocation for general purpose registers *)         (* register allocation for general purpose registers *)
219        fun spillR8{instr, reg, spillLoc, node, kill=true, regmap, annotations} =        fun spillR8{instr, reg, spillLoc, graph, kill, regmap, annotations} =
           let fun f (I.CALL _ | I.RET _ | I.POP _ | I.FXCH) =  
                 spillR8{instr=instr, reg=reg, spillLoc=spillLoc, node=node,  
                         kill=false, regmap=regmap, annotations=annotations}  
                 | f(I.ANNOTATION{i,...}) = f i  
                 | f _ = {code=[], proh=[], instr=NONE}  
           in  f instr end  
         | spillR8{instr, reg, spillLoc, node, kill, regmap, annotations} =  
220            let val _ = intSpillCnt := !intSpillCnt + 1            let val _ = intSpillCnt := !intSpillCnt + 1
221                val slot = I.Displace{base=esp, disp=getRegLoc spillLoc,mem=stack}                val slot = I.Displace{base=esp, disp=getRegLoc spillLoc,mem=stack}
222                fun spillInstr(r) =                fun spillInstr(r) =
# Line 264  Line 243 
243            (print ("in spill handler "^ Int.toString reg ^ "\n");            (print ("in spill handler "^ Int.toString reg ^ "\n");
244             {code=[instr], proh=[reg], instr=NONE})             {code=[instr], proh=[reg], instr=NONE})
245    
246        fun reloadR8{instr, reg, spillLoc, node, regmap, annotations} =        fun reloadR8{instr, reg, spillLoc, graph, regmap, annotations} =
247        let val _ = intReloadCnt := !intReloadCnt + 1        let val _ = intReloadCnt := !intReloadCnt + 1
248            val slot = I.Displace{base=esp, disp=getRegLoc spillLoc, mem=stack}            val slot = I.Displace{base=esp, disp=getRegLoc spillLoc, mem=stack}
249            fun reloadInstr(r, rest) =            fun reloadInstr(r, rest) =

Legend:
Removed from v.474  
changed lines
  Added in v.475

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