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/x86MemRegs.sml
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 499 - (view) (download)

1 : monnier 247 functor X86MemRegs(X86Instr:X86INSTR) = struct
2 :     structure I = X86Instr
3 :    
4 :     fun error msg = MLRiscErrorMsg.impossible ("X86MemRegs." ^ msg)
5 :    
6 :     val sp = X86Cells.esp
7 :     fun memReg regmap opnd = let
8 :     (* see X86.prim.asm stack layout *)
9 : monnier 498 fun fpDisp f = Int32.fromInt((regmap f-40) * 8 + X86Runtime.vFpStart)
10 :     fun gpDisp r = Int32.fromInt(X86Runtime.vregStart +
11 :     Word.toIntX(Word.<<(Word.fromInt(r-8),0w2)))
12 :    
13 : monnier 247 in
14 :     case opnd
15 : monnier 498 of I.FDirect f => I.Displace{base=sp, disp=I.Immed(fpDisp f),
16 : monnier 411 mem=I.Region.stack}
17 : monnier 498 | I.MemReg r => I.Displace{base=sp, disp=I.Immed(gpDisp r),
18 :     mem=I.Region.stack}
19 : monnier 247 | _ => error "memReg"
20 :     end
21 :     end

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