[M3devel] thoughts on NT386/LONGINT?

Tony Hosking hosking at cs.purdue.edu
Fri Jan 22 15:49:28 CET 2010


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/191742a5/attachment-0002.html>


More information about the M3devel mailing list