This is the mail archive of the
mailing list for the GCC project.
Stocking temporaries in memory instead of registers?
- From: Alexandre Courbot <alexandrecourbot at linuxgames dot com>
- To: gcc at gcc dot gnu dot org
- Date: 09 May 2002 14:57:48 +0200
- Subject: Stocking temporaries in memory instead of registers?
In order to get a first working draft of my port to a register-less
architecture, I'd need to find a way to store temporaries into memory
instead of registers.
For example, the following C code:
res = a + b + c;
Gets for now compiled into:
rg4 <- a + b
res <- rg4 + c
(rg4 being the first available "dummy" register I've declared)
while I'd like to have:
temp0 <- a + b
res <- temp0 + c
I've thought of several ways to do so, but none seemed right:
* Suppressing all the non-fixed registers caused the INSNs not
to match - GCC seems to absolutely want the temporaries to be
stocked into registers.
* Maintaining a table of used registers within the block and
declaring .Temps at FUNCTION_PROLOGUE time might do it, but is
nothing else but a dirty hack.
The ideal solution would be to get GCC to allocate storage on the frame
for temporaries - that way I'd just need to examine the memory allocated
for the frame, find out the type of the temporary by looking at the
insns and/or parse tree, and I'm done. Is there a way to do so? Or does
any of you have a nicer trick than what I've described above?
My (yet incomplete) MD files are available at
in case you'd want to have a look at this weird port! ;)
Thanks in advance for any help!