This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add more restriction in 'peep2_find_free_register'
- From: Ian Lance Taylor <iant at google dot com>
- To: Anatoly Sokolov <aesok at post dot ru>
- Cc: gcc-patches at gcc dot gnu dot org, rth at redhat dot com, chertykov at gmail dot com
- Date: Wed, 18 Jun 2008 07:45:09 -0700
- Subject: Re: Add more restriction in 'peep2_find_free_register'
- References: <113229086.20080618021412@post.ru>
Anatoly Sokolov <aesok@post.ru> writes:
> This patch add two more check in 'peep2_find_free_register' function, which
> find free hard registers for use as scratch registers in peephole2.
>
> * It is not allowed to use register that are being declared as global, as
> scratch register.
>
> * For an interrupt function it is safety to use only call-used registers
> which are saved in prologue. In 'rename_registers' optimization pass this
> check is done in HARD_REGNO_RENAME_OK macro. This patch add
> HARD_REGNO_SCRATCH_OK macro for 'peephole2' pass. The
> HARD_REGNO_SCRATCH_OK macro sould be difined for target which use interrupt
> and 'match_scratch' in peephole2 (avr, m68k).
Please make a new target hook instead (I know that the existing
HARD_REGNO_RENAME_OK is still a macro). Thanks.
Ian