CVS: sml/src/MLRISC/x86/c-calls ia32-svid.sml,1.37,1.38

John Reppy <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj.commits
Message-ID <[email protected]>
Update of /cvsroot/smlnj/sml/src/MLRISC/x86/c-calls
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18474/src/MLRISC/x86/c-calls

Modified Files:
	ia32-svid.sml 
Log Message:
  Modified CCalls for partial support of MacOS X on Intel ABI.


Index: ia32-svid.sml
===================================================================
RCS file: /cvsroot/smlnj/sml/src/MLRISC/x86/c-calls/ia32-svid.sml,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** ia32-svid.sml	13 Feb 2005 03:52:06 -0000	1.37
--- ia32-svid.sml	13 Feb 2006 22:17:29 -0000	1.38
***************
*** 30,34 ****
   *	  implicit 0th argument, and on return %eax contains this
   *	  address.  The called function is responsible for removing
!  *	  this argument from the stack.
   *
   *    Function arguments:
--- 30,35 ----
   *	  implicit 0th argument, and on return %eax contains this
   *	  address.  The called function is responsible for removing
!  *	  this argument from the stack using a "ret $4" instruction.
!  *	  NOTE: the MacOS X ABI returns small structs in %eax/%edx.
   *
   *    Function arguments:
***************
*** 52,55 ****
--- 53,62 ----
     *)
      val fast_floating_point : bool ref
+   (* alignment requirement for stack frames; should be a power of two
+    * that is at least four.
+    *)
+     val frameAlign : int
+   (* Should small structs/unions be returned in %eax/%edx? *)
+     val returnSmallStructsInRegs : bool
    ) : C_CALLS = struct
  
***************
*** 214,223 ****
  		      val {sz, align} = sizeOfStruct tys
  		      in
! 			(SOME(Reg(wordTy, eax, NONE)), SOME{szb=sz, align=align}, 4)
  		      end
  		  | Ty.C_UNION tys => let
  		      val {sz, align} = sizeOfUnion tys
  		      in
! 			(SOME(Reg(wordTy, eax, NONE)), SOME{szb=sz, align=align}, 4)
  		      end
  		(* end case *))
--- 221,234 ----
  		      val {sz, align} = sizeOfStruct tys
  		      in
! 		        if (sz > 8) orelse (not returnSmallStructsInRegs)
! 		          then (SOME(Reg(wordTy, eax, NONE)), SOME{szb=sz, align=align}, 4)
! 		          else raise Fail "small struct return not implemented yet"
  		      end
  		  | Ty.C_UNION tys => let
  		      val {sz, align} = sizeOfUnion tys
  		      in
! 		        if (sz > 8) orelse (not returnSmallStructsInRegs)
! 		          then (SOME(Reg(wordTy, eax, NONE)), SOME{szb=sz, align=align}, 4)
! 		          else raise Fail "small union return not implemented yet"
  		      end
  		(* end case *))
***************
*** 261,266 ****
  		end
  	  val (argLocs, argSz) = assign (paramTys, argOffset, [])
  	  in {
! 	    argLocs = argLocs, argMem = {szb = argSz, align = 4},
  	    resLoc = resLoc, structRetLoc = structRetLoc
  	  } end
--- 272,278 ----
  		end
  	  val (argLocs, argSz) = assign (paramTys, argOffset, [])
+ 	  val argMem = {szb = alignAddr (argSz, frameAlign), align = frameAlign}
  	  in {
! 	    argLocs = argLocs, argMem = argMem,
  	    resLoc = resLoc, structRetLoc = structRetLoc
  	  } end
***************
*** 355,359 ****
  					  val stms =
  						T.STORE(ty, offSP offset, T.REG(ty, tmp), stack)
! 						  :: T.MV(ty, tmp, T.LOAD (ty, addr(offset - baseOffset), mem))
  						  :: stms
  					  in
--- 367,371 ----
  					  val stms =
  						T.STORE(ty, offSP offset, T.REG(ty, tmp), stack)
! 						  :: T.MV(ty, tmp, T.LOAD(ty, addr(offset - baseOffset), mem))
  						  :: stms
  					  in
***************
*** 383,387 ****
  		  f (args, argLocs, [])
  		end
! 	(* the SVID specifies that the caller pops arguments, but a the callee
  	 * pops the arguments in a stdcall on Windows.  I'm not sure what other
  	 * differences there might be between the SVID and Windows ABIs. (JHR)
--- 395,399 ----
  		  f (args, argLocs, [])
  		end
! 	(* the SVID specifies that the caller pops arguments, but the callee
  	 * pops the arguments in a stdcall on Windows.  I'm not sure what other
  	 * differences there might be between the SVID and Windows ABIs. (JHR)



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.