alias.c (component_uses_parent_alias_set): Constify.

* alias.c (component_uses_parent_alias_set): Constify.
	* alias.h (component_uses_parent_alias_set): Likewise.
	* cfgrtl.c (print_rtl_with_bb): Likewise.
	* double-int.c (tree_to_double_int, double_int_fits_to_tree_p,
	mpz_get_double_int): Likewise.
	* double-int.h (double_int_fits_to_tree_p, tree_to_double_int,
	mpz_get_double_int): Likewise.
	* expr.c (is_aligning_offset, undefined_operand_subword_p,
	mostly_zeros_p, all_zeros_p, safe_from_p, is_aligning_offset):
	Likewise.
	* expr.h (safe_from_p): Likewise.
	* gimple-low.c (try_catch_may_fallthru, block_may_fallthru):
	Likewise.
	* gimplify.c (should_carry_locus_p, zero_sized_field_decl,
	zero_sized_type, goa_lhs_expr_p): Likewise.
	* omp-low.c (is_variable_sized, use_pointer_for_field): Likewise.
	* rtl.h (print_rtl_with_bb): Likewise.
	* sched-vis.c (print_exp, print_value, print_pattern): Likewise.
	* tree-cfg.c (const_first_stmt, const_last_stmt): New.
	* tree-flow-inline.h (bb_stmt_list): Constify.
	(cbsi_start, cbsi_last, cbsi_end_p, cbsi_next, cbsi_prev,
	cbsi_stmt): New.
	* tree-flow.h (const_block_stmt_iterator, cbsi_start, cbsi_last,
	const_first_stmt, const_last_stmt): New.
	(block_may_fallthru, empty_block_p): Constify.
	* tree-iterator.c (EXPR_FIRST_BODY, EXPR_LAST_BODY,
	EXPR_ONLY_BODY): New.
	(expr_first, expr_last, expr_only): Use macro for body.
	(const_expr_first, const_expr_last, const_expr_only): New.
	* tree-iterator.h (const_tree_stmt_iterator, ctsi_start,
	ctsi_last, ctsi_end_p, ctsi_one_before_end_p, ctsi_next,
	ctsi_prev, ctsi_stmt): New.
	* tree-scalar-evolution.c (get_loop_exit_condition): Constify.
	* tree-scalar-evolution.h (get_loop_exit_condition): Likewise.
	* tree-ssa-loop-niter.c (loop_only_exit_p,
	derive_constant_upper_bound): Likewise.
	* tree-ssa-phiopt.c (empty_block_p): Likewise.
	* tree-ssa-threadupdate.c (redirection_block_p): Likewise.
	* tree-vectorizer.c (slpeel_can_duplicate_loop_p): Likewise.
	* tree-vectorizer.h (slpeel_can_duplicate_loop_p): Likewise.
	* tree-vrp.c (vrp_bitmap_equal_p): Likewise.
	* tree.c (get_type_static_bounds): Likewise.
	* tree.h (const_expr_first, const_expr_last, const_expr_only): New.
	(get_type_static_bounds): Constify.

From-SVN: r127483
This commit is contained in:
Kaveh R. Ghazi 2007-08-14 15:18:11 +00:00 committed by Kaveh Ghazi
parent d39d658dbe
commit 22ea9ec0e8
28 changed files with 308 additions and 102 deletions

View File

@ -1,3 +1,50 @@
2007-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* alias.c (component_uses_parent_alias_set): Constify.
* alias.h (component_uses_parent_alias_set): Likewise.
* cfgrtl.c (print_rtl_with_bb): Likewise.
* double-int.c (tree_to_double_int, double_int_fits_to_tree_p,
mpz_get_double_int): Likewise.
* double-int.h (double_int_fits_to_tree_p, tree_to_double_int,
mpz_get_double_int): Likewise.
* expr.c (is_aligning_offset, undefined_operand_subword_p,
mostly_zeros_p, all_zeros_p, safe_from_p, is_aligning_offset):
Likewise.
* expr.h (safe_from_p): Likewise.
* gimple-low.c (try_catch_may_fallthru, block_may_fallthru):
Likewise.
* gimplify.c (should_carry_locus_p, zero_sized_field_decl,
zero_sized_type, goa_lhs_expr_p): Likewise.
* omp-low.c (is_variable_sized, use_pointer_for_field): Likewise.
* rtl.h (print_rtl_with_bb): Likewise.
* sched-vis.c (print_exp, print_value, print_pattern): Likewise.
* tree-cfg.c (const_first_stmt, const_last_stmt): New.
* tree-flow-inline.h (bb_stmt_list): Constify.
(cbsi_start, cbsi_last, cbsi_end_p, cbsi_next, cbsi_prev,
cbsi_stmt): New.
* tree-flow.h (const_block_stmt_iterator, cbsi_start, cbsi_last,
const_first_stmt, const_last_stmt): New.
(block_may_fallthru, empty_block_p): Constify.
* tree-iterator.c (EXPR_FIRST_BODY, EXPR_LAST_BODY,
EXPR_ONLY_BODY): New.
(expr_first, expr_last, expr_only): Use macro for body.
(const_expr_first, const_expr_last, const_expr_only): New.
* tree-iterator.h (const_tree_stmt_iterator, ctsi_start,
ctsi_last, ctsi_end_p, ctsi_one_before_end_p, ctsi_next,
ctsi_prev, ctsi_stmt): New.
* tree-scalar-evolution.c (get_loop_exit_condition): Constify.
* tree-scalar-evolution.h (get_loop_exit_condition): Likewise.
* tree-ssa-loop-niter.c (loop_only_exit_p,
derive_constant_upper_bound): Likewise.
* tree-ssa-phiopt.c (empty_block_p): Likewise.
* tree-ssa-threadupdate.c (redirection_block_p): Likewise.
* tree-vectorizer.c (slpeel_can_duplicate_loop_p): Likewise.
* tree-vectorizer.h (slpeel_can_duplicate_loop_p): Likewise.
* tree-vrp.c (vrp_bitmap_equal_p): Likewise.
* tree.c (get_type_static_bounds): Likewise.
* tree.h (const_expr_first, const_expr_last, const_expr_only): New.
(get_type_static_bounds): Constify.
2007-08-14 Rask Ingemann Lambertsen <rask@sygehus.dk>
PR target/30315

View File

@ -446,7 +446,7 @@ find_base_decl (tree t)
assignable alias sets. */
bool
component_uses_parent_alias_set (tree t)
component_uses_parent_alias_set (const_tree t)
{
while (1)
{

View File

@ -26,7 +26,7 @@ typedef HOST_WIDE_INT alias_set_type;
extern alias_set_type new_alias_set (void);
extern alias_set_type get_varargs_alias_set (void);
extern alias_set_type get_frame_alias_set (void);
extern bool component_uses_parent_alias_set (tree);
extern bool component_uses_parent_alias_set (const_tree);
extern bool alias_set_subset_of (alias_set_type, alias_set_type);
/* This alias set can be used to force a memory to conflict with all

View File

@ -1526,9 +1526,9 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent)
basic block. */
void
print_rtl_with_bb (FILE *outf, rtx rtx_first)
print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
{
rtx tmp_rtx;
const_rtx tmp_rtx;
if (rtx_first == 0)
fprintf (outf, "(nil)\n");
else

View File

@ -112,7 +112,7 @@ double_int_sext (double_int cst, unsigned prec)
is unsigned. */
double_int
tree_to_double_int (tree cst)
tree_to_double_int (const_tree cst)
{
/* We do not need to call double_int_restrict here to ensure the semantics as
described, as this is the default one for trees. */
@ -304,7 +304,7 @@ double_int_to_tree (tree type, double_int cst)
to be the same as the signedness of TYPE. */
bool
double_int_fits_to_tree_p (tree type, double_int cst)
double_int_fits_to_tree_p (const_tree type, double_int cst)
{
double_int ext = double_int_ext (cst,
TYPE_PRECISION (type),
@ -442,7 +442,7 @@ mpz_set_double_int (mpz_t result, double_int val, bool uns)
appropriate minimum or maximum TYPE bound. */
double_int
mpz_get_double_int (tree type, mpz_t val, bool wrap)
mpz_get_double_int (const_tree type, mpz_t val, bool wrap)
{
unsigned HOST_WIDE_INT *vp;
size_t count, numb;

View File

@ -60,8 +60,8 @@ union tree_node;
/* Constructors and conversions. */
union tree_node *double_int_to_tree (union tree_node *, double_int);
bool double_int_fits_to_tree_p (union tree_node *, double_int);
double_int tree_to_double_int (union tree_node *);
bool double_int_fits_to_tree_p (const union tree_node *, double_int);
double_int tree_to_double_int (const union tree_node *);
/* Constructs double_int from integer CST. The bits over the precision of
HOST_WIDE_INT are filled with the sign bit. */
@ -179,7 +179,7 @@ double_int_equal_p (double_int cst1, double_int cst2)
/* Conversion to and from GMP integer representations. */
void mpz_set_double_int (mpz_t, double_int, bool);
double_int mpz_get_double_int (tree, mpz_t, bool);
double_int mpz_get_double_int (const_tree, mpz_t, bool);
#endif /* DOUBLE_INT_H */

View File

@ -146,7 +146,7 @@ static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode,
static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_tree);
static int is_aligning_offset (tree, tree);
static int is_aligning_offset (const_tree, const_tree);
static void expand_operands (tree, tree, rtx, rtx*, rtx*,
enum expand_modifier);
static rtx reduce_to_bit_field_precision (rtx, rtx, tree);
@ -3141,7 +3141,7 @@ emit_move_ccmode (enum machine_mode mode, rtx x, rtx y)
undefined bits of a paradoxical subreg. */
static bool
undefined_operand_subword_p (rtx op, int i)
undefined_operand_subword_p (const_rtx op, int i)
{
enum machine_mode innermode, innermostmode;
int offset;
@ -4908,7 +4908,7 @@ count_type_elements (const_tree type, bool allow_flexarr)
/* Return 1 if EXP contains mostly (3/4) zeros. */
static int
mostly_zeros_p (tree exp)
mostly_zeros_p (const_tree exp)
{
if (TREE_CODE (exp) == CONSTRUCTOR)
@ -4931,7 +4931,7 @@ mostly_zeros_p (tree exp)
/* Return 1 if EXP contains all zeros. */
static int
all_zeros_p (tree exp)
all_zeros_p (const_tree exp)
{
if (TREE_CODE (exp) == CONSTRUCTOR)
@ -6243,7 +6243,7 @@ force_operand (rtx value, rtx target)
searches for optimization opportunities. */
int
safe_from_p (rtx x, tree exp, int top_p)
safe_from_p (const_rtx x, tree exp, int top_p)
{
rtx exp_rtl = 0;
int i, nops;
@ -9215,7 +9215,7 @@ reduce_to_bit_field_precision (rtx exp, rtx target, tree type)
aligned more than BIGGEST_ALIGNMENT. */
static int
is_aligning_offset (tree offset, tree exp)
is_aligning_offset (const_tree offset, const_tree exp)
{
/* Strip off any conversions. */
while (TREE_CODE (offset) == NON_LVALUE_EXPR

View File

@ -740,7 +740,7 @@ extern rtx expand_mult (enum machine_mode, rtx, rtx, rtx, int);
extern rtx expand_mult_highpart_adjust (enum machine_mode, rtx, rtx, rtx, rtx, int);
extern rtx assemble_static_space (unsigned HOST_WIDE_INT);
extern int safe_from_p (rtx, tree, int);
extern int safe_from_p (const_rtx, tree, int);
/* Call this once to initialize the contents of the optabs
appropriately for the current target machine. */

View File

@ -344,7 +344,7 @@ lower_bind_expr (tree_stmt_iterator *tsi, struct lower_data *data)
This is a subroutine of block_may_fallthru. */
static bool
try_catch_may_fallthru (tree stmt)
try_catch_may_fallthru (const_tree stmt)
{
tree_stmt_iterator i;
@ -394,9 +394,9 @@ try_catch_may_fallthru (tree stmt)
If we're wrong, we'll just delete the extra code later. */
bool
block_may_fallthru (tree block)
block_may_fallthru (const_tree block)
{
tree stmt = expr_last (block);
const_tree stmt = const_expr_last (block);
switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
{

View File

@ -761,7 +761,7 @@ gimple_add_tmp_var (tree tmp)
/* Determines whether to assign a locus to the statement STMT. */
static bool
should_carry_locus_p (tree stmt)
should_carry_locus_p (const_tree stmt)
{
/* Don't emit a line note for a label. We particularly don't want to
emit one for the break label, since it doesn't actually correspond
@ -2891,7 +2891,7 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
/* Return true if FDECL is accessing a field that is zero sized. */
static bool
zero_sized_field_decl (tree fdecl)
zero_sized_field_decl (const_tree fdecl)
{
if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl)
&& integer_zerop (DECL_SIZE (fdecl)))
@ -2902,7 +2902,7 @@ zero_sized_field_decl (tree fdecl)
/* Return true if TYPE is zero sized. */
static bool
zero_sized_type (tree type)
zero_sized_type (const_tree type)
{
if (AGGREGATE_TYPE_P (type) && TYPE_SIZE (type)
&& integer_zerop (TYPE_SIZE (type)))
@ -5181,7 +5181,7 @@ gimplify_omp_workshare (tree *expr_p, tree *pre_p)
EXPR is this stabilized form. */
static bool
goa_lhs_expr_p (tree expr, tree addr)
goa_lhs_expr_p (const_tree expr, const_tree addr)
{
/* Also include casts to other type variants. The C front end is fond
of adding these for e.g. volatile variables. This is like

View File

@ -428,7 +428,7 @@ determine_parallel_type (struct omp_region *region)
/* Return true if EXPR is variable sized. */
static inline bool
is_variable_sized (tree expr)
is_variable_sized (const_tree expr)
{
return !TREE_CONSTANT (TYPE_SIZE_UNIT (TREE_TYPE (expr)));
}
@ -481,7 +481,7 @@ maybe_lookup_field (tree var, omp_context *ctx)
if DECL is to be shared. */
static bool
use_pointer_for_field (tree decl, bool shared_p)
use_pointer_for_field (const_tree decl, bool shared_p)
{
if (AGGREGATE_TYPE_P (TREE_TYPE (decl)))
return true;

View File

@ -2130,7 +2130,7 @@ extern rtx move_by_pieces (rtx, rtx, unsigned HOST_WIDE_INT,
unsigned int, int);
/* In cfgrtl.c */
extern void print_rtl_with_bb (FILE *, rtx);
extern void print_rtl_with_bb (FILE *, const_rtx);
/* In cfg.c. */
extern void dump_reg_info (FILE *);

View File

@ -33,9 +33,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
static char *safe_concat (char *, char *, const char *);
static void print_exp (char *, rtx, int);
static void print_value (char *, rtx, int);
static void print_pattern (char *, rtx, int);
static void print_exp (char *, const_rtx, int);
static void print_value (char *, const_rtx, int);
static void print_pattern (char *, const_rtx, int);
#define BUF_LEN 2048
@ -63,7 +63,7 @@ safe_concat (char *buf, char *cur, const char *str)
may be stored in objects representing values. */
static void
print_exp (char *buf, rtx x, int verbose)
print_exp (char *buf, const_rtx x, int verbose)
{
char tmp[BUF_LEN];
const char *st[4];
@ -426,7 +426,7 @@ print_exp (char *buf, rtx x, int verbose)
registers, labels, symbols and memory accesses. */
static void
print_value (char *buf, rtx x, int verbose)
print_value (char *buf, const_rtx x, int verbose)
{
char t[BUF_LEN];
char *cur = buf;
@ -528,7 +528,7 @@ print_value (char *buf, rtx x, int verbose)
/* The next step in insn detalization, its pattern recognition. */
static void
print_pattern (char *buf, rtx x, int verbose)
print_pattern (char *buf, const_rtx x, int verbose)
{
char t1[BUF_LEN], t2[BUF_LEN], t3[BUF_LEN];

View File

@ -2592,6 +2592,12 @@ first_stmt (basic_block bb)
return !bsi_end_p (i) ? bsi_stmt (i) : NULL_TREE;
}
const_tree
const_first_stmt (const_basic_block bb)
{
const_block_stmt_iterator i = cbsi_start (bb);
return !cbsi_end_p (i) ? cbsi_stmt (i) : NULL_TREE;
}
/* Return the last statement in basic block BB. */
@ -2602,6 +2608,12 @@ last_stmt (basic_block bb)
return !bsi_end_p (b) ? bsi_stmt (b) : NULL_TREE;
}
const_tree
const_last_stmt (const_basic_block bb)
{
const_block_stmt_iterator b = cbsi_last (bb);
return !cbsi_end_p (b) ? cbsi_stmt (b) : NULL_TREE;
}
/* Return the last statement of an otherwise empty block. Return NULL
if the block is totally empty, or if it contains more than one

View File

@ -713,7 +713,7 @@ phi_ssa_name_p (const_tree t)
/* Returns the list of statements in BB. */
static inline tree
bb_stmt_list (basic_block bb)
bb_stmt_list (const_basic_block bb)
{
gcc_assert (!(bb->flags & BB_RTL));
return bb->il.tree->stmt_list;
@ -745,6 +745,21 @@ bsi_start (basic_block bb)
return bsi;
}
static inline const_block_stmt_iterator
cbsi_start (const_basic_block bb)
{
const_block_stmt_iterator bsi;
if (bb->index < NUM_FIXED_BLOCKS)
{
bsi.tsi.ptr = NULL;
bsi.tsi.container = NULL;
}
else
bsi.tsi = ctsi_start (bb_stmt_list (bb));
bsi.bb = bb;
return bsi;
}
/* Return a block statement iterator that points to the first non-label
statement in block BB. */
@ -777,6 +792,22 @@ bsi_last (basic_block bb)
return bsi;
}
static inline const_block_stmt_iterator
cbsi_last (const_basic_block bb)
{
const_block_stmt_iterator bsi;
if (bb->index < NUM_FIXED_BLOCKS)
{
bsi.tsi.ptr = NULL;
bsi.tsi.container = NULL;
}
else
bsi.tsi = ctsi_last (bb_stmt_list (bb));
bsi.bb = bb;
return bsi;
}
/* Return true if block statement iterator I has reached the end of
the basic block. */
static inline bool
@ -785,6 +816,12 @@ bsi_end_p (block_stmt_iterator i)
return tsi_end_p (i.tsi);
}
static inline bool
cbsi_end_p (const_block_stmt_iterator i)
{
return ctsi_end_p (i.tsi);
}
/* Modify block statement iterator I so that it is at the next
statement in the basic block. */
static inline void
@ -793,6 +830,12 @@ bsi_next (block_stmt_iterator *i)
tsi_next (&i->tsi);
}
static inline void
cbsi_next (const_block_stmt_iterator *i)
{
ctsi_next (&i->tsi);
}
/* Modify block statement iterator I so that it is at the previous
statement in the basic block. */
static inline void
@ -801,6 +844,12 @@ bsi_prev (block_stmt_iterator *i)
tsi_prev (&i->tsi);
}
static inline void
cbsi_prev (const_block_stmt_iterator *i)
{
ctsi_prev (&i->tsi);
}
/* Return the statement that block statement iterator I is currently
at. */
static inline tree
@ -809,6 +858,12 @@ bsi_stmt (block_stmt_iterator i)
return tsi_stmt (i.tsi);
}
static inline const_tree
cbsi_stmt (const_block_stmt_iterator i)
{
return ctsi_stmt (i.tsi);
}
/* Return a pointer to the statement that block statement iterator I
is currently at. */
static inline tree *

View File

@ -628,8 +628,15 @@ typedef struct {
basic_block bb;
} block_stmt_iterator;
typedef struct {
const_tree_stmt_iterator tsi;
const_basic_block bb;
} const_block_stmt_iterator;
static inline block_stmt_iterator bsi_start (basic_block);
static inline const_block_stmt_iterator cbsi_start (const_basic_block);
static inline block_stmt_iterator bsi_last (basic_block);
static inline const_block_stmt_iterator cbsi_last (const_basic_block);
static inline block_stmt_iterator bsi_after_labels (basic_block);
block_stmt_iterator bsi_for_stmt (tree);
static inline bool bsi_end_p (block_stmt_iterator);
@ -737,7 +744,9 @@ extern void print_loop_ir (FILE *);
extern void cleanup_dead_labels (void);
extern void group_case_labels (void);
extern tree first_stmt (basic_block);
extern const_tree const_first_stmt (const_basic_block);
extern tree last_stmt (basic_block);
extern const_tree const_last_stmt (const_basic_block);
extern tree last_and_only_stmt (basic_block);
extern edge find_taken_edge (basic_block, tree);
extern basic_block label_to_block_fn (struct function *, tree);
@ -819,7 +828,7 @@ extern tree phi_reverse (tree);
/* In gimple-low.c */
extern void record_vars_into (tree, tree);
extern void record_vars (tree);
extern bool block_may_fallthru (tree);
extern bool block_may_fallthru (const_tree);
/* In tree-ssa-alias.c */
extern void dump_may_aliases_for (FILE *, tree);
@ -959,7 +968,7 @@ extern bool vect_can_force_dr_alignment_p (tree, unsigned int);
extern tree get_vectype_for_scalar_type (tree);
/* In tree-ssa-phiopt.c */
bool empty_block_p (basic_block);
bool empty_block_p (const_basic_block);
basic_block *blocks_in_phiopt_order (void);
/* In tree-ssa-loop*.c */

View File

@ -299,66 +299,89 @@ tsi_split_statement_list_before (tree_stmt_iterator *i)
/* Return the first expression in a sequence of COMPOUND_EXPRs,
or in a STATEMENT_LIST. */
#define EXPR_FIRST_BODY do { \
if (expr == NULL_TREE) \
return expr; \
if (TREE_CODE (expr) == STATEMENT_LIST) \
{ \
struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr); \
return n ? n->stmt : NULL_TREE; \
} \
while (TREE_CODE (expr) == COMPOUND_EXPR) \
expr = TREE_OPERAND (expr, 0); \
return expr; \
} while (0)
tree
expr_first (tree expr)
{
if (expr == NULL_TREE)
return expr;
EXPR_FIRST_BODY;
}
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (expr);
return n ? n->stmt : NULL_TREE;
}
while (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 0);
return expr;
const_tree
const_expr_first (const_tree expr)
{
EXPR_FIRST_BODY;
}
/* Return the last expression in a sequence of COMPOUND_EXPRs,
or in a STATEMENT_LIST. */
#define EXPR_LAST_BODY do { \
if (expr == NULL_TREE) \
return expr;\
if (TREE_CODE (expr) == STATEMENT_LIST) \
{ \
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
return n ? n->stmt : NULL_TREE; \
} \
while (TREE_CODE (expr) == COMPOUND_EXPR) \
expr = TREE_OPERAND (expr, 1); \
return expr; \
} while (0)
tree
expr_last (tree expr)
{
if (expr == NULL_TREE)
return expr;
EXPR_LAST_BODY;
}
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
return n ? n->stmt : NULL_TREE;
}
while (TREE_CODE (expr) == COMPOUND_EXPR)
expr = TREE_OPERAND (expr, 1);
return expr;
const_tree
const_expr_last (const_tree expr)
{
EXPR_LAST_BODY;
}
/* If EXPR is a single statement return it. If EXPR is a
STATEMENT_LIST containing exactly one statement S, return S.
Otherwise, return NULL. */
#define EXPR_ONLY_BODY do { \
if (expr == NULL_TREE) \
return NULL_TREE; \
if (TREE_CODE (expr) == STATEMENT_LIST) \
{ \
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr); \
if (n && STATEMENT_LIST_HEAD (expr) == n) \
return n->stmt; \
else \
return NULL_TREE; \
} \
if (TREE_CODE (expr) == COMPOUND_EXPR) \
return NULL_TREE; \
return expr; \
} while (0)
tree
expr_only (tree expr)
{
if (expr == NULL_TREE)
return NULL_TREE;
EXPR_ONLY_BODY;
}
if (TREE_CODE (expr) == STATEMENT_LIST)
{
struct tree_statement_list_node *n = STATEMENT_LIST_TAIL (expr);
if (n && STATEMENT_LIST_HEAD (expr) == n)
return n->stmt;
else
return NULL_TREE;
}
if (TREE_CODE (expr) == COMPOUND_EXPR)
return NULL_TREE;
return expr;
const_tree
const_expr_only (const_tree expr)
{
EXPR_ONLY_BODY;
}
#include "gt-tree-iterator.h"

View File

@ -34,6 +34,11 @@ typedef struct {
tree container;
} tree_stmt_iterator;
typedef struct {
struct tree_statement_list_node *ptr;
const_tree container;
} const_tree_stmt_iterator;
static inline tree_stmt_iterator
tsi_start (tree t)
{
@ -45,6 +50,17 @@ tsi_start (tree t)
return i;
}
static inline const_tree_stmt_iterator
ctsi_start (const_tree t)
{
const_tree_stmt_iterator i;
i.ptr = STATEMENT_LIST_HEAD (t);
i.container = t;
return i;
}
static inline tree_stmt_iterator
tsi_last (tree t)
{
@ -56,30 +72,65 @@ tsi_last (tree t)
return i;
}
static inline const_tree_stmt_iterator
ctsi_last (tree t)
{
const_tree_stmt_iterator i;
i.ptr = STATEMENT_LIST_TAIL (t);
i.container = t;
return i;
}
static inline bool
tsi_end_p (tree_stmt_iterator i)
{
return i.ptr == NULL;
}
static inline bool
ctsi_end_p (const_tree_stmt_iterator i)
{
return i.ptr == NULL;
}
static inline bool
tsi_one_before_end_p (tree_stmt_iterator i)
{
return i.ptr != NULL && i.ptr->next == NULL;
}
static inline bool
ctsi_one_before_end_p (const_tree_stmt_iterator i)
{
return i.ptr != NULL && i.ptr->next == NULL;
}
static inline void
tsi_next (tree_stmt_iterator *i)
{
i->ptr = i->ptr->next;
}
static inline void
ctsi_next (const_tree_stmt_iterator *i)
{
i->ptr = i->ptr->next;
}
static inline void
tsi_prev (tree_stmt_iterator *i)
{
i->ptr = i->ptr->prev;
}
static inline void
ctsi_prev (const_tree_stmt_iterator *i)
{
i->ptr = i->ptr->prev;
}
static inline tree *
tsi_stmt_ptr (tree_stmt_iterator i)
{
@ -92,6 +143,12 @@ tsi_stmt (tree_stmt_iterator i)
return i.ptr->stmt;
}
static inline const_tree
ctsi_stmt (const_tree_stmt_iterator i)
{
return i.ptr->stmt;
}
enum tsi_iterator_update
{
TSI_NEW_STMT, /* Only valid when single statement is added, move

View File

@ -932,7 +932,7 @@ analyzable_condition (const_tree expr)
analyze, then give up. */
tree
get_loop_exit_condition (struct loop *loop)
get_loop_exit_condition (const struct loop *loop)
{
tree res = NULL_TREE;
edge exit_edge = single_exit (loop);

View File

@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
extern tree number_of_latch_executions (struct loop *);
extern tree number_of_exit_cond_executions (struct loop *);
extern tree get_loop_exit_condition (struct loop *);
extern tree get_loop_exit_condition (const struct loop *);
extern void scev_initialize (void);
extern void scev_reset (void);

View File

@ -1673,7 +1673,7 @@ simplify_using_outer_evolutions (struct loop *loop, tree expr)
/* Returns true if EXIT is the only possible exit from LOOP. */
static bool
loop_only_exit_p (struct loop *loop, edge exit)
loop_only_exit_p (const struct loop *loop, const_edge exit)
{
basic_block *body;
block_stmt_iterator bsi;
@ -2171,7 +2171,7 @@ find_loop_niter_by_eval (struct loop *loop, edge *exit)
be nonnegative. */
static double_int
derive_constant_upper_bound (tree val)
derive_constant_upper_bound (const_tree val)
{
tree type = TREE_TYPE (val);
tree op0, op1, subtype, maxt;

View File

@ -297,18 +297,18 @@ blocks_in_phiopt_order (void)
/* Return TRUE if block BB has no executable statements, otherwise return
FALSE. */
bool
empty_block_p (basic_block bb)
empty_block_p (const_basic_block bb)
{
block_stmt_iterator bsi;
const_block_stmt_iterator bsi;
/* BB must have no executable statements. */
bsi = bsi_start (bb);
while (!bsi_end_p (bsi)
&& (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
|| IS_EMPTY_STMT (bsi_stmt (bsi))))
bsi_next (&bsi);
bsi = cbsi_start (bb);
while (!cbsi_end_p (bsi)
&& (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
|| IS_EMPTY_STMT (cbsi_stmt (bsi))))
cbsi_next (&bsi);
if (!bsi_end_p (bsi))
if (!cbsi_end_p (bsi))
return false;
return true;

View File

@ -461,26 +461,26 @@ redirect_edges (void **slot, void *data)
is one, this is equivalent to a "forwarder" block. */
static bool
redirection_block_p (basic_block bb)
redirection_block_p (const_basic_block bb)
{
block_stmt_iterator bsi;
const_block_stmt_iterator bsi;
/* Advance to the first executable statement. */
bsi = bsi_start (bb);
while (!bsi_end_p (bsi)
&& (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR
|| IS_EMPTY_STMT (bsi_stmt (bsi))))
bsi_next (&bsi);
bsi = cbsi_start (bb);
while (!cbsi_end_p (bsi)
&& (TREE_CODE (cbsi_stmt (bsi)) == LABEL_EXPR
|| IS_EMPTY_STMT (cbsi_stmt (bsi))))
cbsi_next (&bsi);
/* Check if this is an empty block. */
if (bsi_end_p (bsi))
if (cbsi_end_p (bsi))
return true;
/* Test that we've reached the terminating control statement. */
return bsi_stmt (bsi)
&& (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR
|| TREE_CODE (bsi_stmt (bsi)) == GOTO_EXPR
|| TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR);
return cbsi_stmt (bsi)
&& (TREE_CODE (cbsi_stmt (bsi)) == COND_EXPR
|| TREE_CODE (cbsi_stmt (bsi)) == GOTO_EXPR
|| TREE_CODE (cbsi_stmt (bsi)) == SWITCH_EXPR);
}
/* BB is a block which ends with a COND_EXPR or SWITCH_EXPR and when BB

View File

@ -948,7 +948,7 @@ slpeel_add_loop_guard (basic_block guard_bb, tree cond, basic_block exit_bb,
*/
bool
slpeel_can_duplicate_loop_p (struct loop *loop, edge e)
slpeel_can_duplicate_loop_p (const struct loop *loop, const_edge e)
{
edge exit_e = single_exit (loop);
edge entry_e = loop_preheader_edge (loop);

View File

@ -448,7 +448,7 @@ extern bitmap vect_memsyms_to_rename;
extern struct loop *slpeel_tree_peel_loop_to_edge
(struct loop *, edge, tree, tree, bool, unsigned int);
extern void slpeel_make_loop_iterate_ntimes (struct loop *, tree);
extern bool slpeel_can_duplicate_loop_p (struct loop *, edge);
extern bool slpeel_can_duplicate_loop_p (const struct loop *, const_edge);
#ifdef ENABLE_CHECKING
extern void slpeel_verify_cfg_after_peeling (struct loop *, struct loop *);
#endif

View File

@ -518,7 +518,7 @@ vrp_operand_equal_p (tree val1, tree val2)
/* Return true, if the bitmaps B1 and B2 are equal. */
static inline bool
vrp_bitmap_equal_p (bitmap b1, bitmap b2)
vrp_bitmap_equal_p (const_bitmap b1, const_bitmap b2)
{
return (b1 == b2
|| (b1 && b2

View File

@ -6319,7 +6319,7 @@ int_fits_type_p (const_tree c, const_tree type)
precision of the type are returned instead. */
void
get_type_static_bounds (tree type, mpz_t min, mpz_t max)
get_type_static_bounds (const_tree type, mpz_t min, mpz_t max)
{
if (!POINTER_TYPE_P (type) && TYPE_MIN_VALUE (type)
&& TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST)

View File

@ -4297,8 +4297,11 @@ extern tree non_lvalue (tree);
extern tree convert (tree, tree);
extern unsigned int expr_align (const_tree);
extern tree expr_first (tree);
extern const_tree const_expr_first (const_tree);
extern tree expr_last (tree);
extern const_tree const_expr_last (const_tree);
extern tree expr_only (tree);
extern const_tree const_expr_only (const_tree);
extern tree size_in_bytes (tree);
extern HOST_WIDE_INT int_size_in_bytes (const_tree);
extern HOST_WIDE_INT max_int_size_in_bytes (tree);
@ -4789,7 +4792,7 @@ extern int objects_must_conflict_p (tree, tree);
/* In tree.c */
extern int really_constant_p (const_tree);
extern int int_fits_type_p (const_tree, const_tree);
extern void get_type_static_bounds (tree, mpz_t, mpz_t);
extern void get_type_static_bounds (const_tree, mpz_t, mpz_t);
extern bool variably_modified_type_p (tree, tree);
extern int tree_log2 (const_tree);
extern int tree_floor_log2 (const_tree);