This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: RFC: Jump to const_int
On Sun, Jan 14, 2001 at 01:05:42AM -0800, Richard Henderson wrote:
> Indeed this is a problem. One solution is to modify computed_jump_p
> so that it recognizes this. I'll probably do that.
Like so.
Bootstrapped on alphaev6, not that that means much as this
sort of failure didn't show up there.
r~
* rtlanal.c (computed_jump_p_1): Rename from jmp_uses_reg_or_mem;
update all call sites. Return true for all non-label constants.
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.80
diff -c -p -d -r1.80 rtlanal.c
*** rtlanal.c 2001/01/07 13:06:43 1.80
--- rtlanal.c 2001/01/14 10:16:17
*************** static void set_of_1 PARAMS ((rtx, rtx,
*** 29,35 ****
static void insn_dependent_p_1 PARAMS ((rtx, rtx, void *));
/* Forward declarations */
! static int jmp_uses_reg_or_mem PARAMS ((rtx));
/* Bit flags that specify the machine subtype we are compiling for.
Bits are tested using macros TARGET_... defined in the tm.h file
--- 29,35 ----
static void insn_dependent_p_1 PARAMS ((rtx, rtx, void *));
/* Forward declarations */
! static int computed_jump_p_1 PARAMS ((rtx));
/* Bit flags that specify the machine subtype we are compiling for.
Bits are tested using macros TARGET_... defined in the tm.h file
*************** replace_regs (x, reg_map, nregs, replace
*** 2181,2191 ****
return x;
}
! /* Return 1 if X, the SRC_SRC of SET of (pc) contain a REG or MEM that is
! not in the constant pool and not in the condition of an IF_THEN_ELSE. */
static int
! jmp_uses_reg_or_mem (x)
rtx x;
{
enum rtx_code code = GET_CODE (x);
--- 2181,2192 ----
return x;
}
! /* A subroutine of computed_jump_p, return 1 if X contains a REG or MEM or
! constant that is not in the constant pool and not in the condition
! of an IF_THEN_ELSE. */
static int
! computed_jump_p_1 (x)
rtx x;
{
enum rtx_code code = GET_CODE (x);
*************** jmp_uses_reg_or_mem (x)
*** 2194,2204 ****
switch (code)
{
- case CONST:
case LABEL_REF:
case PC:
return 0;
case REG:
return 1;
--- 2195,2208 ----
switch (code)
{
case LABEL_REF:
case PC:
return 0;
+ case CONST:
+ case CONST_INT:
+ case CONST_DOUBLE:
+ case SYMBOL_REF:
case REG:
return 1;
*************** jmp_uses_reg_or_mem (x)
*** 2207,2218 ****
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
case IF_THEN_ELSE:
! return (jmp_uses_reg_or_mem (XEXP (x, 1))
! || jmp_uses_reg_or_mem (XEXP (x, 2)));
!
! case PLUS: case MINUS: case MULT:
! return (jmp_uses_reg_or_mem (XEXP (x, 0))
! || jmp_uses_reg_or_mem (XEXP (x, 1)));
default:
break;
--- 2211,2218 ----
&& CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)));
case IF_THEN_ELSE:
! return (computed_jump_p_1 (XEXP (x, 1))
! || computed_jump_p_1 (XEXP (x, 2)));
default:
break;
*************** jmp_uses_reg_or_mem (x)
*** 2222,2233 ****
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e'
! && jmp_uses_reg_or_mem (XEXP (x, i)))
return 1;
else if (fmt[i] == 'E')
for (j = 0; j < XVECLEN (x, i); j++)
! if (jmp_uses_reg_or_mem (XVECEXP (x, i, j)))
return 1;
}
--- 2222,2233 ----
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
{
if (fmt[i] == 'e'
! && computed_jump_p_1 (XEXP (x, i)))
return 1;
else if (fmt[i] == 'E')
for (j = 0; j < XVECLEN (x, i); j++)
! if (computed_jump_p_1 (XVECEXP (x, i, j)))
return 1;
}
*************** computed_jump_p (insn)
*** 2265,2276 ****
for (i = len - 1; i >= 0; i--)
if (GET_CODE (XVECEXP (pat, 0, i)) == SET
&& SET_DEST (XVECEXP (pat, 0, i)) == pc_rtx
! && jmp_uses_reg_or_mem (SET_SRC (XVECEXP (pat, 0, i))))
return 1;
}
else if (GET_CODE (pat) == SET
&& SET_DEST (pat) == pc_rtx
! && jmp_uses_reg_or_mem (SET_SRC (pat)))
return 1;
}
return 0;
--- 2265,2276 ----
for (i = len - 1; i >= 0; i--)
if (GET_CODE (XVECEXP (pat, 0, i)) == SET
&& SET_DEST (XVECEXP (pat, 0, i)) == pc_rtx
! && computed_jump_p_1 (SET_SRC (XVECEXP (pat, 0, i))))
return 1;
}
else if (GET_CODE (pat) == SET
&& SET_DEST (pat) == pc_rtx
! && computed_jump_p_1 (SET_SRC (pat)))
return 1;
}
return 0;