aboutsummaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2008-07-09 17:43:11 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2008-07-09 17:43:11 +0400
commitdbc42c44d87ef1031c3f649436df02fbcdbcc3c6 (patch)
tree1e2b360a3708a9b833a49b11cda5009cb7f10ed9 /gcc/recog.c
parent28f16d05a00d360b76f3c48ac739bcab22fb1418 (diff)
downloadgcc-dbc42c44d87ef1031c3f649436df02fbcdbcc3c6.zip
gcc-dbc42c44d87ef1031c3f649436df02fbcdbcc3c6.tar.gz
gcc-dbc42c44d87ef1031c3f649436df02fbcdbcc3c6.tar.bz2
target.h (struct gcc_target): Add hard_regno_scratch_ok field.
* target.h (struct gcc_target): Add hard_regno_scratch_ok field. * target-def.h (TARGET_HARD_REGNO_SCRATCH_OK): New. (TARGET_INITIALIZER): Use TARGET_HARD_REGNO_SCRATCH_OK. * targhooks.c (default_hard_regno_scratch_ok): New function. * targhooks.h (default_hard_regno_scratch_ok): Declare function. * doc/tm.texi: Document TARGET_HARD_REGNO_SCRATCH_OK hook. * recog.c: Include "target.h". (peep2_find_free_register): Add check for global regs. Add target specific check. * Makefile.in (recog.o): Depend on target.h. From-SVN: r137657
Diffstat (limited to 'gcc/recog.c')
-rw-r--r--gcc/recog.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/recog.c b/gcc/recog.c
index 3ddfd86..73d5764 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "output.h"
#include "reload.h"
+#include "target.h"
#include "timevar.h"
#include "tree-pass.h"
#include "df.h"
@@ -2898,6 +2899,9 @@ peep2_find_free_register (int from, int to, const char *class_str,
/* Don't allocate fixed registers. */
if (fixed_regs[regno])
continue;
+ /* Don't allocate global registers. */
+ if (global_regs[regno])
+ continue;
/* Make sure the register is of the right class. */
if (! TEST_HARD_REG_BIT (reg_class_contents[cl], regno))
continue;
@@ -2907,6 +2911,9 @@ peep2_find_free_register (int from, int to, const char *class_str,
/* And that we don't create an extra save/restore. */
if (! call_used_regs[regno] && ! df_regs_ever_live_p (regno))
continue;
+ if (! targetm.hard_regno_scratch_ok (regno))
+ continue;
+
/* And we don't clobber traceback for noreturn functions. */
if ((regno == FRAME_POINTER_REGNUM || regno == HARD_FRAME_POINTER_REGNUM)
&& (! reload_completed || frame_pointer_needed))