This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Memory layout (novice questions).
- To: Virgil Palanciuc <Virgil dot Palanciuc at cs dot pub dot ro>
- Subject: Re: Memory layout (novice questions).
- From: Joern Rennecke <amylaar at cygnus dot co dot uk>
- Date: Tue, 9 May 2000 17:17:16 +0100 (BST)
- CC: Philippe De Muyter <phdm at macqel dot be>, mrs at windriver dot com, gcc at gcc dot gnu dot org
> P.S. I read your mail again and I think you might have misunderstood your
> question. Did you ask whether I plan to move the most frequently used
> variables first? No, I do not plan to do this. I just want to move the
> shorter ones first - this will make more variables available at short
> offsets. You may object that the shorter ones might be infrequently used,
> and that I might actually decrease the efficiency, but I don't think there
> will be many real cases in which this thing will happen. I will eventually
> sort the list based on a
> (size, frequency_of_use) formula, but I just want to start with simple
> things first.
You can't do it just on trees. You'd have to do most of the work in reload,
since most small variables are candidates for allocation in registers, and
are spilled on the stack only when they turn out not to fit into the available
registers. Moreover, the direction the frame grows and if frame pointer
elimination is used or not decides which way you have to order the variables
to archive your goal.
To order the spilled variables in reload, you'd have to do the ordering
in each reload iteration after find_reloads, and if your ordering differs
from the one used during find_reloads, require another reload iteration.
Make sure that reload terminates, for example, if the last few iterations
gave only minor changes in the ordering, and there is no other reason in
the current iteration to do another iteration, you can just re-use the
last ordering.