Commit e7bcc691 by Jim MacArthur Committed by Marcus Shawcroft

recog.c (reg_fits_class_p): Check both regno and regno + offset are hard registers.

2012-05-24  Jim MacArthur<jim.macarthur@arm.com>

	* recog.c (reg_fits_class_p): Check both regno and regno + offset are
	hard registers.
	* regs.h (in_hard_reg_set_p): Assert that regno is a hard register and
	check end_regno - 1 is a hard register.

From-SVN: r187826
parent b44be1e6
2012-05-24 Jim MacArthur<jim.macarthur@arm.com>
* recog.c (reg_fits_class_p): Check both regno and regno + offset are
hard registers.
* regs.h (in_hard_reg_set_p): Assert that regno is a hard register and
check end_regno - 1 is a hard register.
2012-05-24 Richard Guenther <rguenther@suse.de> 2012-05-24 Richard Guenther <rguenther@suse.de>
* varpool.c (add_new_static_var): Remove call to create_var_ann. * varpool.c (add_new_static_var): Remove call to create_var_ann.
......
...@@ -2792,14 +2792,16 @@ bool ...@@ -2792,14 +2792,16 @@ bool
reg_fits_class_p (const_rtx operand, reg_class_t cl, int offset, reg_fits_class_p (const_rtx operand, reg_class_t cl, int offset,
enum machine_mode mode) enum machine_mode mode)
{ {
int regno = REGNO (operand); unsigned int regno = REGNO (operand);
if (cl == NO_REGS) if (cl == NO_REGS)
return false; return false;
/* Regno must not be a pseudo register. Offset may be negative. */
return (HARD_REGISTER_NUM_P (regno) return (HARD_REGISTER_NUM_P (regno)
&& in_hard_reg_set_p (reg_class_contents[(int) cl], && HARD_REGISTER_NUM_P (regno + offset)
mode, regno + offset)); && in_hard_reg_set_p (reg_class_contents[(int) cl], mode,
regno + offset));
} }
/* Split single instruction. Helper function for split_all_insns and /* Split single instruction. Helper function for split_all_insns and
......
...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "machmode.h" #include "machmode.h"
#include "hard-reg-set.h" #include "hard-reg-set.h"
#include "rtl.h"
#define REG_BYTES(R) mode_size[(int) GET_MODE (R)] #define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
...@@ -367,10 +368,16 @@ in_hard_reg_set_p (const HARD_REG_SET regs, enum machine_mode mode, ...@@ -367,10 +368,16 @@ in_hard_reg_set_p (const HARD_REG_SET regs, enum machine_mode mode,
{ {
unsigned int end_regno; unsigned int end_regno;
gcc_assert (HARD_REGISTER_NUM_P (regno));
if (!TEST_HARD_REG_BIT (regs, regno)) if (!TEST_HARD_REG_BIT (regs, regno))
return false; return false;
end_regno = end_hard_regno (mode, regno); end_regno = end_hard_regno (mode, regno);
if (!HARD_REGISTER_NUM_P (end_regno - 1))
return false;
while (++regno < end_regno) while (++regno < end_regno)
if (!TEST_HARD_REG_BIT (regs, regno)) if (!TEST_HARD_REG_BIT (regs, regno))
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment