Change the type of memory classification functions to bool
2021-07-12 Uroš Bizjak <ubizjak@gmail.com> gcc/ * recog.c (memory_address_addr_space_p): Change the type to bool. Return true/false instead of 1/0. (offsettable_memref_p): Ditto. (offsettable_nonstrict_memref_p): Ditto. (offsettable_address_addr_space_p): Ditto. Change the type of addressp indirect function to bool. * recog.h (memory_address_addr_space_p): Change the type to bool. (strict_memory_address_addr_space_p): Ditto. (offsettable_memref_p): Ditto. (offsettable_nonstrict_memref_p): Ditto. (offsettable_address_addr_space_p): Ditto. * reload.c (maybe_memory_address_addr_space_p): Ditto. (strict_memory_address_addr_space_p): Change the type to bool. Return true/false instead of 1/0. (maybe_memory_address_addr_space_p): Change the type to bool.
This commit is contained in:
parent
6bebd55e12
commit
fe610051a8
3 changed files with 31 additions and 33 deletions
36
gcc/recog.c
36
gcc/recog.c
|
@ -1776,20 +1776,20 @@ pop_operand (rtx op, machine_mode mode)
|
|||
return XEXP (op, 0) == stack_pointer_rtx;
|
||||
}
|
||||
|
||||
/* Return 1 if ADDR is a valid memory address
|
||||
/* Return true if ADDR is a valid memory address
|
||||
for mode MODE in address space AS. */
|
||||
|
||||
int
|
||||
bool
|
||||
memory_address_addr_space_p (machine_mode mode ATTRIBUTE_UNUSED,
|
||||
rtx addr, addr_space_t as)
|
||||
{
|
||||
#ifdef GO_IF_LEGITIMATE_ADDRESS
|
||||
gcc_assert (ADDR_SPACE_GENERIC_P (as));
|
||||
GO_IF_LEGITIMATE_ADDRESS (mode, addr, win);
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
win:
|
||||
return 1;
|
||||
return true;
|
||||
#else
|
||||
return targetm.addr_space.legitimate_address_p (mode, addr, 0, as);
|
||||
#endif
|
||||
|
@ -2361,18 +2361,16 @@ find_constant_term_loc (rtx *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Return 1 if OP is a memory reference
|
||||
whose address contains no side effects
|
||||
and remains valid after the addition
|
||||
of a positive integer less than the
|
||||
size of the object being referenced.
|
||||
/* Return true if OP is a memory reference whose address contains
|
||||
no side effects and remains valid after the addition of a positive
|
||||
integer less than the size of the object being referenced.
|
||||
|
||||
We assume that the original address is valid and do not check it.
|
||||
|
||||
This uses strict_memory_address_p as a subroutine, so
|
||||
don't use it before reload. */
|
||||
|
||||
int
|
||||
bool
|
||||
offsettable_memref_p (rtx op)
|
||||
{
|
||||
return ((MEM_P (op))
|
||||
|
@ -2383,7 +2381,7 @@ offsettable_memref_p (rtx op)
|
|||
/* Similar, but don't require a strictly valid mem ref:
|
||||
consider pseudo-regs valid as index or base regs. */
|
||||
|
||||
int
|
||||
bool
|
||||
offsettable_nonstrict_memref_p (rtx op)
|
||||
{
|
||||
return ((MEM_P (op))
|
||||
|
@ -2391,7 +2389,7 @@ offsettable_nonstrict_memref_p (rtx op)
|
|||
MEM_ADDR_SPACE (op)));
|
||||
}
|
||||
|
||||
/* Return 1 if Y is a memory address which contains no side effects
|
||||
/* Return true if Y is a memory address which contains no side effects
|
||||
and would remain valid for address space AS after the addition of
|
||||
a positive integer less than the size of that mode.
|
||||
|
||||
|
@ -2401,7 +2399,7 @@ offsettable_nonstrict_memref_p (rtx op)
|
|||
If STRICTP is nonzero, we require a strictly valid address,
|
||||
for the sake of use in reload.c. */
|
||||
|
||||
int
|
||||
bool
|
||||
offsettable_address_addr_space_p (int strictp, machine_mode mode, rtx y,
|
||||
addr_space_t as)
|
||||
{
|
||||
|
@ -2409,19 +2407,19 @@ offsettable_address_addr_space_p (int strictp, machine_mode mode, rtx y,
|
|||
rtx z;
|
||||
rtx y1 = y;
|
||||
rtx *y2;
|
||||
int (*addressp) (machine_mode, rtx, addr_space_t) =
|
||||
bool (*addressp) (machine_mode, rtx, addr_space_t) =
|
||||
(strictp ? strict_memory_address_addr_space_p
|
||||
: memory_address_addr_space_p);
|
||||
poly_int64 mode_sz = GET_MODE_SIZE (mode);
|
||||
|
||||
if (CONSTANT_ADDRESS_P (y))
|
||||
return 1;
|
||||
return true;
|
||||
|
||||
/* Adjusting an offsettable address involves changing to a narrower mode.
|
||||
Make sure that's OK. */
|
||||
|
||||
if (mode_dependent_address_p (y, as))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
machine_mode address_mode = GET_MODE (y);
|
||||
if (address_mode == VOIDmode)
|
||||
|
@ -2442,7 +2440,7 @@ offsettable_address_addr_space_p (int strictp, machine_mode mode, rtx y,
|
|||
|
||||
if ((ycode == PLUS) && (y2 = find_constant_term_loc (&y1)))
|
||||
{
|
||||
int good;
|
||||
bool good;
|
||||
|
||||
y1 = *y2;
|
||||
*y2 = plus_constant (address_mode, *y2, mode_sz - 1);
|
||||
|
@ -2456,7 +2454,7 @@ offsettable_address_addr_space_p (int strictp, machine_mode mode, rtx y,
|
|||
}
|
||||
|
||||
if (GET_RTX_CLASS (ycode) == RTX_AUTOINC)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
/* The offset added here is chosen as the maximum offset that
|
||||
any instruction could need to add when operating on something
|
||||
|
@ -2486,7 +2484,7 @@ offsettable_address_addr_space_p (int strictp, machine_mode mode, rtx y,
|
|||
return (*addressp) (QImode, z, as);
|
||||
}
|
||||
|
||||
/* Return 1 if ADDR is an address-expression whose effect depends
|
||||
/* Return true if ADDR is an address-expression whose effect depends
|
||||
on the mode of the memory reference it is used in.
|
||||
|
||||
ADDRSPACE is the address space associated with the address.
|
||||
|
|
12
gcc/recog.h
12
gcc/recog.h
|
@ -200,11 +200,11 @@ extern void temporarily_undo_changes (int);
|
|||
extern void redo_changes (int);
|
||||
extern int constrain_operands (int, alternative_mask);
|
||||
extern int constrain_operands_cached (rtx_insn *, int);
|
||||
extern int memory_address_addr_space_p (machine_mode, rtx, addr_space_t);
|
||||
extern bool memory_address_addr_space_p (machine_mode, rtx, addr_space_t);
|
||||
#define memory_address_p(mode,addr) \
|
||||
memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
|
||||
extern int strict_memory_address_addr_space_p (machine_mode, rtx,
|
||||
addr_space_t);
|
||||
extern bool strict_memory_address_addr_space_p (machine_mode, rtx,
|
||||
addr_space_t);
|
||||
#define strict_memory_address_p(mode,addr) \
|
||||
strict_memory_address_addr_space_p ((mode), (addr), ADDR_SPACE_GENERIC)
|
||||
extern int validate_replace_rtx_subexp (rtx, rtx, rtx_insn *, rtx *);
|
||||
|
@ -218,9 +218,9 @@ extern int num_changes_pending (void);
|
|||
extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
|
||||
extern bool valid_insn_p (rtx_insn *);
|
||||
|
||||
extern int offsettable_memref_p (rtx);
|
||||
extern int offsettable_nonstrict_memref_p (rtx);
|
||||
extern int offsettable_address_addr_space_p (int, machine_mode, rtx,
|
||||
extern bool offsettable_memref_p (rtx);
|
||||
extern bool offsettable_nonstrict_memref_p (rtx);
|
||||
extern bool offsettable_address_addr_space_p (int, machine_mode, rtx,
|
||||
addr_space_t);
|
||||
#define offsettable_address_p(strict,mode,addr) \
|
||||
offsettable_address_addr_space_p ((strict), (mode), (addr), \
|
||||
|
|
16
gcc/reload.c
16
gcc/reload.c
|
@ -262,8 +262,8 @@ static bool alternative_allows_const_pool_ref (rtx, const char *, int);
|
|||
static rtx find_reloads_toplev (rtx, int, enum reload_type, int, int,
|
||||
rtx_insn *, int *);
|
||||
static rtx make_memloc (rtx, int);
|
||||
static int maybe_memory_address_addr_space_p (machine_mode, rtx,
|
||||
addr_space_t, rtx *);
|
||||
static bool maybe_memory_address_addr_space_p (machine_mode, rtx,
|
||||
addr_space_t, rtx *);
|
||||
static int find_reloads_address (machine_mode, rtx *, rtx, rtx *,
|
||||
int, enum reload_type, int, rtx_insn *);
|
||||
static rtx subst_reg_equivs (rtx, rtx_insn *);
|
||||
|
@ -2156,21 +2156,21 @@ hard_reg_set_here_p (unsigned int beg_regno, unsigned int end_regno, rtx x)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Return 1 if ADDR is a valid memory address for mode MODE
|
||||
/* Return true if ADDR is a valid memory address for mode MODE
|
||||
in address space AS, and check that each pseudo reg has the
|
||||
proper kind of hard reg. */
|
||||
|
||||
int
|
||||
bool
|
||||
strict_memory_address_addr_space_p (machine_mode mode ATTRIBUTE_UNUSED,
|
||||
rtx addr, addr_space_t as)
|
||||
{
|
||||
#ifdef GO_IF_LEGITIMATE_ADDRESS
|
||||
gcc_assert (ADDR_SPACE_GENERIC_P (as));
|
||||
GO_IF_LEGITIMATE_ADDRESS (mode, addr, win);
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
win:
|
||||
return 1;
|
||||
return true;
|
||||
#else
|
||||
return targetm.addr_space.legitimate_address_p (mode, addr, 1, as);
|
||||
#endif
|
||||
|
@ -4829,11 +4829,11 @@ make_memloc (rtx ad, int regno)
|
|||
to mode MODE in address space AS by reloading the part pointed to
|
||||
by PART into a register. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
maybe_memory_address_addr_space_p (machine_mode mode, rtx ad,
|
||||
addr_space_t as, rtx *part)
|
||||
{
|
||||
int retv;
|
||||
bool retv;
|
||||
rtx tem = *part;
|
||||
rtx reg = gen_rtx_REG (GET_MODE (tem), max_reg_num ());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue