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

Diff of /sml/trunk/src/compiler/CodeGen/x86/x86StackSpills.sml

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

revision 730, Fri Nov 10 14:04:49 2000 UTC revision 731, Fri Nov 10 22:57:45 2000 UTC
# Line 2  Line 2 
2    structure I : X86INSTR    structure I : X86INSTR
3    val init : unit -> unit    val init : unit -> unit
4    val setAvailableOffsets : I.operand list -> unit    val setAvailableOffsets : I.operand list -> unit
5      val setAvailableFPOffsets : I.operand list -> unit
6    val getRegLoc : int -> I.operand    val getRegLoc : int -> I.operand
7    val getFregLoc : int -> I.operand    val getFregLoc : int -> I.operand
8  end  end
# Line 17  Line 18 
18    val spillOffset = ref initialSpillOffset    val spillOffset = ref initialSpillOffset
19    val spillAreaSz = X86Runtime.spillAreaSz    val spillAreaSz = X86Runtime.spillAreaSz
20    val availableOffsets = ref [] : I.operand list ref    val availableOffsets = ref [] : I.operand list ref
21      val availableFPOffsets = ref [] : I.operand list ref
22    
23    (* Indicate that memory some memory registers are not used and    (* Indicate that memory some memory registers are not used and
24     * can be used for spilling.     * can be used for spilling.
25     *)     *)
26    fun setAvailableOffsets offsets = availableOffsets := offsets    fun setAvailableOffsets offsets = availableOffsets := offsets
27      fun setAvailableFPOffsets offsets = availableFPOffsets := offsets
28    
29    fun newOffset n =    fun newOffset n =
30      if (n > spillAreaSz) then error "newOffset - spill area is too small"      if (n > spillAreaSz) then error "newOffset - spill area is too small"
# Line 34  Line 37 
37    fun init () =    fun init () =
38      (spillOffset:=initialSpillOffset;      (spillOffset:=initialSpillOffset;
39       availableOffsets := [];       availableOffsets := [];
40         availableFPOffsets := [];
41       Intmap.clear spillTbl       Intmap.clear spillTbl
42      )      )
43    
# Line 55  Line 59 
59    fun getFregLoc freg =    fun getFregLoc freg =
60        lookupTbl freg        lookupTbl freg
61          handle _ =>          handle _ =>
62            let val operand =
63                 case !availableFPOffsets of
64                   [] =>
65          let val offset = !spillOffset          let val offset = !spillOffset
66              val fromInt = Word.fromInt              val fromInt = Word.fromInt
67              val aligned = Word.toIntX(Word.andb(fromInt offset+0w7, fromInt ~8))              val aligned = Word.toIntX(Word.andb(fromInt offset+0w7, fromInt ~8))
68              val operand = I.Immed(toInt32 aligned)                 in  newOffset(aligned+8); I.Immed(toInt32 aligned)
69          in  newOffset(aligned+8);                 end
70              addTbl (freg, operand);               | off::offs => (availableFPOffsets := offs; off)
71            in  addTbl (freg, operand);
72              operand              operand
73          end          end
74  end  end

Legend:
Removed from v.730  
changed lines
  Added in v.731

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