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 /MLRISC/trunk/amd64/staged-allocation/amd64-vararg-ccall-fn.sml
ViewVC logotype

Diff of /MLRISC/trunk/amd64/staged-allocation/amd64-vararg-ccall-fn.sml

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

revision 3053, Mon Jun 2 14:08:02 2008 UTC revision 3054, Tue Jun 3 01:26:28 2008 UTC
# Line 8  Line 8 
8    
9  functor AMD64VarargCCallFn (  functor AMD64VarargCCallFn (
10      structure T : MLTREE      structure T : MLTREE
11        val push : T.rexp -> T.stm
12        val leave : T.stm
13    ) = struct    ) = struct
14    
15      structure T = T      structure T = T
# Line 20  Line 22 
22                                structure CCall = CCall                                structure CCall = CCall
23                                val gprParams = List.map #2 CCall.CCs.gprParams                                val gprParams = List.map #2 CCall.CCs.gprParams
24                                val fprParams = List.map #2 CCall.CCs.fprParams                                val fprParams = List.map #2 CCall.CCs.fprParams
25                                  val gprTys = [32, 64]
26                                  val fprTys = [32, 64]
27                                val spReg = CCall.spReg                                val spReg = CCall.spReg
28                                val wordTy = 64                                val wordTy = 64
29                                val newReg = C.newReg                                val newReg = C.newReg
# Line 34  Line 38 
38                raise Fail "jump to the interpreter"                raise Fail "jump to the interpreter"
39             end             end
40    
41      fun genVarargs (cFun, args) =      fun genVarargs () = let
42              T.MV(wordTy, C.rax, lit (List.length CCall.CCs.fprParams)) :: VarargCCall.genVarargs(cFun, args)             val lab = Label.global "varargs"
43               val args = C.newReg()
44               val cFun = C.newReg()
45               in
46                   (lab,
47                    List.concat [
48                       [T.MV(wordTy, C.rax, lit (List.length CCall.CCs.fprParams))],
49                       [push (T.REG(64, C.rbp)),
50                        T.COPY (wordTy, [C.rbp], [C.rsp])],
51                       [T.MV(wordTy, cFun, T.REG(wordTy, C.rsi))],    (* arg0 *)
52                       [T.MV(wordTy, args, T.REG(wordTy, C.rdi))],   (* arg1 *)
53                       VarargCCall.genVarargs(T.REG(wordTy, cFun), args),
54                       [leave],
55                       [T.RET []]
56                       ])
57               end
58    
59    end (* AMD64VarargCCallFn *)    end (* AMD64VarargCCallFn *)

Legend:
Removed from v.3053  
changed lines
  Added in v.3054

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