+2004-07-28 Eric Christopher <echristo@redhat.com>
+
+ * c-common.c (c_common_unsafe_for_reeval): Delete.
+ * c-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete use.
+ * c-pretty-print.c (pp_c_expression): Delete UNSAVE_EXPR case.
+ * calls.c (fix_unsafe_tree): Delete.
+ (expand_call): Delete code which used above.
+ * dojump.c (do_jump): Delete UNSAVE_EXPR case.
+ * expr.c (expand_expr_real_1): Ditto.
+ * fold-const.c (non_lvalue): Ditto.
+ * langhooks-def.h (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete.
+ (lhd_unsafe_for_reeval): Ditto.
+ * langhooks.c (lhd_unsafe_for_reeval): Ditto.
+ * langhooks.h (unsafe_for_reeval): Ditto.
+ (unsave_expr_now): Adjust comment.
+ * tree-inline.c (copy_body_r): Delete UNSAVE_EXPR bits.
+ (estimate_num_insns_1): Ditto.
+ * tree-pretty-print.c (dump_generic_node): Ditto.
+ * tree.c (expr_align): Ditto.
+ (unsave_expr): Delete.
+ (unsafe_for_reeval): Ditto.
+ * tree.h (unsafe_for_reeval, unsave_expr): Ditto.
+ * tree.def (UNSAVE_EXPR): Delete.
+ * objc/objc-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete.
+
2004-07-28 Zack Weinberg <zack@codesourcery.com>
* tree.h (enum tls_model): Move ...
unit. It will inform the ObjC runtime that class definition(s) herein
contained are to replace one(s) previously loaded. */
int flag_replace_objc_classes = 0;
-
+
/* C/ObjC language option variables. */
warning ("case label value is less than minimum value for type");
return false;
}
-
+
/* Case value is greater than maximum for type. */
if (tree_int_cst_compare (case_low, max_value) > 0
&& tree_int_cst_compare (case_high, max_value) > 0)
" less than minimum value for type");
case_low = min_value;
}
-
+
/* Saturate upper case label value to maximum. */
if (tree_int_cst_compare (case_low, max_value) <= 0
&& tree_int_cst_compare (case_high, max_value) > 0)
if (mode == TYPE_MODE (void_type_node))
return void_type_node;
-
+
if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
return unsignedp ? make_unsigned_type (mode) : make_signed_type (mode);
{
if (type == error_mark_node)
return type;
-
+
if (TREE_CODE (type) == ARRAY_TYPE)
return build_array_type (c_build_qualified_type (TREE_TYPE (type),
type_quals),
c_apply_type_quals_to_decl (int type_quals, tree decl)
{
tree type = TREE_TYPE (decl);
-
+
if (type == error_mark_node)
return;
{
tree t2;
/* Find bottom type under any nested POINTERs. */
- for (t2 = TREE_TYPE (t);
+ for (t2 = TREE_TYPE (t);
TREE_CODE (t2) == POINTER_TYPE;
t2 = TREE_TYPE (t2))
;
- if (TREE_CODE (t2) != RECORD_TYPE
+ if (TREE_CODE (t2) != RECORD_TYPE
&& TREE_CODE (t2) != ENUMERAL_TYPE
&& TREE_CODE (t2) != QUAL_UNION_TYPE
&& TREE_CODE (t2) != UNION_TYPE)
return -1;
}
/* These are the only cases that need special handling. */
- if (TREE_CODE (t) != RECORD_TYPE
+ if (TREE_CODE (t) != RECORD_TYPE
&& TREE_CODE (t) != ENUMERAL_TYPE
&& TREE_CODE (t) != QUAL_UNION_TYPE
&& TREE_CODE (t) != UNION_TYPE
if (TYPE_SIZE (t) == 0)
return -1;
- /* Look up t in hash table. Only one of the compatible types within each
+ /* Look up t in hash table. Only one of the compatible types within each
alias set is recorded in the table. */
if (!type_hash_table)
type_hash_table = htab_create (1021, c_type_hash,
else if (!COMPLETE_TYPE_P (type))
{
if (complain)
- error ("invalid application of `%s' to incomplete type `%T' ",
+ error ("invalid application of `%s' to incomplete type `%T' ",
op_name, type);
value = size_zero_node;
}
void
c_do_switch_warnings (splay_tree cases, tree switch_stmt)
{
- splay_tree_node default_node;
+ splay_tree_node default_node;
location_t switch_location;
tree type;
tree chain;
/* The time complexity here is O(N*lg(N)) worst case, but for the
- common case of monotonically increasing enumerators, it is
+ common case of monotonically increasing enumerators, it is
O(N), since the nature of the splay tree will keep the next
element adjacent to the root at all times. */
if (node)
{
/* Mark the CASE_LOW part of the case entry as seen, so
- that we save time later. Choose TREE_ADDRESSABLE
+ that we save time later. Choose TREE_ADDRESSABLE
randomly as a bit that won't have been set to-date. */
tree label = (tree) node->value;
TREE_ADDRESSABLE (label) = 1;
The time complexity here is O(N**2) worst case, since we've
not sorted the enumeration values. However, in the absence
- of case ranges this is O(N), since all single cases that
+ of case ranges this is O(N), since all single cases that
corresponded to enumerations have been marked above. */
splay_tree_foreach (cases, match_case_to_enum, type);
}
/* Hook used by expand_expr to expand language-specific tree codes. */
-/* The only things that should go here are bits needed to expand
+/* The only things that should go here are bits needed to expand
constant initializers. Everything else should be handled by the
gimplification routines. */
rtx
-c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
+c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
int modifier /* Actually enum_modifier. */,
rtx *alt_rtl)
{
}
}
-/* Hook used by unsafe_for_reeval to handle language-specific tree codes. */
-
-int
-c_common_unsafe_for_reeval (tree exp)
-{
- /* Statement expressions may not be reevaluated, likewise compound
- literals. */
- if (TREE_CODE (exp) == STMT_EXPR
- || TREE_CODE (exp) == COMPOUND_LITERAL_EXPR)
- return 2;
-
- /* Walk all other expressions. */
- return -1;
-}
-
/* Hook used by staticp to handle language-specific tree codes. */
bool
{
/* If it is the main variant, then pack the other variants
too. This happens in,
-
+
struct Foo {
struct Foo const *ptr; // creates a variant w/o packed flag
} __ attribute__((packed)); // packs it now.
*/
tree probe;
-
+
for (probe = *node; probe; probe = TYPE_NEXT_VARIANT (probe))
TYPE_PACKED (probe) = 1;
}
-
+
}
else if (TREE_CODE (*node) == FIELD_DECL)
DECL_PACKED (*node) = 1;
error ("visibility arg not a string");
return NULL_TREE;
}
-
+
/* If this is a type, set the visibility on the type decl. */
if (TYPE_P (decl))
{
else if (strcmp (TREE_STRING_POINTER (id), "internal") == 0)
DECL_VISIBILITY (decl) = VISIBILITY_INTERNAL;
else if (strcmp (TREE_STRING_POINTER (id), "hidden") == 0)
- DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
+ DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;
else if (strcmp (TREE_STRING_POINTER (id), "protected") == 0)
DECL_VISIBILITY (decl) = VISIBILITY_PROTECTED;
else
/* Walk a gimplified function and warn for functions whose return value is
ignored and attribute((warn_unused_result)) is set. This is done before
- inlining, so we don't have to worry about that. */
-
+ inlining, so we don't have to worry about that. */
+
void
c_warn_unused_result (tree *top_p)
{
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
#undef LANG_HOOKS_STATICP
pp_c_type_qualifier_list (c_pretty_printer *pp, tree t)
{
int qualifiers;
-
+
if (!TYPE_P (t))
t = TREE_TYPE (t);
case POINTER_TYPE:
pp_abstract_declarator (pp, t);
break;
-
+
case FUNCTION_TYPE:
pp_c_parameter_type_list (pp, t);
pp_direct_abstract_declarator (pp, TREE_TYPE (t));
case COMPLEX_TYPE:
case TYPE_DECL:
break;
-
+
default:
pp_unsupported_tree (pp, t);
break;
pp_direct_declarator (pp, t);
break;
-
+
default:
pp_unsupported_tree (pp, t);
break;
{
tree type = TREE_TYPE (c);
if (type == wchar_type_node)
- pp_character (pp, 'L');
+ pp_character (pp, 'L');
pp_quote (pp);
if (host_integerp (c, TYPE_UNSIGNED (type)))
pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type)));
}
/* Pretty-print a compound literal expression. GNU extensions include
- vector constants. */
+ vector constants. */
static void
pp_c_compound_literal (c_pretty_printer *pp, tree e)
{
- tree type = TREE_TYPE (e);
+ tree type = TREE_TYPE (e);
pp_c_type_cast (pp, type);
switch (TREE_CODE (type))
pp_c_character_constant (pp, e);
else if (TREE_CODE (type) == ENUMERAL_TYPE
&& pp_c_enumeration_constant (pp, e))
- ;
- else
+ ;
+ else
pp_c_integer_constant (pp, e);
}
break;
void
pp_c_identifier (c_pretty_printer *pp, const char *id)
{
- pp_c_maybe_whitespace (pp);
- pp_identifier (pp, id);
+ pp_c_maybe_whitespace (pp);
+ pp_identifier (pp, id);
pp_base (pp)->padding = pp_before;
}
unary-operator: one of
* & + - ! ~
-
+
GNU extensions.
unary-expression:
__alignof__ unary-expression
else
pp_minus (pp);
pp_c_whitespace (pp);
- pp_multiplicative_expression (pp, TREE_OPERAND (e, 1));
+ pp_multiplicative_expression (pp, TREE_OPERAND (e, 1));
break;
default:
/* assignment-expression:
conditional-expression
- unary-expression assignment-operator assignment-expression
+ unary-expression assignment-operator assignment-expression
assignment-expression: one of
= *= /= %= += -= >>= <<= &= ^= |= */
case NE_EXPR:
pp_c_equality_expression (pp, e);
break;
-
+
case COND_EXPR:
pp_conditional_expression (pp, e);
break;
case NOP_EXPR:
case NON_LVALUE_EXPR:
case SAVE_EXPR:
- case UNSAVE_EXPR:
pp_expression (pp, TREE_OPERAND (e, 0));
break;
case TARGET_EXPR:
pp_postfix_expression (pp, TREE_OPERAND (e, 1));
break;
-
+
default:
pp_unsupported_tree (pp, e);
break;
if (pp_needs_newline (pp))
pp_newline_and_indent (pp, 0);
-
+
code = TREE_CODE (stmt);
switch (code)
{
static int combine_pending_stack_adjustment_and_call (int, struct args_size *,
unsigned int);
-static tree fix_unsafe_tree (tree);
static bool shift_returned_value (tree, rtx *);
#ifdef REG_PARM_STACK_SPACE
return insn != NULL_RTX;
}
-static tree
-fix_unsafe_tree (tree t)
-{
- switch (unsafe_for_reeval (t))
- {
- case 0: /* Safe. */
- break;
-
- case 1: /* Mildly unsafe. */
- t = unsave_expr (t);
- break;
-
- case 2: /* Wildly unsafe. */
- {
- tree var = build_decl (VAR_DECL, NULL_TREE,
- TREE_TYPE (t));
- SET_DECL_RTL (var,
- expand_expr (t, NULL_RTX, VOIDmode, EXPAND_NORMAL));
- t = var;
- }
- break;
-
- default:
- abort ();
- }
- return t;
-}
-
-
/* If function value *VALUE was returned at the most significant end of a
register, shift it towards the least significant end and convert it to
TYPE's mode. Return true and update *VALUE if some action was needed.
|| !lang_hooks.decls.ok_for_sibcall (fndecl))
try_tail_call = 0;
- if (try_tail_call)
- {
- int end, inc;
- actparms = NULL_TREE;
- /* Ok, we're going to give the tail call the old college try.
- This means we're going to evaluate the function arguments
- up to three times. There are two degrees of badness we can
- encounter, those that can be unsaved and those that can't.
- (See unsafe_for_reeval commentary for details.)
-
- Generate a new argument list. Pass safe arguments through
- unchanged. For the easy badness wrap them in UNSAVE_EXPRs.
- For hard badness, evaluate them now and put their resulting
- rtx in a temporary VAR_DECL.
-
- initialize_argument_information has ordered the array for the
- order to be pushed, and we must remember this when reconstructing
- the original argument order. */
-
- if (PUSH_ARGS_REVERSED)
- {
- inc = 1;
- i = 0;
- end = num_actuals;
- }
- else
- {
- inc = -1;
- i = num_actuals - 1;
- end = -1;
- }
-
- for (; i != end; i += inc)
- {
- args[i].tree_value = fix_unsafe_tree (args[i].tree_value);
- }
- /* Do the same for the function address if it is an expression. */
- if (!fndecl)
- addr = fix_unsafe_tree (addr);
- }
-
-
/* Ensure current function's preferred stack boundary is at least
what we need. We don't have to increase alignment for recursive
functions. */
+2004-07-28 Eric Christopher <echristo@redhat.com>
+
+ * cp-lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete.
+
2004-07-28 Nathan Sidwell <nathan@codesourcery.com>
* cp-tree.h (struct tree_pair_s): New.
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL cxx_dup_lang_specific_decl
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME mangle_decl
#undef LANG_HOOKS_MARK_ADDRESSABLE
/* The base variant of a type must be in the same alias set as the
complete type. */
return get_alias_set (TYPE_CONTEXT (t));
-
+
/* Punt on PMFs until we canonicalize functions properly. */
if (TYPE_PTRMEMFUNC_P (t))
return 0;
/* This would be wrong for a type with virtual bases, but they are
caught by the abort above. */
return (is_empty_class (TREE_TYPE (exp))
- ? size_zero_node
+ ? size_zero_node
: CLASSTYPE_SIZE_UNIT (TREE_TYPE (exp)));
}
else
nonzero, rvalues of class type are considered lvalues. */
static cp_lvalue_kind
-lvalue_p_1 (tree ref,
+lvalue_p_1 (tree ref,
int treat_class_rvalues_as_lvalues)
{
cp_lvalue_kind op1_lvalue_kind = clk_none;
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case SAVE_EXPR:
- case UNSAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case REALPART_EXPR:
expression does not depend on "X". */
op1_lvalue_kind &= ~clk_packed;
/* Look at the member designator. */
- if (!op1_lvalue_kind
- /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
+ if (!op1_lvalue_kind
+ /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
situations. */
|| TREE_CODE (TREE_OPERAND (ref, 1)) != FIELD_DECL)
;
}
else if (DECL_PACKED (TREE_OPERAND (ref, 1)))
op1_lvalue_kind |= clk_packed;
-
+
return op1_lvalue_kind;
case STRING_CST:
case FUNCTION_DECL:
/* All functions (except non-static-member functions) are
lvalues. */
- return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref)
+ return (DECL_NONSTATIC_MEMBER_FUNCTION_P (ref)
? clk_none : clk_ordinary);
case NON_DEPENDENT_EXPR:
cp_lvalue_kind
real_lvalue_p (tree ref)
{
- return lvalue_p_1 (ref,
+ return lvalue_p_1 (ref,
/*treat_class_rvalues_as_lvalues=*/0);
}
int
lvalue_p (tree ref)
{
- return
+ return
(lvalue_p_1 (ref, /*class rvalue ok*/ 1) != clk_none);
}
{
tree t;
- t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value,
+ t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value,
cxx_maybe_build_cleanup (decl), NULL_TREE);
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not
ignore the TARGET_EXPR. If there really turn out to be no
/* Push these needs up so that initialization takes place
more easily. */
- TYPE_NEEDS_CONSTRUCTING (t)
+ TYPE_NEEDS_CONSTRUCTING (t)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (elt_type));
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (elt_type));
return t;
}
/* Make a variant of TYPE, qualified with the TYPE_QUALS. Handles
arrays correctly. In particular, if TYPE is an array of T's, and
TYPE_QUALS is non-empty, returns an array of qualified T's.
-
+
FLAGS determines how to deal with illformed qualifications. If
tf_ignore_bad_quals is set, then bad qualifications are dropped
(this is permitted if TYPE was introduced via a typedef or template
DR 295 queries this and the proposed resolution brings it into line
with qualifying a reference. We implement the DR. We also behave
in a similar manner for restricting non-pointer types. */
-
+
tree
-cp_build_qualified_type_real (tree type,
- int type_quals,
+cp_build_qualified_type_real (tree type,
+ int type_quals,
tsubst_flags_t complain)
{
tree result;
/* In C++, the qualification really applies to the array element
type. Obtain the appropriately qualified element type. */
tree t;
- tree element_type
- = cp_build_qualified_type_real (TREE_TYPE (type),
+ tree element_type
+ = cp_build_qualified_type_real (TREE_TYPE (type),
type_quals,
complain);
/* See if we already have an identically qualified type. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
- if (cp_type_quals (t) == type_quals
+ if (cp_type_quals (t) == type_quals
&& TYPE_NAME (t) == TYPE_NAME (type)
&& TYPE_CONTEXT (t) == TYPE_CONTEXT (type))
break;
-
+
if (!t)
{
/* Make a new array type, just like the old one, but with the
/* Even if we already had this variant, we update
TYPE_NEEDS_CONSTRUCTING and TYPE_HAS_NONTRIVIAL_DESTRUCTOR in case
- they changed since the variant was originally created.
-
+ they changed since the variant was originally created.
+
This seems hokey; if there is some way to use a previous
variant *without* coming through here,
TYPE_NEEDS_CONSTRUCTING will never be updated. */
- TYPE_NEEDS_CONSTRUCTING (t)
+ TYPE_NEEDS_CONSTRUCTING (t)
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (element_type));
- TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (element_type));
return t;
}
t = cp_build_qualified_type_real (t, type_quals, complain);
return build_ptrmemfunc_type (t);
}
-
+
/* A reference, function or method type shall not be cv qualified.
[dcl.ref], [dct.fct] */
if (type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)
bad_quals |= type_quals & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
type_quals &= ~(TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE);
}
-
+
/* A restrict-qualified type must be a pointer (or reference)
to object or incomplete type. */
if ((type_quals & TYPE_QUAL_RESTRICT)
if (bad_quals)
{
tree bad_type = build_qualified_type (ptr_type_node, bad_quals);
-
+
if (!(complain & tf_ignore_bad_quals))
error ("`%V' qualifiers cannot be applied to `%T'",
bad_type, type);
}
}
-
+
/* Retrieve (or create) the appropriately qualified variant. */
result = build_qualified_type (type, type_quals);
then we need to unshare the record that holds the cached
pointer-to-member-function type, because these will be distinct
between the unqualified and qualified types. */
- if (result != type
+ if (result != type
&& TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)
TYPE_LANG_SPECIFIC (result) = NULL;
if (new_binfo)
return new_binfo;
}
-
+
new_binfo = make_tree_binfo (binfo ? BINFO_N_BASE_BINFOS (binfo) : 0);
BINFO_TYPE (new_binfo) = type;
/* Chain it into the inheritance graph. */
TREE_CHAIN (*igo_prev) = new_binfo;
*igo_prev = new_binfo;
-
+
if (binfo)
{
int ix;
tree base_binfo;
-
+
my_friendly_assert (!BINFO_DEPENDENT_BASE_P (binfo), 20040712);
my_friendly_assert (type == BINFO_TYPE (binfo), 20040714);
-
+
BINFO_OFFSET (new_binfo) = BINFO_OFFSET (binfo);
BINFO_VIRTUALS (new_binfo) = BINFO_VIRTUALS (binfo);
-
+
/* We do not need to copy the accesses, as they are read only. */
BINFO_BASE_ACCESSES (new_binfo) = BINFO_BASE_ACCESSES (binfo);
-
+
/* Recursively copy base binfos of BINFO. */
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
{
tree new_base_binfo;
-
+
my_friendly_assert (!BINFO_DEPENDENT_BASE_P (base_binfo), 20040713);
new_base_binfo = copy_binfo (base_binfo, BINFO_TYPE (base_binfo),
t, igo_prev,
BINFO_VIRTUAL_P (base_binfo));
-
+
if (!BINFO_INHERITANCE_CHAIN (new_base_binfo))
BINFO_INHERITANCE_CHAIN (new_base_binfo) = new_binfo;
BINFO_BASE_APPEND (new_binfo, new_base_binfo);
}
else
BINFO_DEPENDENT_BASE_P (new_binfo) = 1;
-
+
if (virt)
{
/* Push it onto the list after any virtual bases it contains
BINFO_VIRTUAL_P (new_binfo) = 1;
BINFO_INHERITANCE_CHAIN (new_binfo) = TYPE_BINFO (t);
}
-
+
return new_binfo;
}
\f
static GTY ((param_is (union tree_node))) htab_t list_hash_table;
-struct list_proxy
+struct list_proxy
{
tree purpose;
tree value;
list_hash_pieces (tree purpose, tree value, tree chain)
{
hashval_t hashcode = 0;
-
+
if (chain)
hashcode += TREE_HASH (chain);
-
+
if (value)
hashcode += TREE_HASH (value);
else
list_hash (const void* p)
{
tree t = (tree) p;
- return list_hash_pieces (TREE_PURPOSE (t),
- TREE_VALUE (t),
+ return list_hash_pieces (TREE_PURPOSE (t),
+ TREE_VALUE (t),
TREE_CHAIN (t));
}
int
really_overloaded_fn (tree x)
-{
+{
/* A baselink is also considered an overloaded function. */
if (TREE_CODE (x) == OFFSET_REF)
x = TREE_OPERAND (x, 1);
if (BASELINK_P (x))
x = BASELINK_FUNCTIONS (x);
-
+
return ((TREE_CODE (x) == OVERLOAD && OVL_CHAIN (x))
|| DECL_FUNCTION_TEMPLATE_P (OVL_CURRENT (x))
|| TREE_CODE (x) == TEMPLATE_ID_EXPR);
TREE_TYPE (result) = unknown_type_node;
OVL_FUNCTION (result) = decl;
TREE_CHAIN (result) = chain;
-
+
return result;
}
TEMPLATE_TYPE_PARM_INDEX (t2) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t));
TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2)) = decl;
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2)
- = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t),
+ = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t),
newargs, NULL_TREE);
TREE_TYPE (decl) = t2;
int n_trees = 0;
walk_tree_without_duplicates (&t, count_trees_r, &n_trees);
return n_trees;
-}
+}
/* Called from verify_stmt_tree via walk_tree. */
static tree
-verify_stmt_tree_r (tree* tp,
- int* walk_subtrees ATTRIBUTE_UNUSED ,
+verify_stmt_tree_r (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
void* data)
{
tree t = *tp;
there is a circularity in the statement tree. */
if (htab_find (*statements, t))
abort ();
-
+
slot = htab_find_slot (*statements, t, INSERT);
*slot = t;
/* Called from find_tree via walk_tree. */
static tree
-find_tree_r (tree* tp,
- int* walk_subtrees ATTRIBUTE_UNUSED ,
+find_tree_r (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
void* data)
{
if (*tp == (tree) data)
case FUNCTION_TYPE:
{
tree parm;
- for (parm = TYPE_ARG_TYPES (t);
- parm && parm != void_list_node;
+ for (parm = TYPE_ARG_TYPES (t);
+ parm && parm != void_list_node;
parm = TREE_CHAIN (parm))
{
r = no_linkage_check (TREE_VALUE (parm));
u = build_cplus_new
(TREE_TYPE (t), break_out_target_exprs (TREE_OPERAND (t, 1)));
}
- else
+ else
{
u = build_target_expr_with_type
(break_out_target_exprs (TREE_OPERAND (t, 1)), TREE_TYPE (t));
}
/* Map the old variable to the new one. */
- splay_tree_insert (target_remap,
- (splay_tree_key) TREE_OPERAND (t, 0),
+ splay_tree_insert (target_remap,
+ (splay_tree_key) TREE_OPERAND (t, 0),
(splay_tree_value) TREE_OPERAND (u, 0));
/* Replace the old expression with the new version. */
/* Make a copy of this node. */
return copy_tree_r (tp, walk_subtrees, NULL);
}
-
+
/* Replace all remapped VAR_DECLs in T with their new equivalents.
DATA is really a splay-tree mapping old variables to new
variables. */
static tree
-bot_replace (tree* t,
- int* walk_subtrees ATTRIBUTE_UNUSED ,
+bot_replace (tree* t,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
void* data)
{
splay_tree target_remap = ((splay_tree) data);
return NULL_TREE;
}
-
+
/* When we parse a default argument expression, we may create
temporary variables via TARGET_EXPRs. When we actually use the
default-argument expression, we make a copy of the expression, but
static splay_tree target_remap;
if (!target_remap_count++)
- target_remap = splay_tree_new (splay_tree_compare_pointers,
- /*splay_tree_delete_key_fn=*/NULL,
+ target_remap = splay_tree_new (splay_tree_compare_pointers,
+ /*splay_tree_delete_key_fn=*/NULL,
/*splay_tree_delete_value_fn=*/NULL);
walk_tree (&t, bot_manip, target_remap, NULL);
walk_tree (&t, bot_replace, target_remap, NULL);
/* This should not be considered a COMPOUND_EXPR, because it
resolves to an overload. */
COMPOUND_EXPR_OVERLOADED (t) = 1;
-
+
va_end (p);
return t;
}
{
if (i >= 256)
return build_int_2 (i, 0);
-
+
if (!shared_int_cache[i])
shared_int_cache[i] = build_int_2 (i, 0);
-
+
return shared_int_cache[i];
}
return TYPE_STUB_DECL (t);
if (t == error_mark_node)
return t;
-
+
abort ();
/* Stop compiler from complaining control reaches end of non-void function. */
/* They might have become equal now. */
if (t1 == t2)
return true;
-
+
if (code1 != code2)
return false;
{
tree o1 = TREE_OPERAND (t1, 0);
tree o2 = TREE_OPERAND (t2, 0);
-
+
/* Special case: if either target is an unallocated VAR_DECL,
it means that it's going to be unified with whatever the
TARGET_EXPR is really supposed to initialize, so treat it
/*Nop*/;
else if (!cp_tree_equal (o1, o2))
return false;
-
+
return cp_tree_equal (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1));
}
-
+
case WITH_CLEANUP_EXPR:
if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
return false;
{
unsigned ix;
tree vec1, vec2;
-
+
if (!cp_tree_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)))
return false;
vec1 = TREE_OPERAND (t1, 1);
if (!vec1 || !vec2)
return !vec1 && !vec2;
-
+
if (TREE_VEC_LENGTH (vec1) != TREE_VEC_LENGTH (vec2))
return false;
if (!cp_tree_equal (TREE_VEC_ELT (vec1, ix),
TREE_VEC_ELT (vec2, ix)))
return false;
-
+
return true;
}
-
+
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
{
tree o1 = TREE_OPERAND (t1, 0);
tree o2 = TREE_OPERAND (t2, 0);
-
+
if (TREE_CODE (o1) != TREE_CODE (o2))
return false;
if (TYPE_P (o1))
else
return cp_tree_equal (o1, o2);
}
-
+
case PTRMEM_CST:
/* Two pointer-to-members are the same if they point to the same
field or function in the same class. */
case 's':
{
int i;
-
+
for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
if (!cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i)))
return false;
-
+
return true;
}
-
+
case 't':
return same_type_p (t1, t2);
}
error_type (tree arg)
{
tree type = TREE_TYPE (arg);
-
+
if (TREE_CODE (type) == ARRAY_TYPE)
;
else if (TREE_CODE (type) == ERROR_MARK)
{
tree decl, context;
tree binfo;
-
+
if (current_class_type
&& (binfo = lookup_base (current_class_type, type,
ba_ignore | ba_quiet, NULL)))
if (binfop)
*binfop = binfo;
-
+
if (current_class_ref && context == current_class_type
/* Kludge: Make sure that current_class_type is actually
correct. It might not be if we're in the middle of
/* Handle a "java_interface" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_java_interface_attribute (tree* node,
- tree name,
- tree args ATTRIBUTE_UNUSED ,
- int flags,
+handle_java_interface_attribute (tree* node,
+ tree name,
+ tree args ATTRIBUTE_UNUSED ,
+ int flags,
bool* no_add_attrs)
{
if (DECL_P (*node)
/* Handle a "com_interface" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_com_interface_attribute (tree* node,
- tree name,
- tree args ATTRIBUTE_UNUSED ,
- int flags ATTRIBUTE_UNUSED ,
+handle_com_interface_attribute (tree* node,
+ tree name,
+ tree args ATTRIBUTE_UNUSED ,
+ int flags ATTRIBUTE_UNUSED ,
bool* no_add_attrs)
{
static int warned;
/* Handle an "init_priority" attribute; arguments as in
struct attribute_spec.handler. */
static tree
-handle_init_priority_attribute (tree* node,
- tree name,
- tree args,
- int flags ATTRIBUTE_UNUSED ,
+handle_init_priority_attribute (tree* node,
+ tree name,
+ tree args,
+ int flags ATTRIBUTE_UNUSED ,
bool* no_add_attrs)
{
tree initp_expr = TREE_VALUE (args);
int pri;
STRIP_NOPS (initp_expr);
-
+
if (!initp_expr || TREE_CODE (initp_expr) != INTEGER_CST)
{
error ("requested init_priority is not an integer constant");
}
pri = TREE_INT_CST_LOW (initp_expr);
-
+
type = strip_array_types (type);
if (decl == NULL_TREE
first time control passes through that
function. This is not precise enough to pin down an
init_priority value, so don't allow it. */
- || current_function_decl)
+ || current_function_decl)
{
error ("can only use `%E' attribute on file-scope definitions "
"of objects of class type", name);
language and runtime support implementations.*/
if (pri <= MAX_RESERVED_INIT_PRIORITY)
{
- warning
+ warning
("requested init_priority is reserved for internal use");
}
new_type = build_type_attribute_variant (type, attributes);
if (TREE_CODE (new_type) == FUNCTION_TYPE
- && (TYPE_RAISES_EXCEPTIONS (new_type)
+ && (TYPE_RAISES_EXCEPTIONS (new_type)
!= TYPE_RAISES_EXCEPTIONS (type)))
new_type = build_exception_variant (new_type,
TYPE_RAISES_EXCEPTIONS (type));
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order
traversal. Called from walk_tree. */
-tree
+tree
cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
void *data, void *htab)
{
enum tree_code code = TREE_CODE (*tp);
location_t save_locus;
tree result;
-
+
#define WALK_SUBTREE(NODE) \
do \
{ \
{
/* Don't instantiate functions that are not going to be
inlined. */
- if (!DECL_INLINE (DECL_TEMPLATE_RESULT
+ if (!DECL_INLINE (DECL_TEMPLATE_RESULT
(template_for_substitution (fn))))
return 1;
/* FN body has been duplicated. Update language specific fields. */
void
-cp_update_decl_after_saving (tree fn,
+cp_update_decl_after_saving (tree fn,
void* decl_map_)
{
splay_tree decl_map = (splay_tree)decl_map_;
pointed to by DATA (which is really a `splay_tree *'). */
static tree
-mark_local_for_remap_r (tree* tp,
- int* walk_subtrees ATTRIBUTE_UNUSED ,
+mark_local_for_remap_r (tree* tp,
+ int* walk_subtrees ATTRIBUTE_UNUSED ,
void* data)
{
tree t = *tp;
splay_tree st = (splay_tree) data;
tree decl;
-
+
if (TREE_CODE (t) == DECL_EXPR
&& nonstatic_local_decl_p (DECL_EXPR_DECL (t)))
decl = DECL_EXPR_DECL (t);
tree copy;
/* Make a copy. */
- copy = copy_decl_for_inlining (decl,
- DECL_CONTEXT (decl),
+ copy = copy_decl_for_inlining (decl,
+ DECL_CONTEXT (decl),
DECL_CONTEXT (decl));
/* Remember the copy. */
splay_tree_insert (st,
- (splay_tree_key) decl,
+ (splay_tree_key) decl,
(splay_tree_value) copy);
}
remaps all local declarations to appropriate replacements. */
static tree
-cp_unsave_r (tree* tp,
- int* walk_subtrees,
+cp_unsave_r (tree* tp,
+ int* walk_subtrees,
void* data)
{
splay_tree st = (splay_tree) data;
{
/* Lookup the declaration. */
n = splay_tree_lookup (st, (splay_tree_key) *tp);
-
+
/* If it's there, remap it. */
if (n)
*tp = (tree) n->value;
break;
#endif
- case UNSAVE_EXPR:
- do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
- TREE_OPERAND (exp, 0)
- = lang_hooks.unsave_expr_now (TREE_OPERAND (exp, 0));
- break;
-
case NOP_EXPR:
if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
|| TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
return ret;
}
- case UNSAVE_EXPR:
- {
- rtx temp;
- temp = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
- TREE_OPERAND (exp, 0)
- = lang_hooks.unsave_expr_now (TREE_OPERAND (exp, 0));
- return temp;
- }
-
case GOTO_EXPR:
if (TREE_CODE (TREE_OPERAND (exp, 0)) == LABEL_DECL)
expand_goto (TREE_OPERAND (exp, 0));
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case SAVE_EXPR:
- case UNSAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case COMPOUND_EXPR:
+2004-07-28 Eric Christopher <echristo@redhat.com>
+
+ * lang.c (LANG_HOOKS_UNSAFE_FOR_REEVAL): Delete.
+ (java_unsafe_for_reeval): Ditto.
+
2004-07-26 <hp@bitrange.com>
* parse.y (build_super_invocation): Adjust declaration order to
(start_java_method): Reset uniq. Create base_decl_map. Set
function_binding_level.
(end_java_method): Null unused fields to save memory.
-
+
2004-07-20 Nathan Sidwell <nathan@codesourcery.com>
* class.c (add_interface_do): Remove.
(create_class): Fix comment typo.
(resolve_qualified_expression_name): Pass type of qualifier to
not_accessible_p, not the type in which target field was found.
- (not_accessible_p): Handle inner classes. Expand protected
- qualifier-subtype check to enclosing instances, but don't apply this
+ (not_accessible_p): Handle inner classes. Expand protected
+ qualifier-subtype check to enclosing instances, but don't apply this
check to static members. Allow protected access to inner classes
of a subtype. Allow private access within common enclosing context.
(build_super_invocation): Get WFL line number info from current
common_enclosing_instance_p.
* class.c (common_enclosing_context_p): New. Determine if types
share a common enclosing context, even across static contexts.
- (common_enclosing_instance_p): Renamed from
+ (common_enclosing_instance_p): Renamed from
common_enclosing_context_p. Determines if types share a common
non-static enclosing instance.
* java-tree.h (common_enclosing_instance_p): Declare.
* parse.y (create_interface): Set correct access modifiers for
interfaces.
* jcf-write.c (get_classfile_modifiers): New function.
- (generate_classfile): Use get_classfile_modifiers, not
+ (generate_classfile): Use get_classfile_modifiers, not
get_access_flags.
2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
- * parse.y (qualify_and_find): Pass type decl, not identifier, to
+ * parse.y (qualify_and_find): Pass type decl, not identifier, to
load_class.
2004-06-26 Bryce McKinlay <mckinlay@redhat.com>
2004-06-22 Andrew Haley <aph@redhat.com>
Ranjit Mathew <rmathew@hotmail.com>
-
+
Fixes PR java/16113.
* decl.c (force_poplevels): Remove call to expand_end_bindings.
(emit_init_test_initialization): Likewise.
* java-gimplify.c (java_gimplify_new_array_init): Likewise.
* parse.y (make_qualifed_name, build_array_ref): Likewise.
-
+
2004-06-21 Andrew Haley <aph@redhat.com>
* java-gimplify.c (java_gimplify_block): set TREE_USED on the new
do not set current_function_cannot_inline.
* resource.c (write_resource_constructor): Do not reset
flag_inline_functions around rest_of_compilation.
-
+
2004-06-08 Andrew Pinski <pinskia@physics.uc.edu>
PR java/15769
2004-05-28 Bryce McKinlay <mckinlay@redhat.com>
- * jcf-write.c (generate_bytecode_conditional): Handle binops
- UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR,
+ * jcf-write.c (generate_bytecode_conditional): Handle binops
+ UNLT_EXPR, UNLE_EXPR, UNGT_EXPR, UNGE_EXPR, UNEQ_EXPR,
and LTGT_EXPR.
(generate_bytecode_insns): Likewise.
Fix comment typo.
Use check_pkg_class_access() instead of not_accessible_p()
for unqualified types.
- (not_accessible_p): Use DECL_CONTEXT (member) instead of
+ (not_accessible_p): Use DECL_CONTEXT (member) instead of
REFERENCE for package-private access checking.
(patch_method_invocation): Use accessibility_string() instead
of java_accstring_lookup().
2004-04-19 Bryce McKinlay <mckinlay@redhat.com>
* class.c (make_class_data): Add new field aux_info.
- * decl.c (java_init_decl_processing): Push type and decl for
+ * decl.c (java_init_decl_processing): Push type and decl for
`aux_info'.
2004-04-15 Bryce McKinlay <mckinlay@redhat.com>
- * expr.c (expand_java_NEW): Don't use size argument for
+ * expr.c (expand_java_NEW): Don't use size argument for
_Jv_AllocObject calls.
* parse.y (patch_invoke): Likewise.
2004-04-12 Bryce McKinlay <mckinlay@redhat.com>
- * class.c (get_interface_method_index): New function. Return dispatch
+ * class.c (get_interface_method_index): New function. Return dispatch
index for interface method.
(make_method_value): For interface methods, set index field to
iface dispatch index, not DECL_VINDEX.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
+Boston, MA 02111-1307, USA.
Java and all Java-based marks are trademarks or registered trademarks
of Sun Microsystems, Inc. in the United States and other countries.
static void java_print_error_function (diagnostic_context *, const char *);
static tree java_tree_inlining_walk_subtrees (tree *, int *, walk_tree_fn,
void *, void *);
-static int java_unsafe_for_reeval (tree);
static int merge_init_test_initialization (void * *, void *);
static int inline_init_test_initialization (void * *, void *);
static bool java_can_use_bit_fields_p (void);
#define LANG_HOOKS_POST_OPTIONS java_post_options
#undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE java_parse_file
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL java_unsafe_for_reeval
#undef LANG_HOOKS_MARK_ADDRESSABLE
#define LANG_HOOKS_MARK_ADDRESSABLE java_mark_addressable
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
{
const char *name = lang_printable_name (current_function_decl, 2);
fprintf (stderr, "In %s `%s':\n",
- (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
+ (DECL_CONSTRUCTOR_P (current_function_decl) ? "constructor"
: "method"),
name);
}
#undef WALK_SUBTREE
}
-/* Called from unsafe_for_reeval. */
-static int
-java_unsafe_for_reeval (tree t)
-{
- switch (TREE_CODE (t))
- {
- case BLOCK:
- /* Our expander tries to expand the variables twice. Boom. */
- if (BLOCK_EXPR_DECLS (t) != NULL)
- return 2;
- return unsafe_for_reeval (BLOCK_EXPR_BODY (t));
-
- default:
- break;
- }
-
- return -1;
-}
-
/* Every call to a static constructor has an associated boolean
variable which is in the outermost scope of the calling method.
This variable is used to avoid multiple calls to the static
- constructor for each class.
+ constructor for each class.
It looks something like this:
foo ()
{
boolean dummy = OtherClass.is_initialized;
-
+
...
-
+
if (! dummy)
OtherClass.initialize();
splay_tree decl_map = (splay_tree)x;
splay_tree_node n;
tree *init_test_decl;
-
+
/* See if we have remapped this declaration. If we haven't there's
a bug in the inliner. */
n = splay_tree_lookup (decl_map, (splay_tree_key) ite->value);
if (!*init_test_decl)
*init_test_decl = (tree)n->value;
- /* This fixes a weird case.
+ /* This fixes a weird case.
The front end assumes that once we have called a method that
initializes some class, we can assume the class is initialized. It
does this by setting the DECL_INITIAL of the init_test_decl for that
class, and no initializations are emitted for that class.
-
+
However, what if the method that is suppoed to do the initialization
is itself inlined in the caller? When expanding the called method
we'll assume that the class initialization has already been done,
because the DECL_INITIAL of the init_test_decl is set.
-
+
To fix this we remove the DECL_INITIAL (in the caller scope) of all
the init_test_decls corresponding to classes initialized by the
inlined method. This makes the caller no longer assume that the
void
java_inlining_merge_static_initializers (tree fn, void *decl_map)
{
- htab_traverse
+ htab_traverse
(DECL_FUNCTION_INIT_TEST_TABLE (fn),
merge_init_test_initialization, decl_map);
}
{
struct treetreehash_entry *ite = (struct treetreehash_entry *) *entry;
splay_tree decl_map = (splay_tree)x;
-
- tree h = java_treetreehash_find
+
+ tree h = java_treetreehash_find
(DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl), ite->key);
if (! h)
return true;
void
java_inlining_map_static_initializers (tree fn, void *decl_map)
{
- htab_traverse
+ htab_traverse
(DECL_FUNCTION_INIT_TEST_TABLE (fn),
inline_init_test_initialization, decl_map);
}
}
}
}
-
+
static bool
java_dump_tree (void *dump_info, tree t)
{
dump_child ("var", local);
local = next;
}
-
+
{
tree block = BLOCK_EXPR_BODY (t);
dump_child ("body", block);
}
}
return true;
-
+
case COMPOUND_EXPR:
if (!dump_flag (di, TDF_SLIM, t))
return false;
return NULL;
table = TREE_OPERAND (method, 0);
if (! DECL_LANG_SPECIFIC(table)
- || !DECL_OWNER (table)
+ || !DECL_OWNER (table)
|| TYPE_ATABLE_DECL (DECL_OWNER (table)) != table)
return NULL;
atable_methods = TYPE_ATABLE_METHODS (DECL_OWNER (table));
index = TREE_INT_CST_LOW (TREE_OPERAND (method, 1));
-
+
/* FIXME: Replace this for loop with a hash table lookup. */
for (element = atable_methods; element; element = TREE_CHAIN (element))
{
extern tree lhd_do_nothing_iii_return_null_tree (int, int, int);
extern int lhd_safe_from_p (rtx, tree);
extern bool lhd_staticp (tree);
-extern int lhd_unsafe_for_reeval (tree);
extern void lhd_print_tree_nothing (FILE *, tree, int);
extern const char *lhd_decl_printable_name (tree, int);
extern int lhd_types_compatible_p (tree, tree);
#define LANG_HOOKS_EXPAND_DECL lhd_expand_decl
#define LANG_HOOKS_SAFE_FROM_P lhd_safe_from_p
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL lhd_unsafe_for_reeval
#define LANG_HOOKS_STATICP lhd_staticp
#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t
#define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now
LANG_HOOKS_TRUTHVALUE_CONVERSION, \
LANG_HOOKS_SAFE_FROM_P, \
LANG_HOOKS_FINISH_INCOMPLETE_DECL, \
- LANG_HOOKS_UNSAFE_FOR_REEVAL, \
LANG_HOOKS_MARK_ADDRESSABLE, \
LANG_HOOKS_STATICP, \
LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \
/* Do nothing (int, int, int). Return NULL_TREE. */
tree
-lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED (i),
+lhd_do_nothing_iii_return_null_tree (int ARG_UNUSED (i),
int ARG_UNUSED (j),
int ARG_UNUSED (k))
{
return 1;
}
-/* Called from unsafe_for_reeval. */
-
-int
-lhd_unsafe_for_reeval (tree ARG_UNUSED (t))
-{
- return -1;
-}
-
/* Called from staticp. */
bool
same as that used in the source language. (That's correct
for C, and GCC used to set DECL_ASSEMBLER_NAME to the same
value as DECL_NAME in build_decl, so this choice provides
- backwards compatibility with existing front-ends.
+ backwards compatibility with existing front-ends.
Can't use just the variable's own name for a variable whose
scope is less than the whole compilation. Concatenate a
/* Registration of machine- or os-specific builtin types. */
void
-lhd_register_builtin_type (tree ARG_UNUSED (type),
+lhd_register_builtin_type (tree ARG_UNUSED (type),
const char * ARG_UNUSED (name))
{
}
compilation. Default hook is does nothing. */
void (*finish_incomplete_decl) (tree);
- /* Function used by unsafe_for_reeval. A non-negative number is
- returned directly from unsafe_for_reeval, a negative number falls
- through. The default hook returns a negative number. */
- int (*unsafe_for_reeval) (tree);
-
/* Mark EXP saying that we need to be able to take the address of
it; it should not be allocated in a register. Return true if
successful. */
DECL_NODE with a newly GC-allocated copy. */
void (*dup_lang_specific_decl) (tree);
- /* Called before its argument, an UNSAVE_EXPR, is to be
- unsaved. Modify it in-place so that all the evaluate only once
+ /* Reset argument so that it can be expanded again.
+ Modify it in-place so that all the evaluate only once
things are cleared out. */
tree (*unsave_expr_now) (tree);
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
-#undef LANG_HOOKS_UNSAFE_FOR_REEVAL
-#define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval
#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
#undef LANG_HOOKS_STATICP
(splay_tree_value) value);
}
-/* Remap DECL during the copying of the BLOCK tree for the function.
+/* Remap DECL during the copying of the BLOCK tree for the function.
We are only called to remap local variables in the current function. */
static tree
insert_decl_map (id, type, type);
return type;
}
-
+
/* We do need a copy. build and register it now. If this is a pointer or
reference type, remap the designated type and make a new pointer or
reference type. */
if (t && TREE_CODE (t) != INTEGER_CST)
walk_tree (&TYPE_MAX_VALUE (new), copy_body_r, id, NULL);
return new;
-
+
case FUNCTION_TYPE:
TREE_TYPE (new) = remap_type (TREE_TYPE (new), id);
walk_tree (&TYPE_ARG_TYPES (new), copy_body_r, id, NULL);
copy_statement_list (tp);
else if (TREE_CODE (*tp) == SAVE_EXPR)
remap_save_expr (tp, id->decl_map, walk_subtrees);
- else if (TREE_CODE (*tp) == UNSAVE_EXPR)
- /* UNSAVE_EXPRs should not be generated until expansion time. */
- abort ();
else if (TREE_CODE (*tp) == BIND_EXPR)
copy_bind_expr (tp, walk_subtrees, id);
else if (TREE_CODE (*tp) == LABELED_BLOCK_EXPR)
return NULL;
switch (TREE_CODE (x))
- {
+ {
/* Containers have no cost. */
case TREE_LIST:
case TREE_VEC:
case NOP_EXPR:
case VIEW_CONVERT_EXPR:
case SAVE_EXPR:
- case UNSAVE_EXPR:
case ADDR_EXPR:
case COMPLEX_EXPR:
case EXIT_BLOCK_EXPR:
Note we need to save and restore the saved tree statement iterator
to avoid having it clobbered by expand_calls_inline. */
tree_stmt_iterator save_tsi;
-
+
save_tsi = id->tsi;
expand_calls_inline (&arg_inits, id);
id->tsi = save_tsi;
expand_calls_inline (tree *stmt_p, inline_data *id)
{
tree stmt = *stmt_p;
- enum tree_code code = TREE_CODE (stmt);
+ enum tree_code code = TREE_CODE (stmt);
int dummy;
switch (code)
if (TREE_CODE (*tp) == BIND_EXPR)
BIND_EXPR_BLOCK (*tp) = NULL_TREE;
}
-
+
else if (TREE_CODE_CLASS (code) == 't')
*walk_subtrees = 0;
else if (TREE_CODE_CLASS (code) == 'd')
/* Copy the decl and remember the copy. */
insert_decl_map (id, decl,
- copy_decl_for_inlining (decl, DECL_CONTEXT (decl),
+ copy_decl_for_inlining (decl, DECL_CONTEXT (decl),
DECL_CONTEXT (decl)));
}
{
/* Lookup the declaration. */
n = splay_tree_lookup (st, (splay_tree_key) *tp);
-
+
/* If it's there, remap it. */
if (n)
*tp = (tree) n->value;
{
tree_stmt_iterator si;
bool first = true;
-
+
if ((flags & TDF_SLIM) || !dumping_stmts)
{
pp_string (buffer, "<STATEMENT_LIST>");
pp_character (buffer, '>');
break;
- case UNSAVE_EXPR:
- pp_string (buffer, "UNSAVE_EXPR <");
- dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
- pp_character (buffer, '>');
- break;
-
case ENTRY_VALUE_EXPR:
NIY;
break;
for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
{
pp_string (buffer, "# ");
- dump_generic_node (buffer, V_MAY_DEF_RESULT (v_may_defs, i),
+ dump_generic_node (buffer, V_MAY_DEF_RESULT (v_may_defs, i),
spc + 2, flags, false);
pp_string (buffer, " = V_MAY_DEF <");
- dump_generic_node (buffer, V_MAY_DEF_OP (v_may_defs, i),
+ dump_generic_node (buffer, V_MAY_DEF_OP (v_may_defs, i),
spc + 2, flags, false);
pp_string (buffer, ">;");
newline_and_indent (buffer, spc);
if (bb_ann (bb))
dump_phi_nodes (buffer, bb, indent, flags);
-
+
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
int curr_indent;
tree t;
size_t length = (offsetof (struct tree_binfo, base_binfos)
+ VEC_embedded_size (tree, base_binfos));
-
+
#ifdef GATHER_STATISTICS
tree_node_counts[(int) binfo_kind]++;
tree_node_sizes[(int) binfo_kind] += length;
memset (t, 0, offsetof (struct tree_binfo, base_binfos));
TREE_SET_CODE (t, TREE_BINFO);
-
+
VEC_embedded_init (tree, BINFO_BASE_BINFOS (t), base_binfos);
return t;
case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR:
case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR:
- case CLEANUP_POINT_EXPR: case UNSAVE_EXPR:
+ case CLEANUP_POINT_EXPR:
/* These don't change the alignment of an object. */
return expr_align (TREE_OPERAND (t, 0));
return true;
case COMPONENT_REF:
- /* If the thing being referenced is not a field, then it is
+ /* If the thing being referenced is not a field, then it is
something language specific. */
if (TREE_CODE (TREE_OPERAND (arg, 1)) != FIELD_DECL)
return (*lang_hooks.staticp) (arg);
return inner;
}
-/* Arrange for an expression to be expanded multiple independent
- times. This is useful for cleanup actions, as the backend can
- expand them multiple times in different places. */
-
-tree
-unsave_expr (tree expr)
-{
- tree t;
-
- /* If this is already protected, no sense in protecting it again. */
- if (TREE_CODE (expr) == UNSAVE_EXPR)
- return expr;
-
- t = build1 (UNSAVE_EXPR, TREE_TYPE (expr), expr);
- TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (expr);
- return t;
-}
-
/* Returns the index of the first non-tree operand for CODE, or the number
of operands if all are trees. */
break;
}
}
-
-/* Return 0 if it is safe to evaluate EXPR multiple times,
- return 1 if it is safe if EXPR is unsaved afterward, or
- return 2 if it is completely unsafe.
-
- This assumes that CALL_EXPRs and TARGET_EXPRs are never replicated in
- an expression tree, so that it safe to unsave them and the surrounding
- context will be correct.
-
- SAVE_EXPRs basically *only* appear replicated in an expression tree,
- occasionally across the whole of a function. It is therefore only
- safe to unsave a SAVE_EXPR if you know that all occurrences appear
- below the UNSAVE_EXPR. */
-
-int
-unsafe_for_reeval (tree expr)
-{
- int unsafeness = 0;
- enum tree_code code;
- int i, tmp, tmp2;
- tree exp;
- int first_rtl;
-
- if (expr == NULL_TREE)
- return 1;
-
- code = TREE_CODE (expr);
- first_rtl = first_rtl_op (code);
-
- switch (code)
- {
- case SAVE_EXPR:
- return 2;
-
- /* A label can only be emitted once. */
- case LABEL_EXPR:
- return 1;
-
- case BIND_EXPR:
- unsafeness = 1;
- break;
-
- case TREE_LIST:
- for (exp = expr; exp != 0; exp = TREE_CHAIN (exp))
- {
- tmp = unsafe_for_reeval (TREE_VALUE (exp));
- unsafeness = MAX (tmp, unsafeness);
- }
-
- return unsafeness;
-
- case CALL_EXPR:
- tmp2 = unsafe_for_reeval (TREE_OPERAND (expr, 0));
- tmp = unsafe_for_reeval (TREE_OPERAND (expr, 1));
- return MAX (MAX (tmp, 1), tmp2);
-
- case TARGET_EXPR:
- unsafeness = 1;
- break;
-
- case EXIT_BLOCK_EXPR:
- /* EXIT_BLOCK_LABELED_BLOCK, a.k.a. TREE_OPERAND (expr, 0), holds
- a reference to an ancestor LABELED_BLOCK, so we need to avoid
- unbounded recursion in the 'e' traversal code below. */
- exp = EXIT_BLOCK_RETURN (expr);
- return exp ? unsafe_for_reeval (exp) : 0;
-
- default:
- tmp = lang_hooks.unsafe_for_reeval (expr);
- if (tmp >= 0)
- return tmp;
- break;
- }
-
- switch (TREE_CODE_CLASS (code))
- {
- case 'c': /* a constant */
- case 't': /* a type node */
- case 'x': /* something random, like an identifier or an ERROR_MARK. */
- case 'd': /* A decl node */
- return 0;
-
- case 'e': /* an expression */
- case 'r': /* a reference */
- case 's': /* an expression with side effects */
- case '<': /* a comparison expression */
- case '2': /* a binary arithmetic expression */
- case '1': /* a unary arithmetic expression */
- for (i = first_rtl - 1; i >= 0; i--)
- {
- tmp = unsafe_for_reeval (TREE_OPERAND (expr, i));
- unsafeness = MAX (tmp, unsafeness);
- }
-
- return unsafeness;
-
- default:
- return 2;
- }
-}
\f
/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
or offset that depends on a field within a record. */
else if (TREE_CODE (node) == BIT_FIELD_REF)
UPDATE_TITCSE (TREE_OPERAND (node, 2));
}
-
+
/* Now see what's inside. If it's an INDIRECT_REF, copy our properties from
it. If it's a decl, it's invariant and constant if the decl is static.
It's also invariant if it's a decl in the current function. (Taking the
Constants, decls, types and misc nodes cannot be.
We define 5 non-variadic functions, from 0 to 4 arguments. This is
- enough for all extant tree codes. These functions can be called
+ enough for all extant tree codes. These functions can be called
directly (preferably!), but can also be obtained via GCC preprocessor
magic within the build macro. */
TREE_READONLY (t) = read_only;
TREE_CONSTANT (t) = constant;
TREE_INVARIANT (t) = invariant;
- TREE_SIDE_EFFECTS (t) = side_effects;
+ TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
= TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
}
}
- TREE_SIDE_EFFECTS (t) = side_effects;
+ TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
= TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
PROCESS_ARG(2);
PROCESS_ARG(3);
- TREE_SIDE_EFFECTS (t) = side_effects;
+ TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
= TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
layout_decl (t, 0);
else if (code == FUNCTION_DECL)
DECL_MODE (t) = FUNCTION_MODE;
-
+
/* Set default visibility to whatever the user supplied with
visibility_specified depending on #pragma GCC visibility. */
DECL_VISIBILITY (t) = default_visibility;
&& TREE_CODE (TYPE_ARG_TYPES (b->type)) == TREE_LIST
&& type_list_equal (TYPE_ARG_TYPES (a->type),
TYPE_ARG_TYPES (b->type)))));
-
+
case ARRAY_TYPE:
case SET_TYPE:
return TYPE_DOMAIN (a->type) == TYPE_DOMAIN (b->type);
TREE_STRING_LENGTH (t1)));
case CONSTRUCTOR:
- return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1),
+ return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1),
CONSTRUCTOR_ELTS (t2));
case SAVE_EXPR:
if (TREE_CODE (type) != FUNCTION_TYPE)
abort ();
- return build_method_type_directly (basetype,
+ return build_method_type_directly (basetype,
TREE_TYPE (type),
TYPE_ARG_TYPES (type));
}
case UNION_TYPE:
case QUAL_UNION_TYPE:
return context;
-
+
case TYPE_DECL:
case FUNCTION_DECL:
context = DECL_CONTEXT (context);
break;
-
+
case BLOCK:
context = BLOCK_SUPERCONTEXT (context);
break;
-
+
default:
abort ();
}
if (TREE_CODE (addr) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL)
return TREE_OPERAND (addr, 0);
-
+
/* We couldn't figure out what was being called. Maybe the front
end has some idea. */
return lang_hooks.lang_get_callee_fndecl (call);
{
unsigned value = *string << 24;
unsigned ix;
-
+
for (ix = 8; ix--; value <<= 1)
{
unsigned feedback;
-
+
feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0;
chksum <<= 1;
chksum ^= feedback;
length += strlen (tree_code_name[code]);
}
va_end (args);
-
+
internal_error ("tree check: expected %s, have %s in %s, at %s:%d",
buffer, tree_code_name[TREE_CODE (node)],
function, trim_filename (file), line);
length += strlen (tree_code_name[code]);
}
va_end (args);
-
+
internal_error ("tree check: expected none of %s, have %s in %s, at %s:%d",
buffer, tree_code_name[TREE_CODE (node)],
function, trim_filename (file), line);
unsigned_intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 1);
unsigned_intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 1);
unsigned_intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 1);
-
+
access_public_node = get_identifier ("public");
access_protected_node = get_identifier ("protected");
access_private_node = get_identifier ("private");
{
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
outer = build_method_type_directly (TYPE_METHOD_BASETYPE (type),
- inner,
+ inner,
TYPE_ARG_TYPES (type));
}
else
if (TREE_CODE (idx) != INTEGER_CST)
return false;
-
+
min = array_ref_low_bound (ref);
max = array_ref_up_bound (ref);
if (!min
return false;
if (!lang_hooks.types_compatible_p (TREE_TYPE (f1), TREE_TYPE (f2)))
- return false;
+ return false;
return true;
}
/* Returns the greatest common divisor of A and B, which must be
INTEGER_CSTs. */
-tree
+tree
tree_fold_gcd (tree a, tree b)
{
tree a_mod_b;
tree type = TREE_TYPE (a);
-
+
#if defined ENABLE_CHECKING
if (TREE_CODE (a) != INTEGER_CST
|| TREE_CODE (b) != INTEGER_CST)
abort ();
#endif
-
- if (integer_zerop (a))
+
+ if (integer_zerop (a))
return b;
-
- if (integer_zerop (b))
+
+ if (integer_zerop (b))
return a;
-
+
if (tree_int_cst_sgn (a) == -1)
a = fold (build2 (MULT_EXPR, type, a,
convert (type, integer_minus_one_node)));
-
+
if (tree_int_cst_sgn (b) == -1)
b = fold (build2 (MULT_EXPR, type, b,
convert (type, integer_minus_one_node)));
-
+
while (1)
{
a_mod_b = fold (build2 (CEIL_MOD_EXPR, type, a, b));
-
+
if (!TREE_INT_CST_LOW (a_mod_b)
&& !TREE_INT_CST_HIGH (a_mod_b))
return b;
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-
+
/* The third argument can be:
'x' for an exceptional code (fits no category).
't' for a type object code.
outermost scope of a particular inlining of a function).
BLOCK_ABSTRACT is nonzero if the block represents an abstract
instance of a block (i.e. one which is nested within an abstract
- instance of an inline function).
+ instance of an inline function).
TREE_ASM_WRITTEN is nonzero if the block was actually referenced
in the generated assembly. */
DEFTREECODE (BLOCK, "block", 'x', 0)
DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0)
/* Contents are in TREE_VECTOR_CST_ELTS field. */
-DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0)
+DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0)
/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */
DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
The field can be either a signed or unsigned field;
BIT_FIELD_REF_UNSIGNED says which. */
DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", 'r', 3)
-
+
/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */
DEFTREECODE (INDIRECT_REF, "indirect_ref", 'r', 1)
/* Declare local variables, including making RTL and allocating space.
BIND_EXPR_VARS is a chain of VAR_DECL nodes for the variables.
- BIND_EXPR_BODY is the body, the expression to be computed using
+ BIND_EXPR_BODY is the body, the expression to be computed using
the variables. The value of operand 1 becomes that of the BIND_EXPR.
BIND_EXPR_BLOCK is the BLOCK that corresponds to these bindings
for debugging purposes. If this BIND_EXPR is actually expanded,
The BIND_EXPR is not responsible for informing parsers
about these variables. If the body is coming from the input file,
- then the code that creates the BIND_EXPR is also responsible for
+ then the code that creates the BIND_EXPR is also responsible for
informing the parser of the variables.
If the BIND_EXPR is ever expanded, its TREE_USED flag is set.
This tells the code for debugging symbol tables not to ignore the BIND_EXPR.
- If the BIND_EXPR should be output for debugging but will not be expanded,
+ If the BIND_EXPR should be output for debugging but will not be expanded,
set the TREE_USED flag by hand.
In order for the BIND_EXPR to be known at all, the code that creates it
will be replaced by the temporary variable that holds the value. */
DEFTREECODE (SAVE_EXPR, "save_expr", 'e', 1)
-/* For a UNSAVE_EXPR, operand 0 is the value to unsave. By unsave, we
- mean that all _EXPRs such as TARGET_EXPRs, SAVE_EXPRs, CALL_EXPRs,
- that are protected from being evaluated more than once should be
- reset so that a new expand_expr call of this expr will cause those
- to be re-evaluated. This is useful when we want to reuse a tree in
- different places, but where we must re-expand. */
-DEFTREECODE (UNSAVE_EXPR, "unsave_expr", 'e', 1)
-
/* & in C. Value is the address at which the operand's value resides.
Operand may have any mode. Result mode is Pmode. */
DEFTREECODE (ADDR_EXPR, "addr_expr", 'e', 1)
of type EPmode. Used only for languages that need static chains. */
DEFTREECODE (ENTRY_VALUE_EXPR, "entry_value_expr", 'e', 1)
-/* Operand0 is a function constant; result is part N of a function
+/* Operand0 is a function constant; result is part N of a function
descriptor of type ptr_mode. */
DEFTREECODE (FDESC_EXPR, "fdesc_expr", 'e', 2)
label. CASE_LABEL is the corresponding LABEL_DECL. */
DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", 's', 3)
-/* RESX. Resume execution after an exception. Operand 0 is a
+/* RESX. Resume execution after an exception. Operand 0 is a
number indicating the exception region that is being left. */
DEFTREECODE (RESX_EXPR, "resx_expr", 's', 1)
enum tree_node_structure_enum tree_node_structure (tree);
-/* unsave_expr (EXP) returns an expression equivalent to EXP but it
- can be used multiple times and will evaluate EXP in its entirety
- each time. */
-
-extern tree unsave_expr (tree);
-
/* Reset EXP in place so that it can be expanded again. Does not
recurse into subtrees. */
extern void unsave_expr_1 (tree);
-/* Return 0 if it is safe to evaluate EXPR multiple times,
- return 1 if it is safe if EXPR is unsaved afterward, or
- return 2 if it is completely unsafe. */
-extern int unsafe_for_reeval (tree);
-
/* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size
or offset that depends on a field within a record.