|x86 register allocation email@example.com (1999-03-23)|
|Re: x86 register allocation firstname.lastname@example.org (1999-03-28)|
|Re: x86 register allocation email@example.com (Robert Sherry) (1999-03-28)|
|x86 register allocation firstname.lastname@example.org (Matt Postiff) (1999-03-28)|
|Re: x86 register allocation email@example.com (1999-03-28)|
|Re: x86 register allocation firstname.lastname@example.org (Sander Vesik) (1999-03-28)|
|Re: x86 register allocation email@example.com (Charles E. Bortle, Jr.) (1999-03-28)|
|From:||"Charles E. Bortle, Jr." <firstname.lastname@example.org>|
|Date:||28 Mar 1999 17:10:01 -0500|
|Keywords:||386, registers, comment|
For what my opinion is worth, I found when I wrote a FORTRAN compiler
for MS-DOS on 8088/8086 CPU, that, since, as you have observed, there
are so many register-specific instructions, that you really can't
implement true register allocation. I more-or-less hardwired the
register allocation into the code generated. For the FPU instructions
this is normally the stack registers.
For each instruction, such as ADD I look at each operand's type, and
based on the specific instruction (ADD, SUB, etc.) I emit the code
that accesses the data in a specific way, such as St(0), st(1), etc.
Loop instructions use CX so if you use the loop instructions you have
I was going to post an example here, but decided it was rather long
and might offend someone, so instead I will email it to you. If
others want to see it they can email me requesting it.
As an example I was going to present a listing created by my compiler,
and the assembly language code generated: (It's not the cleanest or
most efficient, but it actually runs...most of the work is done by the
FPU but the CPU registers come into play too) but it was so long that
I did not want to offend anyone by posting it here...so I will
email-attached it to you. If others want to see it they can email a
request to me.
[I believe that on the more recent Pentiums, you're often better off using
simple instructions than the specialized loop ones. For example JCXZ is
generally slower than CMP ECX,$0 and JZ. -John]
Return to the
Search the comp.compilers archives again.