This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Question about register allocation (GCC 4.1)
- From: Thomas Bernard <tbernard at science dot uva dot nl>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 16 Feb 2007 18:22:25 +0100
- Subject: Question about register allocation (GCC 4.1)
Hello all,
I have a question about retargeting the back-end of GCC 4.1.
Our targeted architecture uses four classes of registers: global ($RG),
locals ($RL), dependents ($RD), shareds ($RS). In total 31 hard
registers available for the all previous classes.
The amount of each register is only known at compile-time depending on
the needs of the program.
Normally I would have to specify the number of registers for each class
in the .md and .h files which describe the targeted architecture.
But is it possible to have an arbitrary number of register in each class
and the number would be given by the compiler depending on the needs of
registers at compile-time (when the compiler discovers how many
registers of each class are needed) ???
Let's take an example...
A source file A needs 10 registers for the globals, 11 for the locals, 5
for dependents and 5 for shareds (10RG+11RL+5RD+5RS<=31). And for a
program B needs 11 globals, 13 for the locals, 3 for dependents and 4
for shareds (11RG+13RL+3RD+4RS<=31). Finally the program C needs 3
globals and 10 locals (3RG+10RL<<31).
So basically this is known at compile-time. Such as "dynamic" register
allocator.
Is it that possible and what are the implications on the register
allocator ???
Thanks in advance,
Regards,
T.