[M3devel] x86 int64 guidance?

Jay jay.krell at cornell.edu
Wed Oct 24 12:21:52 CEST 2007


I'm looking for guidance on the 64 bit integer support in the x86 code generator.What level does it belong in?
The code appears to be in three primary files, that are layered mostly like so:M3x86.m3 Stackx86.m3   Codex86.m3
Stackx86 implements, I guess, a "virtual stack" which, I guess, makes certain optimizations easy, stuff like avoiding redundant moves, because the stack knows which register corresponds to which variable.
M3x86 does call directly into Codex86, a lot actually.And so of course does Stackx86 (per the layering).
There is trafficing in:
  Operand = RECORD    loc: OLoc;    mvar: MVar := NoStore;    reg: Regno := 0;    reg2: Regno := 0; << maybe add this??    imm: INTEGER := 0;    stackp: INTEGER := 0;    opcode := FALSE;  END;
notice just one register.These are x86 registers, not some abtract thing.That is what the virtual stack contains.
One might imagine the support going one level higher even,implement int64 as a record/struct, but add some notion ofadd-with-carry, sub-with-carry, multiply64, divide64,multiply64x64to32, etc.?
You know, when doing add, there's no canonical requiredregister pair to use, they all work, and the upper 32 bits might evenbe thrown out, so don't even necessarily compute them.
I'd be a bit wary of the carry surviving though.
Or maybe a pseudo register eax_edx should be defined?
I'm thinking add reg2 might be easiest, though it seems wrong -- unclean.And always compute the full add/sub/mult/div.
Maybe an array of registers?
 - Jay
_________________________________________________________________
Peek-a-boo FREE Tricks & Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20071024/d36e4583/attachment-0001.html>


More information about the M3devel mailing list