Commit d89fde46 by Martin Sebor Committed by Martin Sebor

tree.c (zerop): Change return type to bool.


gcc/ChangeLog:

	* tree.c (zerop): Change return type to bool.
	(integer_zerop, integer_onep, integer_each_onep): Same.
	(integer_all_onesp, integer_minus_onep, integer_pow2p): Same.
	(integer_nonzerop, integer_truep, tree_ctz, real_zerop): Same.
	(real_onep, real_minus_onep, chain_index): Same.
	(print_type_hash_statistics, type_list_equal): Same.
	* tree.h (zerop): Same.
	(zerop, integer_zerop, integer_onep, integer_each_onep): Same.
	(integer_all_onesp, integer_minus_onep, integer_pow2p): Same.
	(integer_nonzerop, integer_truep, tree_ctz, real_zerop): Same.
	(real_onep, real_minus_onep, chain_index): Same.
	(print_type_hash_statistics, type_list_equal): Same.

From-SVN: r264653
parent 1fb157cc
2018-09-26 Martin Sebor <msebor@redhat.com>
* tree.c (zerop): Change return type to bool.
(integer_zerop, integer_onep, integer_each_onep): Same.
(integer_all_onesp, integer_minus_onep, integer_pow2p): Same.
(integer_nonzerop, integer_truep, tree_ctz, real_zerop): Same.
(real_onep, real_minus_onep, chain_index): Same.
(print_type_hash_statistics, type_list_equal): Same.
* tree.h (zerop): Same.
(zerop, integer_zerop, integer_onep, integer_each_onep): Same.
(integer_all_onesp, integer_minus_onep, integer_pow2p): Same.
(integer_nonzerop, integer_truep, tree_ctz, real_zerop): Same.
(real_onep, real_minus_onep, chain_index): Same.
(print_type_hash_statistics, type_list_equal): Same.
2018-09-26 Jim Wilson <jimw@sifive.com> 2018-09-26 Jim Wilson <jimw@sifive.com>
* config/riscv/riscv.h (FUNCTION_ARG_REGNO_P): Fix comment. * config/riscv/riscv.h (FUNCTION_ARG_REGNO_P): Fix comment.
......
...@@ -2475,7 +2475,7 @@ grow_tree_vec (tree v, int len MEM_STAT_DECL) ...@@ -2475,7 +2475,7 @@ grow_tree_vec (tree v, int len MEM_STAT_DECL)
/* Return 1 if EXPR is the constant zero, whether it is integral, float or /* Return 1 if EXPR is the constant zero, whether it is integral, float or
fixed, and scalar, complex or vector. */ fixed, and scalar, complex or vector. */
int bool
zerop (const_tree expr) zerop (const_tree expr)
{ {
return (integer_zerop (expr) return (integer_zerop (expr)
...@@ -2486,7 +2486,7 @@ zerop (const_tree expr) ...@@ -2486,7 +2486,7 @@ zerop (const_tree expr)
/* Return 1 if EXPR is the integer constant zero or a complex constant /* Return 1 if EXPR is the integer constant zero or a complex constant
of zero. */ of zero. */
int bool
integer_zerop (const_tree expr) integer_zerop (const_tree expr)
{ {
switch (TREE_CODE (expr)) switch (TREE_CODE (expr))
...@@ -2508,7 +2508,7 @@ integer_zerop (const_tree expr) ...@@ -2508,7 +2508,7 @@ integer_zerop (const_tree expr)
/* Return 1 if EXPR is the integer constant one or the corresponding /* Return 1 if EXPR is the integer constant one or the corresponding
complex constant. */ complex constant. */
int bool
integer_onep (const_tree expr) integer_onep (const_tree expr)
{ {
switch (TREE_CODE (expr)) switch (TREE_CODE (expr))
...@@ -2530,7 +2530,7 @@ integer_onep (const_tree expr) ...@@ -2530,7 +2530,7 @@ integer_onep (const_tree expr)
/* Return 1 if EXPR is the integer constant one. For complex and vector, /* Return 1 if EXPR is the integer constant one. For complex and vector,
return 1 if every piece is the integer constant one. */ return 1 if every piece is the integer constant one. */
int bool
integer_each_onep (const_tree expr) integer_each_onep (const_tree expr)
{ {
if (TREE_CODE (expr) == COMPLEX_CST) if (TREE_CODE (expr) == COMPLEX_CST)
...@@ -2543,13 +2543,13 @@ integer_each_onep (const_tree expr) ...@@ -2543,13 +2543,13 @@ integer_each_onep (const_tree expr)
/* Return 1 if EXPR is an integer containing all 1's in as much precision as /* Return 1 if EXPR is an integer containing all 1's in as much precision as
it contains, or a complex or vector whose subparts are such integers. */ it contains, or a complex or vector whose subparts are such integers. */
int bool
integer_all_onesp (const_tree expr) integer_all_onesp (const_tree expr)
{ {
if (TREE_CODE (expr) == COMPLEX_CST if (TREE_CODE (expr) == COMPLEX_CST
&& integer_all_onesp (TREE_REALPART (expr)) && integer_all_onesp (TREE_REALPART (expr))
&& integer_all_onesp (TREE_IMAGPART (expr))) && integer_all_onesp (TREE_IMAGPART (expr)))
return 1; return true;
else if (TREE_CODE (expr) == VECTOR_CST) else if (TREE_CODE (expr) == VECTOR_CST)
return (VECTOR_CST_NPATTERNS (expr) == 1 return (VECTOR_CST_NPATTERNS (expr) == 1
...@@ -2557,7 +2557,7 @@ integer_all_onesp (const_tree expr) ...@@ -2557,7 +2557,7 @@ integer_all_onesp (const_tree expr)
&& integer_all_onesp (VECTOR_CST_ENCODED_ELT (expr, 0))); && integer_all_onesp (VECTOR_CST_ENCODED_ELT (expr, 0)));
else if (TREE_CODE (expr) != INTEGER_CST) else if (TREE_CODE (expr) != INTEGER_CST)
return 0; return false;
return (wi::max_value (TYPE_PRECISION (TREE_TYPE (expr)), UNSIGNED) return (wi::max_value (TYPE_PRECISION (TREE_TYPE (expr)), UNSIGNED)
== wi::to_wide (expr)); == wi::to_wide (expr));
...@@ -2565,7 +2565,7 @@ integer_all_onesp (const_tree expr) ...@@ -2565,7 +2565,7 @@ integer_all_onesp (const_tree expr)
/* Return 1 if EXPR is the integer constant minus one. */ /* Return 1 if EXPR is the integer constant minus one. */
int bool
integer_minus_onep (const_tree expr) integer_minus_onep (const_tree expr)
{ {
if (TREE_CODE (expr) == COMPLEX_CST) if (TREE_CODE (expr) == COMPLEX_CST)
...@@ -2578,16 +2578,16 @@ integer_minus_onep (const_tree expr) ...@@ -2578,16 +2578,16 @@ integer_minus_onep (const_tree expr)
/* Return 1 if EXPR is an integer constant that is a power of 2 (i.e., has only /* Return 1 if EXPR is an integer constant that is a power of 2 (i.e., has only
one bit on). */ one bit on). */
int bool
integer_pow2p (const_tree expr) integer_pow2p (const_tree expr)
{ {
if (TREE_CODE (expr) == COMPLEX_CST if (TREE_CODE (expr) == COMPLEX_CST
&& integer_pow2p (TREE_REALPART (expr)) && integer_pow2p (TREE_REALPART (expr))
&& integer_zerop (TREE_IMAGPART (expr))) && integer_zerop (TREE_IMAGPART (expr)))
return 1; return true;
if (TREE_CODE (expr) != INTEGER_CST) if (TREE_CODE (expr) != INTEGER_CST)
return 0; return false;
return wi::popcount (wi::to_wide (expr)) == 1; return wi::popcount (wi::to_wide (expr)) == 1;
} }
...@@ -2595,7 +2595,7 @@ integer_pow2p (const_tree expr) ...@@ -2595,7 +2595,7 @@ integer_pow2p (const_tree expr)
/* Return 1 if EXPR is an integer constant other than zero or a /* Return 1 if EXPR is an integer constant other than zero or a
complex constant other than zero. */ complex constant other than zero. */
int bool
integer_nonzerop (const_tree expr) integer_nonzerop (const_tree expr)
{ {
return ((TREE_CODE (expr) == INTEGER_CST return ((TREE_CODE (expr) == INTEGER_CST
...@@ -2609,7 +2609,7 @@ integer_nonzerop (const_tree expr) ...@@ -2609,7 +2609,7 @@ integer_nonzerop (const_tree expr)
return 1 if every piece is the integer constant minus one return 1 if every piece is the integer constant minus one
(representing the value TRUE). */ (representing the value TRUE). */
int bool
integer_truep (const_tree expr) integer_truep (const_tree expr)
{ {
if (TREE_CODE (expr) == VECTOR_CST) if (TREE_CODE (expr) == VECTOR_CST)
...@@ -2619,7 +2619,7 @@ integer_truep (const_tree expr) ...@@ -2619,7 +2619,7 @@ integer_truep (const_tree expr)
/* Return 1 if EXPR is the fixed-point constant zero. */ /* Return 1 if EXPR is the fixed-point constant zero. */
int bool
fixed_zerop (const_tree expr) fixed_zerop (const_tree expr)
{ {
return (TREE_CODE (expr) == FIXED_CST return (TREE_CODE (expr) == FIXED_CST
...@@ -2764,7 +2764,7 @@ tree_ctz (const_tree expr) ...@@ -2764,7 +2764,7 @@ tree_ctz (const_tree expr)
/* Return 1 if EXPR is the real constant zero. Trailing zeroes matter for /* Return 1 if EXPR is the real constant zero. Trailing zeroes matter for
decimal float constants, so don't return 1 for them. */ decimal float constants, so don't return 1 for them. */
int bool
real_zerop (const_tree expr) real_zerop (const_tree expr)
{ {
switch (TREE_CODE (expr)) switch (TREE_CODE (expr))
...@@ -2794,7 +2794,7 @@ real_zerop (const_tree expr) ...@@ -2794,7 +2794,7 @@ real_zerop (const_tree expr)
Trailing zeroes matter for decimal float constants, so don't return Trailing zeroes matter for decimal float constants, so don't return
1 for them. */ 1 for them. */
int bool
real_onep (const_tree expr) real_onep (const_tree expr)
{ {
switch (TREE_CODE (expr)) switch (TREE_CODE (expr))
...@@ -2817,7 +2817,7 @@ real_onep (const_tree expr) ...@@ -2817,7 +2817,7 @@ real_onep (const_tree expr)
/* Return 1 if EXPR is the real constant minus one. Trailing zeroes /* Return 1 if EXPR is the real constant minus one. Trailing zeroes
matter for decimal float constants, so don't return 1 for them. */ matter for decimal float constants, so don't return 1 for them. */
int bool
real_minus_onep (const_tree expr) real_minus_onep (const_tree expr)
{ {
switch (TREE_CODE (expr)) switch (TREE_CODE (expr))
...@@ -2839,7 +2839,7 @@ real_minus_onep (const_tree expr) ...@@ -2839,7 +2839,7 @@ real_minus_onep (const_tree expr)
/* Nonzero if EXP is a constant or a cast of a constant. */ /* Nonzero if EXP is a constant or a cast of a constant. */
int bool
really_constant_p (const_tree exp) really_constant_p (const_tree exp)
{ {
/* This is not quite the same as STRIP_NOPS. It does more. */ /* This is not quite the same as STRIP_NOPS. It does more. */
...@@ -2954,17 +2954,17 @@ chain_index (int idx, tree chain) ...@@ -2954,17 +2954,17 @@ chain_index (int idx, tree chain)
/* Return nonzero if ELEM is part of the chain CHAIN. */ /* Return nonzero if ELEM is part of the chain CHAIN. */
int bool
chain_member (const_tree elem, const_tree chain) chain_member (const_tree elem, const_tree chain)
{ {
while (chain) while (chain)
{ {
if (elem == chain) if (elem == chain)
return 1; return true;
chain = DECL_CHAIN (chain); chain = DECL_CHAIN (chain);
} }
return 0; return false;
} }
/* Return the length of a chain of nodes chained through TREE_CHAIN. /* Return the length of a chain of nodes chained through TREE_CHAIN.
...@@ -6712,7 +6712,7 @@ print_type_hash_statistics (void) ...@@ -6712,7 +6712,7 @@ print_type_hash_statistics (void)
return 1 if the lists contain the same types in the same order. return 1 if the lists contain the same types in the same order.
Also, the TREE_PURPOSEs must match. */ Also, the TREE_PURPOSEs must match. */
int bool
type_list_equal (const_tree l1, const_tree l2) type_list_equal (const_tree l1, const_tree l2)
{ {
const_tree t1, t2; const_tree t1, t2;
...@@ -6723,7 +6723,7 @@ type_list_equal (const_tree l1, const_tree l2) ...@@ -6723,7 +6723,7 @@ type_list_equal (const_tree l1, const_tree l2)
&& ! (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2)) && ! (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))
&& (TREE_TYPE (TREE_PURPOSE (t1)) && (TREE_TYPE (TREE_PURPOSE (t1))
== TREE_TYPE (TREE_PURPOSE (t2)))))) == TREE_TYPE (TREE_PURPOSE (t2))))))
return 0; return false;
return t1 == t2; return t1 == t2;
} }
......
...@@ -4450,45 +4450,45 @@ extern vec<tree, va_gc> *ctor_to_vec (tree); ...@@ -4450,45 +4450,45 @@ extern vec<tree, va_gc> *ctor_to_vec (tree);
/* zerop (tree x) is nonzero if X is a constant of value 0. */ /* zerop (tree x) is nonzero if X is a constant of value 0. */
extern int zerop (const_tree); extern bool zerop (const_tree);
/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */ /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */
extern int integer_zerop (const_tree); extern bool integer_zerop (const_tree);
/* integer_onep (tree x) is nonzero if X is an integer constant of value 1. */ /* integer_onep (tree x) is nonzero if X is an integer constant of value 1. */
extern int integer_onep (const_tree); extern bool integer_onep (const_tree);
/* integer_onep (tree x) is nonzero if X is an integer constant of value 1, or /* integer_onep (tree x) is nonzero if X is an integer constant of value 1, or
a vector or complex where each part is 1. */ a vector or complex where each part is 1. */
extern int integer_each_onep (const_tree); extern bool integer_each_onep (const_tree);
/* integer_all_onesp (tree x) is nonzero if X is an integer constant /* integer_all_onesp (tree x) is nonzero if X is an integer constant
all of whose significant bits are 1. */ all of whose significant bits are 1. */
extern int integer_all_onesp (const_tree); extern bool integer_all_onesp (const_tree);
/* integer_minus_onep (tree x) is nonzero if X is an integer constant of /* integer_minus_onep (tree x) is nonzero if X is an integer constant of
value -1. */ value -1. */
extern int integer_minus_onep (const_tree); extern bool integer_minus_onep (const_tree);
/* integer_pow2p (tree x) is nonzero is X is an integer constant with /* integer_pow2p (tree x) is nonzero is X is an integer constant with
exactly one bit 1. */ exactly one bit 1. */
extern int integer_pow2p (const_tree); extern bool integer_pow2p (const_tree);
/* integer_nonzerop (tree x) is nonzero if X is an integer constant /* integer_nonzerop (tree x) is nonzero if X is an integer constant
with a nonzero value. */ with a nonzero value. */
extern int integer_nonzerop (const_tree); extern bool integer_nonzerop (const_tree);
/* integer_truep (tree x) is nonzero if X is an integer constant of value 1 or /* integer_truep (tree x) is nonzero if X is an integer constant of value 1 or
a vector where each element is an integer constant of value -1. */ a vector where each element is an integer constant of value -1. */
extern int integer_truep (const_tree); extern bool integer_truep (const_tree);
extern bool cst_and_fits_in_hwi (const_tree); extern bool cst_and_fits_in_hwi (const_tree);
extern tree num_ending_zeros (const_tree); extern tree num_ending_zeros (const_tree);
...@@ -4496,7 +4496,7 @@ extern tree num_ending_zeros (const_tree); ...@@ -4496,7 +4496,7 @@ extern tree num_ending_zeros (const_tree);
/* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of /* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of
value 0. */ value 0. */
extern int fixed_zerop (const_tree); extern bool fixed_zerop (const_tree);
/* staticp (tree x) is nonzero if X is a reference to data allocated /* staticp (tree x) is nonzero if X is a reference to data allocated
at a fixed address in memory. Returns the outermost data. */ at a fixed address in memory. Returns the outermost data. */
...@@ -4707,8 +4707,8 @@ extern tree decl_function_context (const_tree); ...@@ -4707,8 +4707,8 @@ extern tree decl_function_context (const_tree);
this _DECL with its context, or zero if none. */ this _DECL with its context, or zero if none. */
extern tree decl_type_context (const_tree); extern tree decl_type_context (const_tree);
/* Return 1 if EXPR is the real constant zero. */ /* Return true if EXPR is the real constant zero. */
extern int real_zerop (const_tree); extern bool real_zerop (const_tree);
/* Initialize the iterator I with arguments from function FNDECL */ /* Initialize the iterator I with arguments from function FNDECL */
...@@ -4889,7 +4889,7 @@ bit_field_offset (const_tree t) ...@@ -4889,7 +4889,7 @@ bit_field_offset (const_tree t)
} }
extern tree strip_float_extensions (tree); extern tree strip_float_extensions (tree);
extern int really_constant_p (const_tree); extern bool really_constant_p (const_tree);
extern bool ptrdiff_tree_p (const_tree, poly_int64_pod *); extern bool ptrdiff_tree_p (const_tree, poly_int64_pod *);
extern bool decl_address_invariant_p (const_tree); extern bool decl_address_invariant_p (const_tree);
extern bool decl_address_ip_invariant_p (const_tree); extern bool decl_address_ip_invariant_p (const_tree);
...@@ -4920,14 +4920,14 @@ static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed) ...@@ -4920,14 +4920,14 @@ static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed)
} }
extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT); extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
extern int type_list_equal (const_tree, const_tree); extern bool type_list_equal (const_tree, const_tree);
extern int chain_member (const_tree, const_tree); extern bool chain_member (const_tree, const_tree);
extern void dump_tree_statistics (void); extern void dump_tree_statistics (void);
extern void recompute_tree_invariant_for_addr_expr (tree); extern void recompute_tree_invariant_for_addr_expr (tree);
extern bool needs_to_live_in_memory (const_tree); extern bool needs_to_live_in_memory (const_tree);
extern tree reconstruct_complex_type (tree, tree); extern tree reconstruct_complex_type (tree, tree);
extern int real_onep (const_tree); extern bool real_onep (const_tree);
extern int real_minus_onep (const_tree); extern bool real_minus_onep (const_tree);
extern void init_ttree (void); extern void init_ttree (void);
extern void build_common_tree_nodes (bool); extern void build_common_tree_nodes (bool);
extern void build_common_builtin_nodes (void); extern void build_common_builtin_nodes (void);
......
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