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

SCM Repository

[smlnj] Annotation of /sml/trunk/src/compiler/CodeGen/x86/x86CpsRegs.sml
ViewVC logotype

Annotation of /sml/trunk/src/compiler/CodeGen/x86/x86CpsRegs.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 429 - (view) (download)
Original Path: sml/branches/SMLNJ/src/compiler/CodeGen/x86/x86CpsRegs.sml

1 : monnier 247 (* X86CpsRegs.sml --- CPS registers used on the Intel X86
2 :     *
3 :     * COPYRIGHT (c) 1997 Bell Laboratories.
4 :     *
5 :     *)
6 :     signature X86CPSREGS = sig
7 :     include CPSREGS
8 :     end
9 :    
10 :     structure X86CpsRegs : CPSREGS = struct
11 :     structure T = X86MLTree
12 : monnier 411 structure C = X86Cells
13 : monnier 247
14 :     fun upto(from, to) = if from>to then [] else from::(upto (from+1,to))
15 :     infix upto
16 :    
17 : monnier 411 val GP = C.GPReg
18 :     val FP = C.FPReg
19 : monnier 247
20 : monnier 411 val eax = T.REG(32, C.eax) val esp = T.REG(32, C.esp)
21 :     val ecx = T.REG(32, C.ecx) val ebp = T.REG(32, C.ebp)
22 :     val edx = T.REG(32, C.edx) val esi = T.REG(32, C.esi)
23 :     val ebx = T.REG(32, C.ebx) val edi = T.REG(32, C.edi)
24 : monnier 247
25 : monnier 411 fun regInMem i = T.LOAD(32, T.ADD(32, esp, T.LI i), CPSRegions.memory)
26 :    
27 : monnier 247 val allocptr = edi
28 :     val stdarg = ebp
29 :     val stdcont = esi
30 :     val stackptr = esp
31 :    
32 :     val baseptr = regInMem 4
33 :     val exnptr = regInMem 8
34 :     val limitptr = regInMem 12
35 :     val gcLink = regInMem 16
36 :     val storeptr = regInMem 24
37 :     val varptr = regInMem 28
38 :    
39 : monnier 411 val stdlink = T.REG(32, GP 8) (* vreg 0 *)
40 :     val stdclos = T.REG(32, GP 9) (* vreg 1 *)
41 : monnier 247
42 :     fun mkVregList(n, 0) = []
43 : monnier 411 | mkVregList(n, cnt) = T.REG(32, GP n)::mkVregList(n+1, cnt-1)
44 : monnier 247
45 :     (* miscregs = {ebx,ecx,edx,r10,r11,...r31} *)
46 :     val miscregs = ebx::ecx::edx::mkVregList(10, X86Runtime.numVregs - 2)
47 :    
48 :     val calleesave = Array.fromList miscregs
49 :     val exhausted = NONE
50 :    
51 : monnier 411 val floatregs = map (fn f => T.FREG(64,f)) ((FP 8) upto (FP 31))
52 : monnier 247 val savedfpregs = []
53 :    
54 : monnier 411 val availR = map (fn T.REG(_,r) => r) [ebp, esi, ebx, ecx, edx, eax]
55 :     val dedicatedR = map (fn T.REG(_,r) => r) [edi, esp]
56 :     val availF = (FP 8) upto (FP 31)
57 :     val dedicatedF = map FP [0,1,2,3,4,5,6,7]
58 :     val signedGCTest = false
59 : monnier 429 val addressWidth = 32
60 : monnier 247 end
61 :    
62 :    

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