CVS: sml-dist/src/MLRISC/ppc/c-calls ppc-macosx.sml,1.22,1.23
Matthias Blume <[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj.commits |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/smlnj/sml-dist/src/MLRISC/ppc/c-calls
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12815/src/MLRISC/ppc/c-calls
Modified Files:
ppc-macosx.sml
Log Message:
experimental code for passing long long arguments via NLFFI (untested)
Index: ppc-macosx.sml
===================================================================
RCS file: /cvsroot/smlnj/sml-dist/src/MLRISC/ppc/c-calls/ppc-macosx.sml,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** ppc-macosx.sml 28 Jul 2004 21:11:56 -0000 1.22
--- ppc-macosx.sml 3 Feb 2005 22:11:48 -0000 1.23
***************
*** 275,286 ****
| CTy.C_long_double =>
assignFPR (tys, offset, availGPRs, availFPRs, layout)
! | CTy.C_unsigned isz =>
! assignGPR(sizeOfInt isz, tys, offset, availGPRs, availFPRs, layout)
! | CTy.C_signed isz =>
! assignGPR(sizeOfInt isz, tys, offset, availGPRs, availFPRs, layout)
| CTy.C_PTR =>
! assignGPR(sizeOfPtr, tys, offset, availGPRs, availFPRs, layout)
| CTy.C_ARRAY _ =>
! assignGPR(sizeOfPtr, tys, offset, availGPRs, availFPRs, layout)
| CTy.C_STRUCT tys' =>
assignMem(sizeOfStruct tys', tys, offset, availGPRs, availFPRs, layout)
--- 275,284 ----
| CTy.C_long_double =>
assignFPR (tys, offset, availGPRs, availFPRs, layout)
! | (CTy.C_unsigned isz | CTy.C_signed isz) =>
! assignGPR([sizeOfInt isz], tys, offset, availGPRs, availFPRs, layout)
| CTy.C_PTR =>
! assignGPR([sizeOfPtr], tys, offset, availGPRs, availFPRs, layout)
| CTy.C_ARRAY _ =>
! assignGPR([sizeOfPtr], tys, offset, availGPRs, availFPRs, layout)
| CTy.C_STRUCT tys' =>
assignMem(sizeOfStruct tys', tys, offset, availGPRs, availFPRs, layout)
***************
*** 289,302 ****
(* end case *))
(* assign a GP register and memory for an integer/pointer argument. *)
! and assignGPR ({sz, pad, ...}, args, offset, availGPRs, availFPRs, layout) = let
! val (loc, availGPRs) = (case (sz, availGPRs)
! of (8, _) => raise Fail "register pairs not yet supported"
! | (_, []) => (Stk(wordTy, offset), [])
! | (_, r1::rs) => (Reg(wordTy, r1, SOME offset), rs)
! (* end case *))
! val offset = offset + IntInf.fromInt(sz + pad)
! in
! assign (args, offset, availGPRs, availFPRs, loc::layout)
end
(* assign a FP register and memory/GPRs for double-precision argument. *)
and assignFPR (args, offset, availGPRs, availFPRs, layout) = let
--- 287,311 ----
(* end case *))
(* assign a GP register and memory for an integer/pointer argument. *)
! and assignGPR ([], args, offset, availGPRs, availFPRs, layout) =
! assign (args, offset, availGPRs, availFPRs, layout)
! | assignGPR ({ sz = 8, ... } :: szs,
! args, offset, availGPRs, availFPRs, layout) =
! (* The C compiler seems to treat "long long" arguments
! * as two individual 4-byte arguments. There seems to be
! * no 8-byte alignment requirement, as far as I can tell.
! * - Matthias *)
! assignGPR ({ sz = 4, pad = 0, align = 4 } ::
! { sz = 4, pad = 0, align = 4 } :: szs,
! args, offset, availGPRs, availFPRs, layout)
! | assignGPR ({ sz, pad, ... } :: szs,
! args, offset, availGPRs, availFPRs, layout) =
! let val (loc, availGPRs) =
! case availGPRs
! of [] => (Stk(wordTy, offset), [])
! | r1 :: rs => (Reg(wordTy, r1, SOME offset), rs)
! val offset = offset + IntInf.fromInt (sz + pad)
! in assignGPR (szs, args, offset, availGPRs, availFPRs, loc :: layout)
end
+
(* assign a FP register and memory/GPRs for double-precision argument. *)
and assignFPR (args, offset, availGPRs, availFPRs, layout) = let
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl