Related articles |
---|
x86 register allocation dplass@yahoo.com (1999-03-23) |
Re: x86 register allocation dwight@pentasoft.com (1999-03-28) |
Re: x86 register allocation rsherry@home.com (Robert Sherry) (1999-03-28) |
x86 register allocation postiffm@umich.edu (Matt Postiff) (1999-03-28) |
Re: x86 register allocation bcombee@metrowerks.com (1999-03-28) |
Re: x86 register allocation sander@haldjas.folklore.ee (Sander Vesik) (1999-03-28) |
Re: x86 register allocation cbrtjr@ix.netcom.com (Charles E. Bortle, Jr.) (1999-03-28) |
From: | Robert Sherry <rsherry@home.com> |
Newsgroups: | comp.compilers |
Date: | 28 Mar 1999 16:59:49 -0500 |
Organization: | @Home Network |
References: | 99-03-080 |
Keywords: | 386, registers |
John,
Here are my thoughts on your question. I believe you are
correct in concluding that the register coloring idea will not work
well on this processor family. I would leave DX and AX as scratch
registers. This still leaves BX, CX , SI and DI for use.
My experience indicates to me that allocating registers on the
basic block level is the way to go. By a basic block on mean a section
of code with a single entry and single exit. You might want to
allocate BX and CX at the basic block level.
You did not mention the source language. Some languages have a
register key word in the language, which is an hint to the compiler
that this variable should be allocated to a fast register. If your
source language has such a feature you may want to allocate those
variables to SI and DI. You might also want to allocate SI and DI to
variable that are used the most throughout a single
subroutine/function. This can be done by simple counting the number of
times the variable is used/referenced in a function. This count can be
weighted for variables inside loops. One draw back is that your
compiler must either process the entire subroutine/function all at
once or be 2 passes. If this approach seems like to much work then you
could allocate SI and DI at the basic block level also.
I hope this helps.
Robert Sherry
rsherry@home.com
dplass@yahoo.com wrote:
>
> Can anyone give me a pointer to help me with x86 register allocation?
Return to the
comp.compilers page.
Search the
comp.compilers archives again.