RTL: Change return type of predicate and callback functions from int to bool
gcc/ChangeLog: * rtl.h (*rtx_equal_p_callback_function): Change return type from int to bool. (rtx_equal_p): Ditto. (*hash_rtx_callback_function): Ditto. * rtl.cc (rtx_equal_p): Change return type from int to bool and adjust function body accordingly. * early-remat.cc (scratch_equal): Ditto. * sel-sched-ir.cc (skip_unspecs_callback): Ditto. (hash_with_unspec_callback): Ditto.
This commit is contained in:
parent
24f75498ea
commit
220af55764
4 changed files with 34 additions and 34 deletions
|
@ -508,16 +508,16 @@ early_remat *early_remat::er;
|
|||
This allows us to compare two copies of a pattern, even though their
|
||||
SCRATCHes are always distinct. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
scratch_equal (const_rtx *x, const_rtx *y, rtx *nx, rtx *ny)
|
||||
{
|
||||
if (GET_CODE (*x) == SCRATCH && GET_CODE (*y) == SCRATCH)
|
||||
{
|
||||
*nx = const0_rtx;
|
||||
*ny = const0_rtx;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Hash callback functions for remat_candidate. */
|
||||
|
|
36
gcc/rtl.cc
36
gcc/rtl.cc
|
@ -412,13 +412,13 @@ int currently_expanding_to_rtl;
|
|||
|
||||
|
||||
|
||||
/* Return 1 if X and Y are identical-looking rtx's.
|
||||
/* Return true if X and Y are identical-looking rtx's.
|
||||
This is the Lisp function EQUAL for rtx arguments.
|
||||
|
||||
Call CB on each pair of rtx if CB is not NULL.
|
||||
When the callback returns true, we continue with the new pair. */
|
||||
|
||||
int
|
||||
bool
|
||||
rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
||||
{
|
||||
int i;
|
||||
|
@ -428,9 +428,9 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
rtx nx, ny;
|
||||
|
||||
if (x == y)
|
||||
return 1;
|
||||
return true;
|
||||
if (x == 0 || y == 0)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* Invoke the callback first. */
|
||||
if (cb != NULL
|
||||
|
@ -440,17 +440,17 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
code = GET_CODE (x);
|
||||
/* Rtx's of different codes cannot be equal. */
|
||||
if (code != GET_CODE (y))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
|
||||
(REG:SI x) and (REG:HI x) are NOT equivalent. */
|
||||
|
||||
if (GET_MODE (x) != GET_MODE (y))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* MEMs referring to different address space are not equivalent. */
|
||||
if (code == MEM && MEM_ADDR_SPACE (x) != MEM_ADDR_SPACE (y))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* Some RTL can be compared nonrecursively. */
|
||||
switch (code)
|
||||
|
@ -468,7 +468,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
case VALUE:
|
||||
case SCRATCH:
|
||||
CASE_CONST_UNIQUE:
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
case CONST_VECTOR:
|
||||
if (!same_vector_encodings_p (x, y))
|
||||
|
@ -500,7 +500,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
{
|
||||
case 'w':
|
||||
if (XWINT (x, i) != XWINT (y, i))
|
||||
return 0;
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
|
@ -513,30 +513,30 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
&& XINT (x, i) == XINT (y, i))
|
||||
break;
|
||||
#endif
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (maybe_ne (SUBREG_BYTE (x), SUBREG_BYTE (y)))
|
||||
return 0;
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
case 'E':
|
||||
/* Two vectors must have the same length. */
|
||||
if (XVECLEN (x, i) != XVECLEN (y, i))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* And the corresponding elements must match. */
|
||||
for (j = 0; j < XVECLEN (x, i); j++)
|
||||
if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j), cb) == 0)
|
||||
return 0;
|
||||
if (!rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j), cb))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
if (rtx_equal_p (XEXP (x, i), XEXP (y, i), cb) == 0)
|
||||
return 0;
|
||||
if (!rtx_equal_p (XEXP (x, i), XEXP (y, i), cb))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
|
@ -544,7 +544,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
if ((XSTR (x, i) || XSTR (y, i))
|
||||
&& (! XSTR (x, i) || ! XSTR (y, i)
|
||||
|| strcmp (XSTR (x, i), XSTR (y, i))))
|
||||
return 0;
|
||||
return false;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
|
@ -562,7 +562,7 @@ rtx_equal_p (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
|
|||
gcc_unreachable ();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Return true if all elements of VEC are equal. */
|
||||
|
|
12
gcc/rtl.h
12
gcc/rtl.h
|
@ -3009,10 +3009,10 @@ extern rtx copy_rtx_if_shared (rtx);
|
|||
extern unsigned int rtx_size (const_rtx);
|
||||
extern rtx shallow_copy_rtx (const_rtx CXX_MEM_STAT_INFO);
|
||||
|
||||
typedef int (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
|
||||
rtx *, rtx *);
|
||||
extern int rtx_equal_p (const_rtx, const_rtx,
|
||||
rtx_equal_p_callback_function = NULL);
|
||||
typedef bool (*rtx_equal_p_callback_function) (const_rtx *, const_rtx *,
|
||||
rtx *, rtx *);
|
||||
extern bool rtx_equal_p (const_rtx, const_rtx,
|
||||
rtx_equal_p_callback_function = NULL);
|
||||
|
||||
extern bool rtvec_all_equal_p (const_rtvec);
|
||||
extern bool rtvec_series_p (rtvec, int);
|
||||
|
@ -4138,8 +4138,8 @@ extern int rtx_to_tree_code (enum rtx_code);
|
|||
extern int delete_trivially_dead_insns (rtx_insn *, int);
|
||||
extern bool exp_equiv_p (const_rtx, const_rtx, int, bool);
|
||||
|
||||
typedef int (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
|
||||
machine_mode *);
|
||||
typedef bool (*hash_rtx_callback_function) (const_rtx, machine_mode, rtx *,
|
||||
machine_mode *);
|
||||
extern unsigned hash_rtx (const_rtx, machine_mode, int *, int *,
|
||||
bool, hash_rtx_callback_function = NULL);
|
||||
|
||||
|
|
|
@ -1079,7 +1079,7 @@ free_nop_pool (void)
|
|||
/* Skip unspec to support ia64 speculation. Called from rtx_equal_p.
|
||||
The callback is given two rtxes XX and YY and writes the new rtxes
|
||||
to NX and NY in case some needs to be skipped. */
|
||||
static int
|
||||
static bool
|
||||
skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
|
||||
{
|
||||
const_rtx x = *xx;
|
||||
|
@ -1091,7 +1091,7 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
|
|||
{
|
||||
*nx = XVECEXP (x, 0, 0);
|
||||
*ny = CONST_CAST_RTX (y);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GET_CODE (y) == UNSPEC
|
||||
|
@ -1100,16 +1100,16 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
|
|||
{
|
||||
*nx = CONST_CAST_RTX (x);
|
||||
*ny = XVECEXP (y, 0, 0);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Callback, called from hash_rtx. Helps to hash UNSPEC rtx X in a correct way
|
||||
to support ia64 speculation. When changes are needed, new rtx X and new mode
|
||||
NMODE are written, and the callback returns true. */
|
||||
static int
|
||||
static bool
|
||||
hash_with_unspec_callback (const_rtx x, machine_mode mode ATTRIBUTE_UNUSED,
|
||||
rtx *nx, machine_mode* nmode)
|
||||
{
|
||||
|
@ -1119,10 +1119,10 @@ hash_with_unspec_callback (const_rtx x, machine_mode mode ATTRIBUTE_UNUSED,
|
|||
{
|
||||
*nx = XVECEXP (x, 0 ,0);
|
||||
*nmode = VOIDmode;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Returns LHS and RHS are ok to be scheduled separately. */
|
||||
|
|
Loading…
Add table
Reference in a new issue