[M3devel] thoughts on NT386/LONGINT?

Jay K jay.krell at cornell.edu
Fri Jan 22 23:53:41 CET 2010


I'll see what I can figure out.

I considered pushings pairs of operands in m3x86.m3 but I thinkthat won't work.

Noticing how integer vs. floating point is handledis perhaps useful, as this is another way in which m3cgis "homogenous" but backends have to act differentlybased on type.

 - Jay



From: hosking at cs.purdue.edu
Date: Fri, 22 Jan 2010 09:49:28 -0500
To: jay.krell at cornell.edu
CC: m3devel at elegosoft.com
Subject: Re: [M3devel] thoughts on NT386/LONGINT?




That's a very good question.  I suspect allocating register pairs as needed would make for a fairly difficult implementation.  I would err on the side of simplicity for LONGINT code generation rather than complexity.  You might easily just push/pop operands and return values on the stack, on the grounds that modern x86 hardware will do a good job renaming stack locations to registers.  i.e., worry about correctness first and performance later.
On 22 Jan 2010, at 07:39, Jay K wrote:Anyone have any thoughts on how to implement LONGINT on NT386?
 

The code is setup to do pretty good constant folding and enregistration.
 

I did the work so that constant folding should work for LONGINT.
 

However I think doing good enregistration is maybe still
too much work. In particular, I think every LONGINT
operation will do a load, operation, store.
Typical of unoptimized code, but not typical
of the Modula-3/NT386 quality.
 
In particular, there is still this notion of an "operand"
that might be held in one register.

 
I'd have to make it a register pair, or array of registers,
or invent "psuedo registers" that are register pairs.
An array of registers is the obvious best choice, but
none of these are a small change.
 

96 occurences of "reg" in Stackx86.m3, 58 in M3x86.m3,
would probably all have to change.
63 in Codex86.m3 unsure.
 It is the lowest level and might need to only deal with single
  registers.

 
Returning LONGINT from a function also needs separate attention.
Maybe I really should go ahead and use an array of registers?
 

 - Jay


 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100122/14d9d0fe/attachment-0002.html>


More information about the M3devel mailing list