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/staged-allocation/c-call-fn.sml
ViewVC logotype

Diff of /MLRISC/trunk/staged-allocation/c-call-fn.sml

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

revision 3038, Tue May 27 23:48:15 2008 UTC revision 3039, Wed May 28 03:39:25 2008 UTC
# Line 37  Line 37 
37    
38      val stack = T.Region.stack      val stack = T.Region.stack
39    
40      fun li i = T.LI (T.I.fromInt (32, i))      fun lit i = T.LI (T.I.fromInt (32, i))
41    
42      (* generate MLRISC statements for copying a C argument to a parameter / return location *)      (* generate MLRISC statements for copying a C argument to a parameter / return location *)
43      fun copyLoc arg (i, loc, (stms, gprs, fprs)) = (case (arg, loc)      fun copyLoc arg (i, loc, (stms, gprs, fprs)) = (case (arg, loc)
# Line 45  Line 45 
45           of (ARG (e as T.REG _), C_STK (mty, offset)) =>           of (ARG (e as T.REG _), C_STK (mty, offset)) =>
46              (T.STORE (wordTy, offSp offset, e, stack) :: stms, gprs, fprs)              (T.STORE (wordTy, offSp offset, e, stack) :: stms, gprs, fprs)
47            | (ARG (T.LOAD (ty, e, rgn)), C_GPR (mty, r)) =>            | (ARG (T.LOAD (ty, e, rgn)), C_GPR (mty, r)) =>
48              (copyToReg(mty, r, T.LOAD (ty, T.ADD(wordTy, e, li (i*8)), rgn)) @ stms, r :: gprs, fprs)              (copyToReg(mty, r, T.LOAD (ty, T.ADD(wordTy, e, lit (i*8)), rgn)) @ stms, r :: gprs, fprs)
49            | (ARG (T.LOAD (ty, e, rgn)), C_STK (mty, offset)) => let            | (ARG (T.LOAD (ty, e, rgn)), C_STK (mty, offset)) => let
50              val tmp = C.newReg ()              val tmp = C.newReg ()
51              in              in
52                  (T.STORE (ty, offSp offset, T.REG (ty, tmp), stack) ::                  (T.STORE (ty, offSp offset, T.REG (ty, tmp), stack) ::
53                   T.MV (ty, tmp, T.LOAD (ty, T.ADD(wordTy, e, li (i*8)), rgn)) :: stms, gprs, fprs)                   T.MV (ty, tmp, T.LOAD (ty, T.ADD(wordTy, e, lit (i*8)), rgn)) :: stms, gprs, fprs)
54              end              end
55            | (ARG e, C_STK (mty, offset)) => let            | (ARG e, C_STK (mty, offset)) => let
56               val tmp = C.newReg ()               val tmp = C.newReg ()
# Line 62  Line 62 
62            | (FARG (e as T.FREG _), C_STK (mty, offset)) =>            | (FARG (e as T.FREG _), C_STK (mty, offset)) =>
63              (T.FSTORE (mty, offSp offset, e, stack) :: stms, gprs, fprs)              (T.FSTORE (mty, offSp offset, e, stack) :: stms, gprs, fprs)
64            | (ARG (T.LOAD (ty, e, rgn)), C_FPR (mty, r)) =>            | (ARG (T.LOAD (ty, e, rgn)), C_FPR (mty, r)) =>
65              (copyToFReg(mty, r, T.FLOAD (ty, T.ADD(wordTy, e, li (i*8)), rgn)) @ stms, gprs, (mty, r) :: fprs)              (copyToFReg(mty, r, T.FLOAD (ty, T.ADD(wordTy, e, lit (i*8)), rgn)) @ stms, gprs, (mty, r) :: fprs)
66            | (FARG (T.FLOAD (ty, e, rgn)), C_STK (mty, offset)) => let            | (FARG (T.FLOAD (ty, e, rgn)), C_STK (mty, offset)) => let
67              val tmp = C.newFreg ()              val tmp = C.newFreg ()
68              in              in
69                  (T.FSTORE (wordTy, offSp offset, T.FREG (wordTy, tmp), stack) ::                  (T.FSTORE (wordTy, offSp offset, T.FREG (wordTy, tmp), stack) ::
70                   T.FMV (wordTy, tmp, T.FLOAD (ty, T.ADD(wordTy, e, li (i*8)), rgn)) :: stms, gprs, fprs)                   T.FMV (wordTy, tmp, T.FLOAD (ty, T.ADD(wordTy, e, lit (i*8)), rgn)) :: stms, gprs, fprs)
71              end              end
72            | (FARG e, C_STK (mty, offset)) => let            | (FARG e, C_STK (mty, offset)) => let
73              val tmp = C.newFreg ()              val tmp = C.newFreg ()

Legend:
Removed from v.3038  
changed lines
  Added in v.3039

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