+2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * attribs.c (hash_attr, eq_attr, init_attributes): Constify.
+ * builtins.c (validate_arg, builtin_mathfn_code,
+ validate_arglist): Likewise.
+ * calls.c (call_expr_flags): Likewise.
+ * combine.c (reg_nonzero_bits_for_combine,
+ reg_num_sign_bit_copies_for_combine, get_last_value,
+ reg_truncated_to_mode): Likewise.
+ * emit-rtl.c (subreg_lowpart_p): Likewise.
+ * expr.c (highest_pow2_factor_for_target,
+ categorize_ctor_elements_1, categorize_ctor_elements,
+ count_type_elements, contains_packed_reference,
+ highest_pow2_factor, highest_pow2_factor_for_target): Likewise.
+ * fold-const.c (may_negate_without_overflow_p, int_const_binop,
+ fold_convertible_p, operand_equal_p, tree_swap_operands_p,
+ native_encode_int, native_encode_real, native_encode_complex,
+ native_encode_vector, native_encode_expr, native_interpret_int,
+ native_interpret_real, native_interpret_complex,
+ native_interpret_vector, native_interpret_expr): Likewise.
+ * function.c (use_register_for_decl): Likewise.
+ * gimplify.c (get_name): Likewise.
+ * langhooks-def.h (lhd_return_null_const_tree): New.
+ (LANG_HOOKS_GET_CALLEE_FNDECL): Use it.
+ * langhooks.c (lhd_return_null_const_tree): New.
+ * langhooks.h (lang_get_callee_fndecl): Constify.
+ * output.h (constructor_static_from_elts_p): Likewise.
+ * rtl-factoring.c (gen_symbol_ref_rtx_for_label): Likewise.
+ * rtl.h (nonzero_bits, num_sign_bit_copies, truncated_to_mode,
+ subreg_lowpart_p, noop_move_p, struct rtl_hooks): Likewise.
+ * rtlanal.c (cached_nonzero_bits, nonzero_bits1,
+ cached_num_sign_bit_copies, num_sign_bit_copies1, noop_move_p,
+ nonzero_bits, num_sign_bit_copies, truncated_to_mode): Likewise.
+ * rtlhooks-def.h (reg_nonzero_bits_general,
+ reg_num_sign_bit_copies_general, reg_truncated_to_mode_general):
+ Likewise.
+ * rtlhooks.c (reg_num_sign_bit_copies_general,
+ reg_nonzero_bits_general, reg_truncated_to_mode_general):
+ Likewise.
+ * stmt.c (warn_if_unused_value, is_body_block): Likewise.
+ * stor-layout.c (mode_for_size_tree): Likewise.
+ * tree-ssa-loop-im.c (memref_eq): Likewise.
+ * tree-ssa-loop-ivopts.c (tree_int_cst_sign_bit): Likewise.
+ * tree.c (contains_placeholder_p, type_list_equal,
+ simple_cst_equal, get_callee_fndecl, operand_equal_for_phi_arg_p):
+ Likewise.
+ * tree.h (tree_int_cst_sign_bit, may_negate_without_overflow_p,
+ mode_for_size_tree, categorize_ctor_elements, count_type_elements,
+ contains_placeholder_p, contains_packed_reference,
+ get_callee_fndecl, operand_equal_for_phi_arg_p,
+ warn_if_unused_value, is_body_block, native_encode_expr,
+ native_interpret_expr, fold_convertible_p, operand_equal_p,
+ int_const_binop, tree_swap_operands_p, builtin_mathfn_code,
+ validate_arglist, simple_cst_equal, type_list_equal,
+ use_register_for_decl, call_expr_flags, get_name,
+ highest_pow2_factor): Likewise.
+ (const_call_expr_arg_iterator_d,
+ init_const_call_expr_arg_iterator, next_const_call_expr_arg,
+ first_const_call_expr_arg, more_const_call_expr_args_p,
+ FOR_EACH_CONST_CALL_EXPR_ARG): New.
+ * varasm.c (constructor_static_from_elts_p): Constify.
+
2007-07-28 Kazu Hirata <kazu@codesourcery.com>
* cfglayout.c, config/arm/arm.c, config/arm/cortex-a8.md,
static hashval_t
hash_attr (const void *p)
{
- struct attribute_spec *spec = (struct attribute_spec *) p;
- int l = strlen (spec->name);
+ const struct attribute_spec *const spec = (const struct attribute_spec *) p;
+ const int l = strlen (spec->name);
return substring_hash (spec->name, l);
}
static int
eq_attr (const void *p, const void *q)
{
- const struct attribute_spec *spec = (struct attribute_spec *) p;
- const struct substring *str = (struct substring *) q;
+ const struct attribute_spec *const spec = (const struct attribute_spec *) p;
+ const struct substring *const str = (const struct substring *) q;
return (!strncmp (spec->name, str->str, str->length) && !spec->name[str->length]);
}
for (k = 0; attribute_tables[i][k].name != NULL; k++)
{
struct substring str;
- void **slot;
+ const void **slot;
str.str = attribute_tables[i][k].name;
str.length = strlen (attribute_tables[i][k].name);
- slot = htab_find_slot_with_hash (attribute_hash, &str,
+ slot = (const void **)htab_find_slot_with_hash (attribute_hash, &str,
substring_hash (str.str, str.length),
INSERT);
gcc_assert (!*slot);
- *slot = (void *)&attribute_tables[i][k];
+ *slot = &attribute_tables[i][k];
}
attributes_initialized = true;
}
static tree fold_builtin_inf (tree, int);
static tree fold_builtin_nan (tree, tree, int);
static tree rewrite_call_expr (tree, int, tree, int, ...);
-static bool validate_arg (tree, enum tree_code code);
+static bool validate_arg (const_tree, enum tree_code code);
static bool integer_valued_real_p (tree);
static tree fold_trunc_transparent_mathfn (tree, tree);
static bool readonly_data_expr (tree);
Otherwise the return value is END_BUILTINS. */
enum built_in_function
-builtin_mathfn_code (tree t)
+builtin_mathfn_code (const_tree t)
{
- tree fndecl, arg, parmlist;
- tree argtype, parmtype;
- call_expr_arg_iterator iter;
+ const_tree fndecl, arg, parmlist;
+ const_tree argtype, parmtype;
+ const_call_expr_arg_iterator iter;
if (TREE_CODE (t) != CALL_EXPR
|| TREE_CODE (CALL_EXPR_FN (t)) != ADDR_EXPR)
return END_BUILTINS;
parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
- init_call_expr_arg_iterator (t, &iter);
+ init_const_call_expr_arg_iterator (t, &iter);
for (; parmlist; parmlist = TREE_CHAIN (parmlist))
{
/* If a function doesn't take a variable number of arguments,
parmtype = TREE_VALUE (parmlist);
if (VOID_TYPE_P (parmtype))
{
- if (more_call_expr_args_p (&iter))
+ if (more_const_call_expr_args_p (&iter))
return END_BUILTINS;
return DECL_FUNCTION_CODE (fndecl);
}
- if (! more_call_expr_args_p (&iter))
+ if (! more_const_call_expr_args_p (&iter))
return END_BUILTINS;
- arg = next_call_expr_arg (&iter);
+ arg = next_const_call_expr_arg (&iter);
argtype = TREE_TYPE (arg);
if (SCALAR_FLOAT_TYPE_P (parmtype))
a type. */
static bool
-validate_arg (tree arg, enum tree_code code)
+validate_arg (const_tree arg, enum tree_code code)
{
if (!arg)
return false;
VOID_TYPE. */
bool
-validate_arglist (tree callexpr, ...)
+validate_arglist (const_tree callexpr, ...)
{
enum tree_code code;
bool res = 0;
va_list ap;
- call_expr_arg_iterator iter;
- tree arg;
+ const_call_expr_arg_iterator iter;
+ const_tree arg;
va_start (ap, callexpr);
- init_call_expr_arg_iterator (callexpr, &iter);
+ init_const_call_expr_arg_iterator (callexpr, &iter);
do
{
case VOID_TYPE:
/* This signifies an endlink, if no arguments remain, return
true, otherwise return false. */
- res = !more_call_expr_args_p (&iter);
+ res = !more_const_call_expr_args_p (&iter);
goto end;
default:
/* If no parameters remain or the parameter's code does not
match the specified code, return false. Otherwise continue
checking any remaining arguments. */
- arg = next_call_expr_arg (&iter);
+ arg = next_const_call_expr_arg (&iter);
if (!validate_arg (arg, code))
goto end;
break;
/* Detect flags from a CALL_EXPR. */
int
-call_expr_flags (tree t)
+call_expr_flags (const_tree t)
{
int flags;
tree decl = get_callee_fndecl (t);
static int n_occurrences;
-static rtx reg_nonzero_bits_for_combine (rtx, enum machine_mode, rtx,
+static rtx reg_nonzero_bits_for_combine (const_rtx, enum machine_mode, const_rtx,
enum machine_mode,
unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT *);
-static rtx reg_num_sign_bit_copies_for_combine (rtx, enum machine_mode, rtx,
+static rtx reg_num_sign_bit_copies_for_combine (const_rtx, enum machine_mode, const_rtx,
enum machine_mode,
unsigned int, unsigned int *);
static void do_SUBST (rtx *, rtx);
static void record_dead_and_set_regs_1 (rtx, rtx, void *);
static void record_dead_and_set_regs (rtx);
static int get_last_value_validate (rtx *, rtx, int, int);
-static rtx get_last_value (rtx);
+static rtx get_last_value (const_rtx);
static int use_crosses_set_p (rtx, int);
static void reg_dead_at_p_1 (rtx, rtx, void *);
static int reg_dead_at_p (rtx, rtx);
static int unmentioned_reg_p_1 (rtx *, void *);
static bool unmentioned_reg_p (rtx, rtx);
static void record_truncated_value (rtx);
-static bool reg_truncated_to_mode (enum machine_mode, rtx);
+static bool reg_truncated_to_mode (enum machine_mode, const_rtx);
static rtx gen_lowpart_or_truncate (enum machine_mode, rtx);
\f
a shift, AND, or zero_extract, we can do better. */
static rtx
-reg_nonzero_bits_for_combine (rtx x, enum machine_mode mode,
- rtx known_x ATTRIBUTE_UNUSED,
+reg_nonzero_bits_for_combine (const_rtx x, enum machine_mode mode,
+ const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT known_ret ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT *nonzero)
be between 1 and the number of bits in MODE. */
static rtx
-reg_num_sign_bit_copies_for_combine (rtx x, enum machine_mode mode,
- rtx known_x ATTRIBUTE_UNUSED,
+reg_num_sign_bit_copies_for_combine (const_rtx x, enum machine_mode mode,
+ const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode
ATTRIBUTE_UNUSED,
unsigned int known_ret ATTRIBUTE_UNUSED,
an explicit truncation. */
static bool
-reg_truncated_to_mode (enum machine_mode mode, rtx x)
+reg_truncated_to_mode (enum machine_mode mode, const_rtx x)
{
reg_stat_type *rsp = VEC_index (reg_stat_type, reg_stat, REGNO (x));
enum machine_mode truncated = rsp->truncated_to_mode;
is known longer known reliably. */
static rtx
-get_last_value (rtx x)
+get_last_value (const_rtx x)
{
unsigned int regno;
rtx value;
+2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * parser.c (eof_token): Un-constify.
+ (cp_lexer_new_main, cp_lexer_new_from_tokens, VEC_alloc,
+ cp_lexer_consume_token, cp_lexer_purge_token): Remove spurious
+ casts.
+
2007-07-28 Kazu Hirata <kazu@codesourcery.com>
* pt.c, tree.c, typeck2.c: Fix comment typos.
DEF_VEC_P (cp_token_position);
DEF_VEC_ALLOC_P (cp_token_position,heap);
-static const cp_token eof_token =
+static cp_token eof_token =
{
CPP_EOF, RID_MAX, 0, PRAGMA_NONE, 0, 0, false, 0, { NULL },
#if USE_MAPPED_LOCATION
lexer->buffer = buffer;
lexer->buffer_length = alloc - space;
lexer->last_token = pos;
- lexer->next_token = lexer->buffer_length ? buffer : (cp_token *)&eof_token;
+ lexer->next_token = lexer->buffer_length ? buffer : &eof_token;
/* Subsequent preprocessor diagnostics should use compiler
diagnostic functions to get the compiler source location. */
/* We do not own the buffer. */
lexer->buffer = NULL;
lexer->buffer_length = 0;
- lexer->next_token = first == last ? (cp_token *)&eof_token : first;
+ lexer->next_token = first == last ? &eof_token : first;
lexer->last_token = last;
lexer->saved_tokens = VEC_alloc (cp_token_position, heap,
++token;
if (token == lexer->last_token)
{
- token = (cp_token *)&eof_token;
+ token = &eof_token;
break;
}
lexer->next_token++;
if (lexer->next_token == lexer->last_token)
{
- lexer->next_token = (cp_token *)&eof_token;
+ lexer->next_token = &eof_token;
break;
}
tok++;
if (tok == lexer->last_token)
{
- tok = (cp_token *)&eof_token;
+ tok = &eof_token;
break;
}
}
If X is not a SUBREG, always return 1 (it is its own low part!). */
int
-subreg_lowpart_p (rtx x)
+subreg_lowpart_p (const_rtx x)
{
if (GET_CODE (x) != SUBREG)
return 1;
static rtx store_field (rtx, HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode,
tree, tree, int, bool);
-static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (tree, tree);
+static unsigned HOST_WIDE_INT highest_pow2_factor_for_target (const_tree, const_tree);
static int is_aligning_offset (tree, tree);
static void expand_operands (tree, tree, rtx, rtx*, rtx*,
/* Helper for categorize_ctor_elements. Identical interface. */
static bool
-categorize_ctor_elements_1 (tree ctor, HOST_WIDE_INT *p_nz_elts,
+categorize_ctor_elements_1 (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
HOST_WIDE_INT *p_elt_count,
bool *p_must_clear)
{
as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */
bool
-categorize_ctor_elements (tree ctor, HOST_WIDE_INT *p_nz_elts,
+categorize_ctor_elements (const_tree ctor, HOST_WIDE_INT *p_nz_elts,
HOST_WIDE_INT *p_elt_count,
bool *p_must_clear)
{
array member at the end of the structure. */
HOST_WIDE_INT
-count_type_elements (tree type, bool allow_flexarr)
+count_type_elements (const_tree type, bool allow_flexarr)
{
const HOST_WIDE_INT max = ~((HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT-1));
switch (TREE_CODE (type))
as PACKED. */
bool
-contains_packed_reference (tree exp)
+contains_packed_reference (const_tree exp)
{
bool packed_p = false;
This is used in updating alignment of MEMs in array references. */
unsigned HOST_WIDE_INT
-highest_pow2_factor (tree exp)
+highest_pow2_factor (const_tree exp)
{
unsigned HOST_WIDE_INT c0, c1;
the structure gives the alignment. */
static unsigned HOST_WIDE_INT
-highest_pow2_factor_for_target (tree target, tree exp)
+highest_pow2_factor_for_target (const_tree target, const_tree exp)
{
unsigned HOST_WIDE_INT target_align, factor;
overflow. */
bool
-may_negate_without_overflow_p (tree t)
+may_negate_without_overflow_p (const_tree t)
{
unsigned HOST_WIDE_INT val;
unsigned int prec;
If NOTRUNC is nonzero, do not truncate the result to fit the data type. */
tree
-int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
+int_const_binop (enum tree_code code, const_tree arg1, const_tree arg2, int notrunc)
{
unsigned HOST_WIDE_INT int1l, int2l;
HOST_WIDE_INT int1h, int2h;
/* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */
bool
-fold_convertible_p (tree type, tree arg)
+fold_convertible_p (const_tree type, const_tree arg)
{
tree orig = TREE_TYPE (arg);
to ensure that global memory is unchanged in between. */
int
-operand_equal_p (tree arg0, tree arg1, unsigned int flags)
+operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
{
/* If either is ERROR_MARK, they aren't equal. */
if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
/* Now see if all the arguments are the same. */
{
- call_expr_arg_iterator iter0, iter1;
- tree a0, a1;
- for (a0 = first_call_expr_arg (arg0, &iter0),
- a1 = first_call_expr_arg (arg1, &iter1);
+ const_call_expr_arg_iterator iter0, iter1;
+ const_tree a0, a1;
+ for (a0 = first_const_call_expr_arg (arg0, &iter0),
+ a1 = first_const_call_expr_arg (arg1, &iter1);
a0 && a1;
- a0 = next_call_expr_arg (&iter0),
- a1 = next_call_expr_arg (&iter1))
+ a0 = next_const_call_expr_arg (&iter0),
+ a1 = next_const_call_expr_arg (&iter1))
if (! operand_equal_p (a0, a1, flags))
return 0;
evaluate the operands in reverse order. */
bool
-tree_swap_operands_p (tree arg0, tree arg1, bool reorder)
+tree_swap_operands_p (const_tree arg0, const_tree arg1, bool reorder)
{
STRIP_SIGN_NOPS (arg0);
STRIP_SIGN_NOPS (arg1);
upon failure. */
static int
-native_encode_int (tree expr, unsigned char *ptr, int len)
+native_encode_int (const_tree expr, unsigned char *ptr, int len)
{
tree type = TREE_TYPE (expr);
int total_bytes = GET_MODE_SIZE (TYPE_MODE (type));
upon failure. */
static int
-native_encode_real (tree expr, unsigned char *ptr, int len)
+native_encode_real (const_tree expr, unsigned char *ptr, int len)
{
tree type = TREE_TYPE (expr);
int total_bytes = GET_MODE_SIZE (TYPE_MODE (type));
upon failure. */
static int
-native_encode_complex (tree expr, unsigned char *ptr, int len)
+native_encode_complex (const_tree expr, unsigned char *ptr, int len)
{
int rsize, isize;
tree part;
upon failure. */
static int
-native_encode_vector (tree expr, unsigned char *ptr, int len)
+native_encode_vector (const_tree expr, unsigned char *ptr, int len)
{
int i, size, offset, count;
tree itype, elem, elements;
placed in the buffer, or zero upon failure. */
int
-native_encode_expr (tree expr, unsigned char *ptr, int len)
+native_encode_expr (const_tree expr, unsigned char *ptr, int len)
{
switch (TREE_CODE (expr))
{
If the buffer cannot be interpreted, return NULL_TREE. */
static tree
-native_interpret_int (tree type, unsigned char *ptr, int len)
+native_interpret_int (tree type, const unsigned char *ptr, int len)
{
int total_bytes = GET_MODE_SIZE (TYPE_MODE (type));
int byte, offset, word, words;
If the buffer cannot be interpreted, return NULL_TREE. */
static tree
-native_interpret_real (tree type, unsigned char *ptr, int len)
+native_interpret_real (tree type, const unsigned char *ptr, int len)
{
enum machine_mode mode = TYPE_MODE (type);
int total_bytes = GET_MODE_SIZE (mode);
If the buffer cannot be interpreted, return NULL_TREE. */
static tree
-native_interpret_complex (tree type, unsigned char *ptr, int len)
+native_interpret_complex (tree type, const unsigned char *ptr, int len)
{
tree etype, rpart, ipart;
int size;
If the buffer cannot be interpreted, return NULL_TREE. */
static tree
-native_interpret_vector (tree type, unsigned char *ptr, int len)
+native_interpret_vector (tree type, const unsigned char *ptr, int len)
{
tree etype, elem, elements;
int i, size, count;
return NULL_TREE. */
tree
-native_interpret_expr (tree type, unsigned char *ptr, int len)
+native_interpret_expr (tree type, const unsigned char *ptr, int len)
{
switch (TREE_CODE (type))
{
should live on the local stack. */
bool
-use_register_for_decl (tree decl)
+use_register_for_decl (const_tree decl)
{
/* Honor volatile. */
if (TREE_SIDE_EFFECTS (decl))
I.E. given <temp> = &A, return A. */
const char *
-get_name (tree t)
+get_name (const_tree t)
{
- tree stripped_decl;
+ const_tree stripped_decl;
stripped_decl = t;
STRIP_NOPS (stripped_decl);
+2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lang.c (java_get_callee_fndecl): Constify.
+
2007-07-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* mangle.c (set_type_package_list): Constify.
static bool java_dump_tree (void *, tree);
static void dump_compound_expr (dump_info_p, tree);
static bool java_decl_ok_for_sibcall (tree);
-static tree java_get_callee_fndecl (tree);
+static tree java_get_callee_fndecl (const_tree);
static void java_clear_binding_stack (void);
#ifndef TARGET_OBJECT_SUFFIX
will replace the indirection with a direct call, which undoes the
purpose of the atable indirection. */
static tree
-java_get_callee_fndecl (tree call_expr)
+java_get_callee_fndecl (const_tree call_expr)
{
tree method, table, element, atable_methods;
extern tree lhd_return_tree (tree);
extern tree lhd_return_null_tree_v (void);
extern tree lhd_return_null_tree (tree);
+extern tree lhd_return_null_const_tree (const_tree);
extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
extern tree lhd_staticp (tree);
extern void lhd_print_tree_nothing (FILE *, tree, int);
#define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
#define LANG_HOOKS_DWARF_NAME lhd_dwarf_name
-#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_tree
+#define LANG_HOOKS_GET_CALLEE_FNDECL lhd_return_null_const_tree
#define LANG_HOOKS_EXPR_SIZE lhd_expr_size
#define LANG_HOOKS_TREE_SIZE lhd_tree_size
#define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p
return NULL_TREE;
}
+/* Do nothing (return NULL_TREE). */
+
+tree
+lhd_return_null_const_tree (const_tree ARG_UNUSED (t))
+{
+ return NULL_TREE;
+}
+
/* The default post options hook. */
bool
int (*types_compatible_p) (tree x, tree y);
/* Given a CALL_EXPR, return a function decl that is its target. */
- tree (*lang_get_callee_fndecl) (tree);
+ tree (*lang_get_callee_fndecl) (const_tree);
/* Called by report_error_function to print out function name. */
void (*print_error_function) (struct diagnostic_context *, const char *);
+2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * objc-act.c (objc_get_callee_fndecl): Constify.
+ * objc-act.h (objc_get_callee_fndecl): Likewise.
+
2007-07-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* objc-act.c (volatilized_hash, volatilized_eq, string_hash,
version looks for the OBJ_TYPE_REF_EXPR which is used for objc_msgSend. */
tree
-objc_get_callee_fndecl (tree call_expr)
+objc_get_callee_fndecl (const_tree call_expr)
{
tree addr = CALL_EXPR_FN (call_expr);
if (TREE_CODE (addr) != OBJ_TYPE_REF)
bool objc_init (void);
const char *objc_printable_name (tree, int);
-tree objc_get_callee_fndecl (tree);
+tree objc_get_callee_fndecl (const_tree);
void objc_finish_file (void);
tree objc_fold_obj_type_ref (tree, tree);
enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *);
and has been exposed to let other functions like categorize_ctor_elements
evaluate the property while walking a constructor for other purposes. */
-extern bool constructor_static_from_elts_p (tree);
+extern bool constructor_static_from_elts_p (const_tree);
/* Return nonzero if VALUE is a valid constant-valued expression
for use in initializing a static variable; one that can be an
/* Builds a symbol_ref for LABEL. */
static rtx
-gen_symbol_ref_rtx_for_label (rtx label)
+gen_symbol_ref_rtx_for_label (const_rtx label)
{
char name[20];
rtx sym;
unsigned int, enum machine_mode);
extern unsigned int subreg_regno (const_rtx);
extern unsigned int subreg_nregs (const_rtx);
-extern unsigned HOST_WIDE_INT nonzero_bits (rtx, enum machine_mode);
-extern unsigned int num_sign_bit_copies (rtx, enum machine_mode);
+extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode);
+extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode);
extern bool constant_pool_constant_p (rtx);
-extern bool truncated_to_mode (enum machine_mode, rtx);
+extern bool truncated_to_mode (enum machine_mode, const_rtx);
/* 1 if RTX is a subreg containing a reg that is already known to be
/* In emit-rtl.c */
extern rtx operand_subword_force (rtx, unsigned int, enum machine_mode);
-extern int subreg_lowpart_p (rtx);
+extern int subreg_lowpart_p (const_rtx);
extern unsigned int subreg_lowpart_offset (enum machine_mode,
enum machine_mode);
extern unsigned int subreg_highpart_offset (enum machine_mode,
extern rtx single_set_2 (const_rtx, const_rtx);
extern int multiple_sets (const_rtx);
extern int set_noop_p (const_rtx);
-extern int noop_move_p (rtx);
+extern int noop_move_p (const_rtx);
extern rtx find_last_value (rtx, rtx *, rtx, int);
extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
{
rtx (*gen_lowpart) (enum machine_mode, rtx);
rtx (*gen_lowpart_no_emit) (enum machine_mode, rtx);
- rtx (*reg_nonzero_bits) (rtx, enum machine_mode, rtx, enum machine_mode,
+ rtx (*reg_nonzero_bits) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *);
- rtx (*reg_num_sign_bit_copies) (rtx, enum machine_mode, rtx, enum machine_mode,
+ rtx (*reg_num_sign_bit_copies) (const_rtx, enum machine_mode, const_rtx, enum machine_mode,
unsigned int, unsigned int *);
- bool (*reg_truncated_to_mode) (enum machine_mode, rtx);
+ bool (*reg_truncated_to_mode) (enum machine_mode, const_rtx);
/* Whenever you add entries here, make sure you adjust rtlhooks-def.h. */
};
unsigned int, enum machine_mode,
struct subreg_info *);
-static unsigned HOST_WIDE_INT cached_nonzero_bits (rtx, enum machine_mode,
- rtx, enum machine_mode,
+static unsigned HOST_WIDE_INT cached_nonzero_bits (const_rtx, enum machine_mode,
+ const_rtx, enum machine_mode,
unsigned HOST_WIDE_INT);
-static unsigned HOST_WIDE_INT nonzero_bits1 (rtx, enum machine_mode,
- rtx, enum machine_mode,
+static unsigned HOST_WIDE_INT nonzero_bits1 (const_rtx, enum machine_mode,
+ const_rtx, enum machine_mode,
unsigned HOST_WIDE_INT);
-static unsigned int cached_num_sign_bit_copies (rtx, enum machine_mode, rtx,
+static unsigned int cached_num_sign_bit_copies (const_rtx, enum machine_mode, const_rtx,
enum machine_mode,
unsigned int);
-static unsigned int num_sign_bit_copies1 (rtx, enum machine_mode, rtx,
+static unsigned int num_sign_bit_copies1 (const_rtx, enum machine_mode, const_rtx,
enum machine_mode, unsigned int);
/* Offset of the first 'e', 'E' or 'V' operand for each rtx code, or
value to itself. */
int
-noop_move_p (rtx insn)
+noop_move_p (const_rtx insn)
{
rtx pat = PATTERN (insn);
\f
unsigned HOST_WIDE_INT
-nonzero_bits (rtx x, enum machine_mode mode)
+nonzero_bits (const_rtx x, enum machine_mode mode)
{
return cached_nonzero_bits (x, mode, NULL_RTX, VOIDmode, 0);
}
unsigned int
-num_sign_bit_copies (rtx x, enum machine_mode mode)
+num_sign_bit_copies (const_rtx x, enum machine_mode mode)
{
return cached_num_sign_bit_copies (x, mode, NULL_RTX, VOIDmode, 0);
}
identical subexpressions on the first or the second level. */
static unsigned HOST_WIDE_INT
-cached_nonzero_bits (rtx x, enum machine_mode mode, rtx known_x,
+cached_nonzero_bits (const_rtx x, enum machine_mode mode, const_rtx known_x,
enum machine_mode known_mode,
unsigned HOST_WIDE_INT known_ret)
{
an arithmetic operation, we can do better. */
static unsigned HOST_WIDE_INT
-nonzero_bits1 (rtx x, enum machine_mode mode, rtx known_x,
+nonzero_bits1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
enum machine_mode known_mode,
unsigned HOST_WIDE_INT known_ret)
{
first or the second level. */
static unsigned int
-cached_num_sign_bit_copies (rtx x, enum machine_mode mode, rtx known_x,
+cached_num_sign_bit_copies (const_rtx x, enum machine_mode mode, const_rtx known_x,
enum machine_mode known_mode,
unsigned int known_ret)
{
be between 1 and the number of bits in MODE. */
static unsigned int
-num_sign_bit_copies1 (rtx x, enum machine_mode mode, rtx known_x,
+num_sign_bit_copies1 (const_rtx x, enum machine_mode mode, const_rtx known_x,
enum machine_mode known_mode,
unsigned int known_ret)
{
assume it already contains a truncated value of MODE. */
bool
-truncated_to_mode (enum machine_mode mode, rtx x)
+truncated_to_mode (enum machine_mode mode, const_rtx x)
{
/* This register has already been used in MODE without explicit
truncation. */
extern rtx gen_lowpart_general (enum machine_mode, rtx);
extern rtx gen_lowpart_no_emit_general (enum machine_mode, rtx);
-extern rtx reg_nonzero_bits_general (rtx, enum machine_mode, rtx,
+extern rtx reg_nonzero_bits_general (const_rtx, enum machine_mode, const_rtx,
enum machine_mode,
unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT *);
-extern rtx reg_num_sign_bit_copies_general (rtx, enum machine_mode, rtx,
+extern rtx reg_num_sign_bit_copies_general (const_rtx, enum machine_mode, const_rtx,
enum machine_mode,
unsigned int, unsigned int *);
-extern bool reg_truncated_to_mode_general (enum machine_mode, rtx);
+extern bool reg_truncated_to_mode_general (enum machine_mode, const_rtx);
#endif /* GCC_RTL_HOOKS_DEF_H */
}
rtx
-reg_num_sign_bit_copies_general (rtx x ATTRIBUTE_UNUSED,
+reg_num_sign_bit_copies_general (const_rtx x ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx known_x ATTRIBUTE_UNUSED,
+ const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode ATTRIBUTE_UNUSED,
unsigned int known_ret ATTRIBUTE_UNUSED,
unsigned int *result ATTRIBUTE_UNUSED)
}
rtx
-reg_nonzero_bits_general (rtx x ATTRIBUTE_UNUSED,
+reg_nonzero_bits_general (const_rtx x ATTRIBUTE_UNUSED,
enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx known_x ATTRIBUTE_UNUSED,
+ const_rtx known_x ATTRIBUTE_UNUSED,
enum machine_mode known_mode ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT known_ret ATTRIBUTE_UNUSED,
unsigned HOST_WIDE_INT *nonzero ATTRIBUTE_UNUSED)
bool
reg_truncated_to_mode_general (enum machine_mode mode ATTRIBUTE_UNUSED,
- rtx x ATTRIBUTE_UNUSED)
+ const_rtx x ATTRIBUTE_UNUSED)
{
return false;
}
(potential) location of the expression. */
int
-warn_if_unused_value (tree exp, location_t locus)
+warn_if_unused_value (const_tree exp, location_t locus)
{
restart:
if (TREE_USED (exp) || TREE_NO_WARNING (exp))
*that* node in turn will point to the relevant FUNCTION_DECL node. */
int
-is_body_block (tree stmt)
+is_body_block (const_tree stmt)
{
if (lang_hooks.no_body_blocks)
return 0;
/* Similar, except passed a tree node. */
enum machine_mode
-mode_for_size_tree (tree size, enum mode_class class, int limit)
+mode_for_size_tree (const_tree size, enum mode_class class, int limit)
{
unsigned HOST_WIDE_INT uhwi;
unsigned int ui;
{
const struct mem_ref *const mem1 = (const struct mem_ref *) obj1;
- return operand_equal_p (mem1->mem, (tree) obj2, 0);
+ return operand_equal_p (mem1->mem, (const_tree) obj2, 0);
}
/* Gathers memory references in statement STMT in LOOP, storing the
but the bit is determined from TYPE_PRECISION, not MODE_BITSIZE. */
int
-tree_int_cst_sign_bit (tree t)
+tree_int_cst_sign_bit (const_tree t)
{
unsigned bitno = TYPE_PRECISION (TREE_TYPE (t)) - 1;
unsigned HOST_WIDE_INT w;
or offset that depends on a field within a record. */
bool
-contains_placeholder_p (tree exp)
+contains_placeholder_p (const_tree exp)
{
enum tree_code code;
{
case CALL_EXPR:
{
- tree arg;
- call_expr_arg_iterator iter;
- FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
+ const_tree arg;
+ const_call_expr_arg_iterator iter;
+ FOR_EACH_CONST_CALL_EXPR_ARG (arg, iter, exp)
if (CONTAINS_PLACEHOLDER_P (arg))
return 1;
return 0;
Also, the TREE_PURPOSEs must match. */
int
-type_list_equal (tree l1, tree l2)
+type_list_equal (const_tree l1, const_tree l2)
{
- tree t1, t2;
+ const_tree t1, t2;
for (t1 = l1, t2 = l2; t1 && t2; t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2))
if (TREE_VALUE (t1) != TREE_VALUE (t2)
this function. */
int
-simple_cst_equal (tree t1, tree t2)
+simple_cst_equal (const_tree t1, const_tree t2)
{
enum tree_code code1, code2;
int cmp;
if (call_expr_nargs (t1) != call_expr_nargs (t2))
return 0;
{
- tree arg1, arg2;
- call_expr_arg_iterator iter1, iter2;
- for (arg1 = first_call_expr_arg (t1, &iter1),
- arg2 = first_call_expr_arg (t2, &iter2);
+ const_tree arg1, arg2;
+ const_call_expr_arg_iterator iter1, iter2;
+ for (arg1 = first_const_call_expr_arg (t1, &iter1),
+ arg2 = first_const_call_expr_arg (t2, &iter2);
arg1 && arg2;
- arg1 = next_call_expr_arg (&iter1),
- arg2 = next_call_expr_arg (&iter2))
+ arg1 = next_const_call_expr_arg (&iter1),
+ arg2 = next_const_call_expr_arg (&iter2))
{
cmp = simple_cst_equal (arg1, arg2);
if (cmp <= 0)
determined. */
tree
-get_callee_fndecl (tree call)
+get_callee_fndecl (const_tree call)
{
tree addr;
if (call == error_mark_node)
- return call;
+ return error_mark_node;
/* It's invalid to call this function with anything but a
CALL_EXPR. */
and get the same result, only slower. */
int
-operand_equal_for_phi_arg_p (tree arg0, tree arg1)
+operand_equal_for_phi_arg_p (const_tree arg0, const_tree arg1)
{
if (arg0 == arg1)
return 1;
extern HOST_WIDE_INT tree_low_cst (const_tree, int);
extern int tree_int_cst_msb (const_tree);
extern int tree_int_cst_sgn (const_tree);
-extern int tree_int_cst_sign_bit (tree);
+extern int tree_int_cst_sign_bit (const_tree);
extern bool tree_expr_nonnegative_p (tree);
extern bool tree_expr_nonnegative_warnv_p (tree, bool *);
-extern bool may_negate_without_overflow_p (tree);
+extern bool may_negate_without_overflow_p (const_tree);
extern tree get_inner_array_type (const_tree);
/* From expmed.c. Since rtl.h is included after tree.h, we can't
The value is BLKmode if no other mode is found. This is like
mode_for_size, but is passed a tree. */
-extern enum machine_mode mode_for_size_tree (tree, enum mode_class, int);
+extern enum machine_mode mode_for_size_tree (const_tree, enum mode_class, int);
/* Return an expr equal to X but certainly not valid as an lvalue. */
Return whether or not CTOR is a valid static constant initializer, the same
as "initializer_constant_valid_p (CTOR, TREE_TYPE (CTOR)) != 0". */
-extern bool categorize_ctor_elements (tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
+extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, HOST_WIDE_INT *,
bool *);
-extern HOST_WIDE_INT count_type_elements (tree, bool);
+extern HOST_WIDE_INT count_type_elements (const_tree, bool);
/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0. */
Note that we only allow such expressions within simple arithmetic
or a COND_EXPR. */
-extern bool contains_placeholder_p (tree);
+extern bool contains_placeholder_p (const_tree);
/* This macro calls the above function but short-circuits the common
case of a constant to save time. Also check for null. */
look for whether EXP or any nested component-refs within EXP is marked
as PACKED. */
-extern bool contains_packed_reference (tree exp);
+extern bool contains_packed_reference (const_tree exp);
/* Return 1 if T is an expression that get_inner_reference handles. */
extern unsigned crc32_string (unsigned, const char *);
extern void clean_symbol_name (char *);
extern tree get_file_function_name (const char *);
-extern tree get_callee_fndecl (tree);
+extern tree get_callee_fndecl (const_tree);
extern void change_decl_assembler_name (tree, tree);
extern int type_num_arguments (const_tree);
extern bool associative_tree_code (enum tree_code);
extern bool commutative_tree_code (enum tree_code);
extern tree upper_bound_in_type (tree, tree);
extern tree lower_bound_in_type (tree, tree);
-extern int operand_equal_for_phi_arg_p (tree, tree);
+extern int operand_equal_for_phi_arg_p (const_tree, const_tree);
extern bool empty_body_p (tree);
extern tree call_expr_arg (tree, int);
extern tree *call_expr_argp (tree, int);
/* In stmt.c */
extern void expand_expr_stmt (tree);
-extern int warn_if_unused_value (tree, location_t);
+extern int warn_if_unused_value (const_tree, location_t);
extern void expand_label (tree);
extern void expand_goto (tree);
extern rtx expand_stack_save (void);
extern void expand_stack_restore (tree);
extern void expand_return (tree);
-extern int is_body_block (tree);
+extern int is_body_block (const_tree);
/* In tree-eh.c */
extern void using_eh_for_cleanups (void);
extern int folding_initializer;
/* Convert between trees and native memory representation. */
-extern int native_encode_expr (tree, unsigned char *, int);
-extern tree native_interpret_expr (tree, unsigned char *, int);
+extern int native_encode_expr (const_tree, unsigned char *, int);
+extern tree native_interpret_expr (tree, const unsigned char *, int);
/* Fold constants as much as possible in an expression.
Returns the simplified expression.
extern tree fold_build3_initializer (enum tree_code, tree, tree, tree, tree);
extern tree fold_build_call_array (tree, tree, int, tree *);
extern tree fold_build_call_array_initializer (tree, tree, int, tree *);
-extern bool fold_convertible_p (tree, tree);
+extern bool fold_convertible_p (const_tree, const_tree);
extern tree fold_convert (tree, tree);
extern tree fold_single_bit_test (enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree);
OEP_PURE_SAME = 2
};
-extern int operand_equal_p (tree, tree, unsigned int);
+extern int operand_equal_p (const_tree, const_tree, unsigned int);
extern int multiple_of_p (tree, tree, tree);
extern tree omit_one_operand (tree, tree, tree);
extern tree omit_two_operands (tree, tree, tree, tree);
extern tree fold_unary_to_constant (enum tree_code, tree, tree);
extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
extern tree fold_read_from_constant_string (tree);
-extern tree int_const_binop (enum tree_code, tree, tree, int);
+extern tree int_const_binop (enum tree_code, const_tree, const_tree, int);
extern tree build_fold_addr_expr (tree);
extern tree fold_build_cleanup_point_expr (tree type, tree expr);
extern tree fold_strip_sign_ops (tree);
extern tree constant_boolean_node (int, tree);
extern tree build_low_bits_mask (tree, unsigned);
-extern bool tree_swap_operands_p (tree, tree, bool);
+extern bool tree_swap_operands_p (const_tree, const_tree, bool);
extern void swap_tree_operands (tree, tree *, tree *);
extern enum tree_code swap_tree_comparison (enum tree_code);
extern tree fold_builtin_strncpy_chk (tree, tree, tree, tree, tree);
extern tree fold_builtin_snprintf_chk (tree, tree, enum built_in_function);
extern bool fold_builtin_next_arg (tree, bool);
-extern enum built_in_function builtin_mathfn_code (tree);
+extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (tree, tree);
extern tree fold_build_call_expr (tree, tree, tree, tree);
extern tree fold_builtin_call_array (tree, tree, int, tree *);
extern tree std_gimplify_va_arg_expr (tree, tree, tree *, tree *);
extern tree build_va_arg_indirect_ref (tree);
extern tree build_string_literal (int, const char *);
-extern bool validate_arglist (tree, ...);
+extern bool validate_arglist (const_tree, ...);
extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
extern int get_pointer_alignment (tree, unsigned int);
extern bool variably_modified_type_p (tree, tree);
extern int tree_log2 (const_tree);
extern int tree_floor_log2 (const_tree);
-extern int simple_cst_equal (tree, tree);
+extern int simple_cst_equal (const_tree, const_tree);
extern hashval_t iterative_hash_expr (const_tree, hashval_t);
extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
-extern int type_list_equal (tree, tree);
+extern int type_list_equal (const_tree, const_tree);
extern int chain_member (const_tree, const_tree);
extern tree type_hash_lookup (unsigned int, tree);
extern void type_hash_add (unsigned int, tree);
extern unsigned int init_function_for_compilation (void);
extern void allocate_struct_function (tree);
extern void init_function_start (tree);
-extern bool use_register_for_decl (tree);
+extern bool use_register_for_decl (const_tree);
extern void generate_setjmp_warnings (void);
extern void init_temp_slots (void);
extern void free_temp_slots (void);
#define ECF_NOVOPS 1024
extern int flags_from_decl_or_type (const_tree);
-extern int call_expr_flags (tree);
+extern int call_expr_flags (const_tree);
extern int setjmp_call_p (const_tree);
extern bool alloca_call_p (const_tree);
/* In gimplify.c. */
extern tree create_artificial_label (void);
extern void gimplify_function_tree (tree);
-extern const char *get_name (tree);
+extern const char *get_name (const_tree);
extern tree unshare_expr (tree);
extern void sort_case_labels (tree);
\f
extern unsigned HOST_WIDE_INT compute_builtin_object_size (tree, int);
/* In expr.c. */
-extern unsigned HOST_WIDE_INT highest_pow2_factor (tree);
+extern unsigned HOST_WIDE_INT highest_pow2_factor (const_tree);
/* In tree-inline.c. */
int i; /* next argument index */
} call_expr_arg_iterator;
+typedef struct const_call_expr_arg_iterator_d GTY (())
+{
+ const_tree t; /* the call_expr */
+ int n; /* argument count */
+ int i; /* next argument index */
+} const_call_expr_arg_iterator;
+
/* Initialize the abstract argument list iterator object ITER with the
arguments from CALL_EXPR node EXP. */
static inline void
iter->i = 0;
}
+static inline void
+init_const_call_expr_arg_iterator (const_tree exp, const_call_expr_arg_iterator *iter)
+{
+ iter->t = exp;
+ iter->n = call_expr_nargs (exp);
+ iter->i = 0;
+}
+
/* Return the next argument from abstract argument list iterator object ITER,
and advance its state. Return NULL_TREE if there are no more arguments. */
static inline tree
return result;
}
+static inline const_tree
+next_const_call_expr_arg (const_call_expr_arg_iterator *iter)
+{
+ const_tree result;
+ if (iter->i >= iter->n)
+ return NULL_TREE;
+ result = CALL_EXPR_ARG (iter->t, iter->i);
+ iter->i++;
+ return result;
+}
+
/* Initialize the abstract argument list iterator object ITER, then advance
past and return the first argument. Useful in for expressions, e.g.
for (arg = first_call_expr_arg (exp, &iter); arg;
return next_call_expr_arg (iter);
}
+static inline const_tree
+first_const_call_expr_arg (const_tree exp, const_call_expr_arg_iterator *iter)
+{
+ init_const_call_expr_arg_iterator (exp, iter);
+ return next_const_call_expr_arg (iter);
+}
+
/* Test whether there are more arguments in abstract argument list iterator
ITER, without changing its state. */
static inline bool
return (iter->i < iter->n);
}
+static inline bool
+more_const_call_expr_args_p (const const_call_expr_arg_iterator *iter)
+{
+ return (iter->i < iter->n);
+}
/* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER
(of type call_expr_arg_iterator) to hold the iteration state. */
for ((arg) = first_call_expr_arg ((call), &(iter)); (arg); \
(arg) = next_call_expr_arg (&(iter)))
+#define FOR_EACH_CONST_CALL_EXPR_ARG(arg, iter, call) \
+ for ((arg) = first_const_call_expr_arg ((call), &(iter)); (arg); \
+ (arg) = next_const_call_expr_arg (&(iter)))
+
#endif /* GCC_TREE_H */
evaluate the property while walking a constructor for other purposes. */
bool
-constructor_static_from_elts_p (tree ctor)
+constructor_static_from_elts_p (const_tree ctor)
{
return (TREE_CONSTANT (ctor)
&& (TREE_CODE (TREE_TYPE (ctor)) == UNION_TYPE