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

SCM Repository

[smlnj] View of /sml/branches/primop-branch/src/compiler/CodeGen/x86/x86MemRegs.sml
ViewVC logotype

View of /sml/branches/primop-branch/src/compiler/CodeGen/x86/x86MemRegs.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1372 - (download) (annotate)
Mon Sep 15 22:16:26 2003 UTC (17 years, 1 month ago)
File size: 804 byte(s)
This commit was manufactured by cvs2svn to create branch
'primop-branch'.
functor X86MemRegs(X86Instr:X86INSTR) = struct
  structure I = X86Instr
  structure CB = CellsBasis

  fun error msg = MLRiscErrorMsg.impossible ("X86MemRegs." ^ msg)

  fun memReg{reg, base} = let
    (* see X86.prim.asm stack layout *)
    fun fpDisp f = Int32.fromInt((CB.registerNum f-8) * 8 + X86Runtime.vFpStart)
    fun gpDisp r = Int32.fromInt
                     (X86Runtime.vregStart +
                       Word.toIntX(
                          Word.<<(Word.fromInt(CB.registerNum r-8),0w2)))

  in
    case reg
    of I.FDirect f => I.Displace{base=base, disp=I.Immed(fpDisp f), 
                                 mem=I.Region.stack}
     | I.MemReg r => I.Displace{base=base, disp=I.Immed(gpDisp r),
                                mem=I.Region.stack}
     | _ => error "memReg"
  end
end

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