This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: reg-stack.c potpourri
- From: Ian Lance Taylor <ian at airs dot com>
- To: "Lucas \(a.k.a T-Bird or bsdfan3\)" <tbird-contact at cox dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: 28 Jan 2006 18:06:29 -0800
- Subject: Re: reg-stack.c potpourri
- References: <43DAC77B.2080605@cox.net>
"Lucas \(a.k.a T-Bird or bsdfan3\)" <tbird-contact@cox.net> writes:
> 1) What would need to be done to reg-stack.c to allow other ports
> besides i386 to use it? (support for multiple-stack machines would be
> REALLY nice, but rather far off) (any other ideas?)
reg-stack.c is pretty closed tied to the x87 FP instructions used on
IA32. It has specific knowledge of which instructions use which slots
on the stack, e.g., in subst_stack_regs_pat.
More seriously, I don't think the general approach of treating every
stack slot as a hard register and then turning that into stack
manipulation is going to give you optimal code. If you are compiling
for a stack machine, I would think that you should select instructions
and allocate registers with the stack architecture in mind.
But if you are committed to using gcc, then using something along the
lines of reg-stack.c may be your best bet.
> 2) I found a minor bug in the header comment for reg-stack.c -- when
> whoever wrote the comment documented "push" insns, they said SET_DEST
> was two things at the same time and never said what SET_SRC was! Is
> the SET_DEST supposed to be FIRST_STACK_REG, or a plain REG or MEM?
It should read:
A "push" or "load" insn is a SET whose SET_DEST is FIRST_STACK_REG
and whose SET_SRC is REG or MEM.
Ian