tree-cfg.c (verify_expr): Check with is_gimple_address.
2008-04-23 Paolo Bonzini <bonzini@gnu.org> * tree-cfg.c (verify_expr): Check with is_gimple_address. Don't check TREE_INVARIANT. * tree-gimple.c (is_gimple_address): New. (is_gimple_invariant_address): Simplify using decl_address_invariant_p. * tree-gimple.h (is_gimple_address): New. * tree.h (decl_address_invariant_p): New. * tree.c (make_node_stat): Don't set TREE_INVARIANT. (build_string): Likewise. (decl_address_invariant_p): New, from is_gimple_invariant_address. (tree_invariant_p_1): Likewise. (save_expr): Use it. (tree_invariant_p): New. (skip_simple_arithmetic): Use it. (stabilize_reference_1): Use it. (recompute_tree_invariant_for_addr_expr): Don't update TREE_INVARIANT, simplify. (build1_stat): Drop code to compute TREE_INVARIANT. (build2_stat): Drop code to compute TREE_INVARIANT. (build3_stat): Drop code to compute TREE_INVARIANT. (build4_stat): Drop code to compute TREE_INVARIANT. (build5_stat): Drop code to compute TREE_INVARIANT. (build7_stat): Drop code to compute TREE_INVARIANT. (merge_dllimport_decl_attributes): Don't mention TREE_INVARIANT. * tree.h (struct tree_base): Remove invariant_flag. (TREE_INVARIANT): Remove. * builtins.c (build_string_literal): Don't set TREE_INVARIANT. (fold_builtin_expect): Check TREE_CONSTANT. * tree-ssa-ccp.c (fold_stmt_r): Adjust comment. * c-tree.h (c_expr_to_decl): Drop third parameter. * c-typeck.c (build_external_ref): Don't set TREE_INVARIANT. (build_c_cast): Don't set TREE_INVARIANT. (pop_init_level): Don't set TREE_INVARIANT. (c_objc_common_truthvalue_conversion): Don't set TREE_INVARIANT. * gimplify.c (gimplify_init_ctor_preeval): Add assertion, test TREE_CONSTANT. (gimplify_init_constructor): Don't set TREE_INVARIANT. (gimplify_addr_expr): Adjust comment. * tree-mudflap.c (mf_build_string): * print-tree.c (print_node): Don't print TREE_INVARIANT. * tree-nested.c (convert_nonlocal_reference): Adjust comment. * c-common.c (fix_string_type): Don't set TREE_INVARIANT. * langhooks-def.h (lhd_expr_to_decl): Drop third parameter. * langhooks.c (lhd_expr_to_decl): Drop third parameter. * langhooks.h (struct lang_hooks): Drop third parameter from expr_to_decl. java: 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * class.c (build_utf8_ref): Don't set TREE_INVARIANT. (build_classdollar_field): Don't set TREE_INVARIANT. (get_dispatch_table): Don't set TREE_INVARIANT. (make_class_data): Don't set TREE_INVARIANT. (build_symbol_entry): Don't set TREE_INVARIANT. (emit_symbol_table): Don't set TREE_INVARIANT. * constants.c (build_constant_data_ref): Don't set TREE_INVARIANT. (build_ref_from_constant_pool): Don't set TREE_INVARIANT. * resource.c (compile_resource_data): Don't set TREE_INVARIANT. * expr.c (cache_cpool_data_ref): Don't set TREE_INVARIANT. objc: 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * objc-act.c (objc_build_string_object): Don't set TREE_INVARIANT. cp: 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * typeck.c (get_member_function_from_ptrfunc): Don't set TREE_INVARIANT. (build_ptrmemfunc1): Don't set TREE_INVARIANT. * init.c (build_zero_init): Don't set TREE_INVARIANT. * class.c (build_base_path): Don't set TREE_INVARIANT. (build_vtbl_ref_1): Don't set TREE_INVARIANT. (build_vtbl_initializer): Don't set TREE_INVARIANT. * decl.c (build_enumerator): Don't set TREE_INVARIANT. * rtti.c (tinfo_base_init): Don't set TREE_INVARIANT. (generic_initializer): Don't set TREE_INVARIANT. (ptr_initializer): Don't set TREE_INVARIANT. (ptm_initializer): Don't set TREE_INVARIANT. (class_initializer): Don't set TREE_INVARIANT. * typeck2.c (process_init_constructor): Don't set TREE_INVARIANT. * pt.c (push_inline_template_parms_recursive): Don't set TREE_INVARIANT. (build_template_parm_index): Don't set TREE_INVARIANT. (reduce_template_parm_level): Don't set TREE_INVARIANT. (process_template_parm): Don't set TREE_INVARIANT. ada: 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * trans.c (Attribute_to_gnu): Don't set TREE_INVARIANT. (call_to_gnu): Don't set TREE_INVARIANT. * utils2.c (gnat_build_constructor): Don't set TREE_INVARIANT. fortran: 2008-04-23 Paolo Bonzini <bonzini@gnu.org> * trans-expr.c (gfc_conv_structure): Don't set TREE_INVARIANT. * trans-array.c (gfc_build_null_descriptor): Don't set TREE_INVARIANT. (gfc_trans_array_constructor_value): Don't set TREE_INVARIANT. (gfc_build_constant_array_constructor): Don't set TREE_INVARIANT. (gfc_conv_array_initializer): Don't set TREE_INVARIANT. * trans-common.c (get_init_field): Don't set TREE_INVARIANT. (create_common): Don't set TREE_INVARIANT. * trans-stmt.c (gfc_trans_character_select): Don't set TREE_INVARIANT. * trans-decl.c (gfc_generate_function_code): Don't set TREE_INVARIANT. From-SVN: r134599
This commit is contained in:
parent
17d2c090a1
commit
51eed2800d
|
@ -1,3 +1,51 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* tree-cfg.c (verify_expr): Check with is_gimple_address. Don't
|
||||
check TREE_INVARIANT.
|
||||
* tree-gimple.c (is_gimple_address): New.
|
||||
(is_gimple_invariant_address): Simplify using decl_address_invariant_p.
|
||||
* tree-gimple.h (is_gimple_address): New.
|
||||
* tree.h (decl_address_invariant_p): New.
|
||||
* tree.c (make_node_stat): Don't set TREE_INVARIANT.
|
||||
(build_string): Likewise.
|
||||
(decl_address_invariant_p): New, from is_gimple_invariant_address.
|
||||
(tree_invariant_p_1): Likewise.
|
||||
(save_expr): Use it.
|
||||
(tree_invariant_p): New.
|
||||
(skip_simple_arithmetic): Use it.
|
||||
(stabilize_reference_1): Use it.
|
||||
(recompute_tree_invariant_for_addr_expr): Don't update TREE_INVARIANT,
|
||||
simplify.
|
||||
(build1_stat): Drop code to compute TREE_INVARIANT.
|
||||
(build2_stat): Drop code to compute TREE_INVARIANT.
|
||||
(build3_stat): Drop code to compute TREE_INVARIANT.
|
||||
(build4_stat): Drop code to compute TREE_INVARIANT.
|
||||
(build5_stat): Drop code to compute TREE_INVARIANT.
|
||||
(build7_stat): Drop code to compute TREE_INVARIANT.
|
||||
(merge_dllimport_decl_attributes): Don't mention TREE_INVARIANT.
|
||||
* tree.h (struct tree_base): Remove invariant_flag.
|
||||
(TREE_INVARIANT): Remove.
|
||||
* builtins.c (build_string_literal): Don't set TREE_INVARIANT.
|
||||
(fold_builtin_expect): Check TREE_CONSTANT.
|
||||
* tree-ssa-ccp.c (fold_stmt_r): Adjust comment.
|
||||
* c-tree.h (c_expr_to_decl): Drop third parameter.
|
||||
* c-typeck.c (build_external_ref): Don't set TREE_INVARIANT.
|
||||
(build_c_cast): Don't set TREE_INVARIANT.
|
||||
(pop_init_level): Don't set TREE_INVARIANT.
|
||||
(c_objc_common_truthvalue_conversion): Don't set TREE_INVARIANT.
|
||||
* gimplify.c (gimplify_init_ctor_preeval): Add assertion, test
|
||||
TREE_CONSTANT.
|
||||
(gimplify_init_constructor): Don't set TREE_INVARIANT.
|
||||
(gimplify_addr_expr): Adjust comment.
|
||||
* tree-mudflap.c (mf_build_string):
|
||||
* print-tree.c (print_node): Don't print TREE_INVARIANT.
|
||||
* tree-nested.c (convert_nonlocal_reference): Adjust comment.
|
||||
* c-common.c (fix_string_type): Don't set TREE_INVARIANT.
|
||||
* langhooks-def.h (lhd_expr_to_decl): Drop third parameter.
|
||||
* langhooks.c (lhd_expr_to_decl): Drop third parameter.
|
||||
* langhooks.h (struct lang_hooks): Drop third parameter from
|
||||
expr_to_decl.
|
||||
|
||||
2008-04-23 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/27799
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* trans.c (Attribute_to_gnu): Don't set TREE_INVARIANT.
|
||||
(call_to_gnu): Don't set TREE_INVARIANT.
|
||||
* utils2.c (gnat_build_constructor): Don't set TREE_INVARIANT.
|
||||
|
||||
2008-04-22 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* s-osinte-rtems.adb: Add sigalstack function.
|
||||
|
|
|
@ -886,7 +886,6 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
|
|||
t = build2 (FDESC_EXPR, TREE_TYPE (gnu_field), gnu_prefix,
|
||||
build_int_cst (NULL_TREE, i));
|
||||
TREE_CONSTANT (t) = 1;
|
||||
TREE_INVARIANT (t) = 1;
|
||||
}
|
||||
else
|
||||
t = build3 (COMPONENT_REF, ptr_void_ftype, gnu_result,
|
||||
|
@ -1280,7 +1279,6 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
|
|||
gnu_result
|
||||
= build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result);
|
||||
TREE_SIDE_EFFECTS (gnu_result) = 1;
|
||||
TREE_INVARIANT (gnu_result) = 1;
|
||||
if (attribute == Attr_First)
|
||||
pa->first = gnu_result;
|
||||
else if (attribute == Attr_Last)
|
||||
|
@ -2220,7 +2218,6 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
|
|||
used as the object and copied back after the call if needed. */
|
||||
gnu_name = build1 (SAVE_EXPR, TREE_TYPE (gnu_name), gnu_name);
|
||||
TREE_SIDE_EFFECTS (gnu_name) = 1;
|
||||
TREE_INVARIANT (gnu_name) = 1;
|
||||
|
||||
/* Set up to move the copy back to the original. */
|
||||
if (Ekind (gnat_formal) != E_In_Parameter)
|
||||
|
|
|
@ -1671,8 +1671,7 @@ gnat_build_constructor (tree type, tree list)
|
|||
}
|
||||
|
||||
result = build_constructor_from_list (type, list);
|
||||
TREE_CONSTANT (result) = TREE_INVARIANT (result)
|
||||
= TREE_STATIC (result) = allconstant;
|
||||
TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant;
|
||||
TREE_SIDE_EFFECTS (result) = side_effects;
|
||||
TREE_READONLY (result) = TYPE_READONLY (type) || allconstant;
|
||||
return result;
|
||||
|
|
|
@ -5236,7 +5236,6 @@ build_string_literal (int len, const char *str)
|
|||
type = build_array_type (elem, index);
|
||||
TREE_TYPE (t) = type;
|
||||
TREE_CONSTANT (t) = 1;
|
||||
TREE_INVARIANT (t) = 1;
|
||||
TREE_READONLY (t) = 1;
|
||||
TREE_STATIC (t) = 1;
|
||||
|
||||
|
@ -7150,7 +7149,7 @@ fold_builtin_expect (tree arg0, tree arg1)
|
|||
}
|
||||
|
||||
/* If the argument isn't invariant then there's nothing else we can do. */
|
||||
if (!TREE_INVARIANT (arg0))
|
||||
if (!TREE_CONSTANT (arg0))
|
||||
return NULL_TREE;
|
||||
|
||||
/* If we expect that a comparison against the argument will fold to
|
||||
|
|
|
@ -944,7 +944,6 @@ fix_string_type (tree value)
|
|||
|
||||
TREE_TYPE (value) = a_type;
|
||||
TREE_CONSTANT (value) = 1;
|
||||
TREE_INVARIANT (value) = 1;
|
||||
TREE_READONLY (value) = 1;
|
||||
TREE_STATIC (value) = 1;
|
||||
return value;
|
||||
|
|
|
@ -593,7 +593,7 @@ extern tree c_finish_goto_label (tree);
|
|||
extern tree c_finish_goto_ptr (tree);
|
||||
extern void c_begin_vm_scope (unsigned int);
|
||||
extern void c_end_vm_scope (unsigned int);
|
||||
extern tree c_expr_to_decl (tree, bool *, bool *, bool *);
|
||||
extern tree c_expr_to_decl (tree, bool *, bool *);
|
||||
extern tree c_begin_omp_parallel (void);
|
||||
extern tree c_finish_omp_parallel (tree, tree);
|
||||
extern tree c_finish_omp_clauses (tree);
|
||||
|
|
|
@ -2213,7 +2213,6 @@ build_external_ref (tree id, int fun, location_t loc)
|
|||
used_types_insert (TREE_TYPE (ref));
|
||||
ref = DECL_INITIAL (ref);
|
||||
TREE_CONSTANT (ref) = 1;
|
||||
TREE_INVARIANT (ref) = 1;
|
||||
}
|
||||
else if (current_function_decl != 0
|
||||
&& !DECL_FILE_SCOPE_P (current_function_decl)
|
||||
|
@ -3643,7 +3642,6 @@ build_c_cast (tree type, tree expr)
|
|||
build_constructor_single (type, field, value),
|
||||
true, 0);
|
||||
TREE_CONSTANT (t) = TREE_CONSTANT (value);
|
||||
TREE_INVARIANT (t) = TREE_INVARIANT (value);
|
||||
return t;
|
||||
}
|
||||
error ("cast to union type from type not present in union");
|
||||
|
@ -5608,7 +5606,7 @@ pop_init_level (int implicit)
|
|||
ret.value = build_constructor (constructor_type,
|
||||
constructor_elements);
|
||||
if (constructor_constant)
|
||||
TREE_CONSTANT (ret.value) = TREE_INVARIANT (ret.value) = 1;
|
||||
TREE_CONSTANT (ret.value) = 1;
|
||||
if (constructor_constant && constructor_simple)
|
||||
TREE_STATIC (ret.value) = 1;
|
||||
}
|
||||
|
@ -8655,8 +8653,7 @@ c_objc_common_truthvalue_conversion (tree expr)
|
|||
required. */
|
||||
|
||||
tree
|
||||
c_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED,
|
||||
bool *ti ATTRIBUTE_UNUSED, bool *se)
|
||||
c_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED, bool *se)
|
||||
{
|
||||
if (TREE_CODE (expr) == COMPOUND_LITERAL_EXPR)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,23 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* typeck.c (get_member_function_from_ptrfunc): Don't set TREE_INVARIANT.
|
||||
(build_ptrmemfunc1): Don't set TREE_INVARIANT.
|
||||
* init.c (build_zero_init): Don't set TREE_INVARIANT.
|
||||
* class.c (build_base_path): Don't set TREE_INVARIANT.
|
||||
(build_vtbl_ref_1): Don't set TREE_INVARIANT.
|
||||
(build_vtbl_initializer): Don't set TREE_INVARIANT.
|
||||
* decl.c (build_enumerator): Don't set TREE_INVARIANT.
|
||||
* rtti.c (tinfo_base_init): Don't set TREE_INVARIANT.
|
||||
(generic_initializer): Don't set TREE_INVARIANT.
|
||||
(ptr_initializer): Don't set TREE_INVARIANT.
|
||||
(ptm_initializer): Don't set TREE_INVARIANT.
|
||||
(class_initializer): Don't set TREE_INVARIANT.
|
||||
* typeck2.c (process_init_constructor): Don't set TREE_INVARIANT.
|
||||
* pt.c (push_inline_template_parms_recursive): Don't set TREE_INVARIANT.
|
||||
(build_template_parm_index): Don't set TREE_INVARIANT.
|
||||
(reduce_template_parm_level): Don't set TREE_INVARIANT.
|
||||
(process_template_parm): Don't set TREE_INVARIANT.
|
||||
|
||||
2008-04-22 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/35316
|
||||
|
|
|
@ -385,7 +385,6 @@ build_base_path (enum tree_code code,
|
|||
v_offset);
|
||||
v_offset = cp_build_indirect_ref (v_offset, NULL, tf_warning_or_error);
|
||||
TREE_CONSTANT (v_offset) = 1;
|
||||
TREE_INVARIANT (v_offset) = 1;
|
||||
|
||||
offset = convert_to_integer (ptrdiff_type_node,
|
||||
size_diffop (offset,
|
||||
|
@ -630,7 +629,6 @@ build_vtbl_ref_1 (tree instance, tree idx)
|
|||
|
||||
aref = build_array_ref (vtbl, idx);
|
||||
TREE_CONSTANT (aref) |= TREE_CONSTANT (vtbl) && TREE_CONSTANT (idx);
|
||||
TREE_INVARIANT (aref) = TREE_CONSTANT (aref);
|
||||
|
||||
return aref;
|
||||
}
|
||||
|
@ -7450,7 +7448,6 @@ build_vtbl_initializer (tree binfo,
|
|||
TREE_OPERAND (init, 0),
|
||||
build_int_cst (NULL_TREE, i));
|
||||
TREE_CONSTANT (fdesc) = 1;
|
||||
TREE_INVARIANT (fdesc) = 1;
|
||||
|
||||
vfun_inits = tree_cons (NULL_TREE, fdesc, vfun_inits);
|
||||
}
|
||||
|
|
|
@ -10967,7 +10967,6 @@ build_enumerator (tree name, tree value, tree enumtype)
|
|||
|
||||
DECL_CONTEXT (decl) = FROB_CONTEXT (context);
|
||||
TREE_CONSTANT (decl) = 1;
|
||||
TREE_INVARIANT (decl) = 1;
|
||||
TREE_READONLY (decl) = 1;
|
||||
DECL_INITIAL (decl) = value;
|
||||
|
||||
|
|
|
@ -261,10 +261,7 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
|
|||
|
||||
/* In all cases, the initializer is a constant. */
|
||||
if (init)
|
||||
{
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
}
|
||||
TREE_CONSTANT (init) = 1;
|
||||
|
||||
return init;
|
||||
}
|
||||
|
|
|
@ -384,7 +384,6 @@ push_inline_template_parms_recursive (tree parmlist, int levels)
|
|||
TREE_TYPE (parm));
|
||||
DECL_ARTIFICIAL (decl) = 1;
|
||||
TREE_CONSTANT (decl) = 1;
|
||||
TREE_INVARIANT (decl) = 1;
|
||||
TREE_READONLY (decl) = 1;
|
||||
DECL_INITIAL (decl) = DECL_INITIAL (parm);
|
||||
SET_DECL_TEMPLATE_PARM_P (decl);
|
||||
|
@ -2870,7 +2869,6 @@ build_template_parm_index (int index,
|
|||
TEMPLATE_PARM_DECL (t) = decl;
|
||||
TREE_TYPE (t) = type;
|
||||
TREE_CONSTANT (t) = TREE_CONSTANT (decl);
|
||||
TREE_INVARIANT (t) = TREE_INVARIANT (decl);
|
||||
TREE_READONLY (t) = TREE_READONLY (decl);
|
||||
|
||||
return t;
|
||||
|
@ -2923,7 +2921,6 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args,
|
|||
|
||||
decl = build_decl (TREE_CODE (orig_decl), DECL_NAME (orig_decl), type);
|
||||
TREE_CONSTANT (decl) = TREE_CONSTANT (orig_decl);
|
||||
TREE_INVARIANT (decl) = TREE_INVARIANT (orig_decl);
|
||||
TREE_READONLY (decl) = TREE_READONLY (orig_decl);
|
||||
DECL_ARTIFICIAL (decl) = 1;
|
||||
SET_DECL_TEMPLATE_PARM_P (decl);
|
||||
|
@ -3020,11 +3017,9 @@ process_template_parm (tree list, tree parm, bool is_non_type,
|
|||
|
||||
/* A template parameter is not modifiable. */
|
||||
TREE_CONSTANT (parm) = 1;
|
||||
TREE_INVARIANT (parm) = 1;
|
||||
TREE_READONLY (parm) = 1;
|
||||
decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
|
||||
TREE_CONSTANT (decl) = 1;
|
||||
TREE_INVARIANT (decl) = 1;
|
||||
TREE_READONLY (decl) = 1;
|
||||
DECL_INITIAL (parm) = DECL_INITIAL (decl)
|
||||
= build_template_parm_index (idx, processing_template_decl,
|
||||
|
|
|
@ -902,7 +902,6 @@ tinfo_base_init (tinfo_s *ti, tree target)
|
|||
|
||||
init = build_constructor_from_list (NULL_TREE, nreverse (init));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
init = tree_cons (NULL_TREE, init, NULL_TREE);
|
||||
|
||||
|
@ -920,7 +919,6 @@ generic_initializer (tinfo_s *ti, tree target)
|
|||
|
||||
init = build_constructor_from_list (NULL_TREE, init);
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
return init;
|
||||
}
|
||||
|
@ -946,7 +944,6 @@ ptr_initializer (tinfo_s *ti, tree target)
|
|||
|
||||
init = build_constructor_from_list (NULL_TREE, nreverse (init));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
return init;
|
||||
}
|
||||
|
@ -979,7 +976,6 @@ ptm_initializer (tinfo_s *ti, tree target)
|
|||
|
||||
init = build_constructor_from_list (NULL_TREE, nreverse (init));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
return init;
|
||||
}
|
||||
|
@ -996,7 +992,6 @@ class_initializer (tinfo_s *ti, tree target, tree trail)
|
|||
TREE_CHAIN (init) = trail;
|
||||
init = build_constructor_from_list (NULL_TREE, init);
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
return init;
|
||||
}
|
||||
|
|
|
@ -2766,7 +2766,6 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
|
|||
fold_convert (sizetype, idx));
|
||||
e2 = cp_build_indirect_ref (e2, NULL, tf_warning_or_error);
|
||||
TREE_CONSTANT (e2) = 1;
|
||||
TREE_INVARIANT (e2) = 1;
|
||||
|
||||
/* When using function descriptors, the address of the
|
||||
vtable entry is treated as a function pointer. */
|
||||
|
@ -6396,7 +6395,6 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn)
|
|||
CONSTRUCTOR_APPEND_ELT(v, delta_field, delta);
|
||||
u = build_constructor (type, v);
|
||||
TREE_CONSTANT (u) = TREE_CONSTANT (pfn) & TREE_CONSTANT (delta);
|
||||
TREE_INVARIANT (u) = TREE_INVARIANT (pfn) & TREE_INVARIANT (delta);
|
||||
TREE_STATIC (u) = (TREE_CONSTANT (u)
|
||||
&& (initializer_constant_valid_p (pfn, TREE_TYPE (pfn))
|
||||
!= NULL_TREE)
|
||||
|
|
|
@ -1081,7 +1081,6 @@ process_init_constructor (tree type, tree init)
|
|||
if (!(flags & PICFLAG_NOT_ALL_CONSTANT))
|
||||
{
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
if (!(flags & PICFLAG_NOT_ALL_SIMPLE))
|
||||
TREE_STATIC (init) = 1;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* trans-expr.c (gfc_conv_structure): Don't set TREE_INVARIANT.
|
||||
* trans-array.c (gfc_build_null_descriptor): Don't set TREE_INVARIANT.
|
||||
(gfc_trans_array_constructor_value): Don't set TREE_INVARIANT.
|
||||
(gfc_build_constant_array_constructor): Don't set TREE_INVARIANT.
|
||||
(gfc_conv_array_initializer): Don't set TREE_INVARIANT.
|
||||
* trans-common.c (get_init_field): Don't set TREE_INVARIANT.
|
||||
(create_common): Don't set TREE_INVARIANT.
|
||||
* trans-stmt.c (gfc_trans_character_select): Don't set TREE_INVARIANT.
|
||||
* trans-decl.c (gfc_generate_function_code): Don't set TREE_INVARIANT.
|
||||
|
||||
2008-04-21 Steve Ellcey <sje@cup.hp.com>
|
||||
|
||||
* f95-lang.c (gfc_init_decl_processing): use ptr_mode instead of Pmode.
|
||||
|
|
|
@ -316,7 +316,6 @@ gfc_build_null_descriptor (tree type)
|
|||
/* Set a NULL data pointer. */
|
||||
tmp = build_constructor_single (type, field, null_pointer_node);
|
||||
TREE_CONSTANT (tmp) = 1;
|
||||
TREE_INVARIANT (tmp) = 1;
|
||||
/* All other fields are ignored. */
|
||||
|
||||
return tmp;
|
||||
|
@ -1207,13 +1206,11 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
|
|||
|
||||
init = build_constructor_from_list (tmptype, nreverse (list));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
/* Create a static variable to hold the data. */
|
||||
tmp = gfc_create_var (tmptype, "data");
|
||||
TREE_STATIC (tmp) = 1;
|
||||
TREE_CONSTANT (tmp) = 1;
|
||||
TREE_INVARIANT (tmp) = 1;
|
||||
TREE_READONLY (tmp) = 1;
|
||||
DECL_INITIAL (tmp) = init;
|
||||
init = tmp;
|
||||
|
@ -1582,13 +1579,11 @@ gfc_build_constant_array_constructor (gfc_expr * expr, tree type)
|
|||
init = build_constructor_from_list (tmptype, nreverse (list));
|
||||
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
|
||||
tmp = gfc_create_var (tmptype, "A");
|
||||
TREE_STATIC (tmp) = 1;
|
||||
TREE_CONSTANT (tmp) = 1;
|
||||
TREE_INVARIANT (tmp) = 1;
|
||||
TREE_READONLY (tmp) = 1;
|
||||
DECL_INITIAL (tmp) = init;
|
||||
|
||||
|
@ -3911,7 +3906,6 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
|
|||
/* Create a constructor from the list of elements. */
|
||||
tmp = build_constructor (type, v);
|
||||
TREE_CONSTANT (tmp) = 1;
|
||||
TREE_INVARIANT (tmp) = 1;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
@ -547,7 +547,6 @@ get_init_field (segment_info *head, tree union_type, tree *field_init,
|
|||
|
||||
init = build_constructor (TREE_TYPE (field), v);
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
|
||||
*field_init = init;
|
||||
|
||||
|
@ -657,7 +656,6 @@ create_common (gfc_common_head *com, segment_info *head, bool saw_equiv)
|
|||
gcc_assert (!VEC_empty (constructor_elt, v));
|
||||
ctor = build_constructor (union_type, v);
|
||||
TREE_CONSTANT (ctor) = 1;
|
||||
TREE_INVARIANT (ctor) = 1;
|
||||
TREE_STATIC (ctor) = 1;
|
||||
DECL_INITIAL (decl) = ctor;
|
||||
|
||||
|
|
|
@ -3183,13 +3183,11 @@ gfc_generate_function_code (gfc_namespace * ns)
|
|||
6)));
|
||||
array = build_constructor_from_list (array_type, nreverse (array));
|
||||
TREE_CONSTANT (array) = 1;
|
||||
TREE_INVARIANT (array) = 1;
|
||||
TREE_STATIC (array) = 1;
|
||||
|
||||
/* Create a static variable to hold the jump table. */
|
||||
var = gfc_create_var (array_type, "options");
|
||||
TREE_CONSTANT (var) = 1;
|
||||
TREE_INVARIANT (var) = 1;
|
||||
TREE_STATIC (var) = 1;
|
||||
TREE_READONLY (var) = 1;
|
||||
DECL_INITIAL (var) = array;
|
||||
|
|
|
@ -3478,10 +3478,7 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init)
|
|||
}
|
||||
se->expr = build_constructor (type, v);
|
||||
if (init)
|
||||
{
|
||||
TREE_CONSTANT(se->expr) = 1;
|
||||
TREE_INVARIANT(se->expr) = 1;
|
||||
}
|
||||
TREE_CONSTANT (se->expr) = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1435,12 +1435,10 @@ gfc_trans_character_select (gfc_code *code)
|
|||
|
||||
init = build_constructor_from_list (type, nreverse(init));
|
||||
TREE_CONSTANT (init) = 1;
|
||||
TREE_INVARIANT (init) = 1;
|
||||
TREE_STATIC (init) = 1;
|
||||
/* Create a static variable to hold the jump table. */
|
||||
tmp = gfc_create_var (type, "jumptable");
|
||||
TREE_CONSTANT (tmp) = 1;
|
||||
TREE_INVARIANT (tmp) = 1;
|
||||
TREE_STATIC (tmp) = 1;
|
||||
TREE_READONLY (tmp) = 1;
|
||||
DECL_INITIAL (tmp) = init;
|
||||
|
|
|
@ -2868,12 +2868,14 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
|
|||
{
|
||||
enum gimplify_status one;
|
||||
|
||||
/* If the value is invariant, then there's nothing to pre-evaluate.
|
||||
But ensure it doesn't have any side-effects since a SAVE_EXPR is
|
||||
invariant but has side effects and might contain a reference to
|
||||
the object we're initializing. */
|
||||
if (TREE_INVARIANT (*expr_p) && !TREE_SIDE_EFFECTS (*expr_p))
|
||||
return;
|
||||
/* If the value is constant, then there's nothing to pre-evaluate. */
|
||||
if (TREE_CONSTANT (*expr_p))
|
||||
{
|
||||
/* Ensure it does not have side effects, it might contain a reference to
|
||||
the object we're initializing. */
|
||||
gcc_assert (!TREE_SIDE_EFFECTS (*expr_p));
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the type has non-trivial constructors, we can't pre-evaluate. */
|
||||
if (TREE_ADDRESSABLE (TREE_TYPE (*expr_p)))
|
||||
|
@ -3416,7 +3418,6 @@ gimplify_init_constructor (tree *expr_p, tree *pre_p,
|
|||
break;
|
||||
|
||||
TREE_CONSTANT (ctor) = 0;
|
||||
TREE_INVARIANT (ctor) = 0;
|
||||
}
|
||||
|
||||
/* Vector types use CONSTRUCTOR all the way through gimple
|
||||
|
@ -4254,8 +4255,7 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p)
|
|||
if (TREE_CODE (op0) == INDIRECT_REF)
|
||||
goto do_indirect_ref;
|
||||
|
||||
/* Make sure TREE_INVARIANT, TREE_CONSTANT, and TREE_SIDE_EFFECTS
|
||||
is set properly. */
|
||||
/* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly. */
|
||||
recompute_tree_invariant_for_addr_expr (expr);
|
||||
|
||||
mark_addressable (TREE_OPERAND (expr, 0));
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* class.c (build_utf8_ref): Don't set TREE_INVARIANT.
|
||||
(build_classdollar_field): Don't set TREE_INVARIANT.
|
||||
(get_dispatch_table): Don't set TREE_INVARIANT.
|
||||
(make_class_data): Don't set TREE_INVARIANT.
|
||||
(build_symbol_entry): Don't set TREE_INVARIANT.
|
||||
(emit_symbol_table): Don't set TREE_INVARIANT.
|
||||
* constants.c (build_constant_data_ref): Don't set TREE_INVARIANT.
|
||||
(build_ref_from_constant_pool): Don't set TREE_INVARIANT.
|
||||
* resource.c (compile_resource_data): Don't set TREE_INVARIANT.
|
||||
* expr.c (cache_cpool_data_ref): Don't set TREE_INVARIANT.
|
||||
|
||||
2008-04-03 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* Make-lang.in (java_OBJS): New variable.
|
||||
|
|
|
@ -955,7 +955,6 @@ build_utf8_ref (tree name)
|
|||
PUSH_FIELD_VALUE (cinit, "data", string);
|
||||
FINISH_RECORD_CONSTRUCTOR (cinit);
|
||||
TREE_CONSTANT (cinit) = 1;
|
||||
TREE_INVARIANT (cinit) = 1;
|
||||
|
||||
/* Generate a unique-enough identifier. */
|
||||
sprintf(buf, "_Utf%d", ++utf8_count);
|
||||
|
@ -1063,7 +1062,6 @@ build_classdollar_field (tree type)
|
|||
/* const */ 1, 0)),
|
||||
/* const */ 1, 0)));
|
||||
TREE_STATIC (decl) = 1;
|
||||
TREE_INVARIANT (decl) = 1;
|
||||
TREE_CONSTANT (decl) = 1;
|
||||
TREE_READONLY (decl) = 1;
|
||||
TREE_PUBLIC (decl) = 1;
|
||||
|
@ -1604,7 +1602,6 @@ get_dispatch_table (tree type, tree this_class_addr)
|
|||
tree fdesc = build2 (FDESC_EXPR, nativecode_ptr_type_node,
|
||||
method, build_int_cst (NULL_TREE, j));
|
||||
TREE_CONSTANT (fdesc) = 1;
|
||||
TREE_INVARIANT (fdesc) = 1;
|
||||
list = tree_cons (NULL_TREE, fdesc, list);
|
||||
}
|
||||
else
|
||||
|
@ -2076,7 +2073,6 @@ make_class_data (tree type)
|
|||
build1 (ADDR_EXPR, symbols_array_ptr_type,
|
||||
TYPE_OTABLE_SYMS_DECL (type)));
|
||||
TREE_CONSTANT (TYPE_OTABLE_DECL (type)) = 1;
|
||||
TREE_INVARIANT (TYPE_OTABLE_DECL (type)) = 1;
|
||||
}
|
||||
if (TYPE_ATABLE_METHODS(type) == NULL_TREE)
|
||||
{
|
||||
|
@ -2092,7 +2088,6 @@ make_class_data (tree type)
|
|||
build1 (ADDR_EXPR, symbols_array_ptr_type,
|
||||
TYPE_ATABLE_SYMS_DECL (type)));
|
||||
TREE_CONSTANT (TYPE_ATABLE_DECL (type)) = 1;
|
||||
TREE_INVARIANT (TYPE_ATABLE_DECL (type)) = 1;
|
||||
}
|
||||
if (TYPE_ITABLE_METHODS(type) == NULL_TREE)
|
||||
{
|
||||
|
@ -2108,7 +2103,6 @@ make_class_data (tree type)
|
|||
build1 (ADDR_EXPR, symbols_array_ptr_type,
|
||||
TYPE_ITABLE_SYMS_DECL (type)));
|
||||
TREE_CONSTANT (TYPE_ITABLE_DECL (type)) = 1;
|
||||
TREE_INVARIANT (TYPE_ITABLE_DECL (type)) = 1;
|
||||
}
|
||||
|
||||
PUSH_FIELD_VALUE (cons, "catch_classes",
|
||||
|
@ -2848,7 +2842,6 @@ build_symbol_entry (tree decl, tree special)
|
|||
PUSH_FIELD_VALUE (sym, "signature", signature);
|
||||
FINISH_RECORD_CONSTRUCTOR (sym);
|
||||
TREE_CONSTANT (sym) = 1;
|
||||
TREE_INVARIANT (sym) = 1;
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
@ -2889,7 +2882,6 @@ emit_symbol_table (tree name, tree the_table, tree decl_list,
|
|||
PUSH_FIELD_VALUE (null_symbol, "signature", null_pointer_node);
|
||||
FINISH_RECORD_CONSTRUCTOR (null_symbol);
|
||||
TREE_CONSTANT (null_symbol) = 1;
|
||||
TREE_INVARIANT (null_symbol) = 1;
|
||||
list = tree_cons (NULL_TREE, null_symbol, list);
|
||||
|
||||
/* Put the list in the right order and make it a constructor. */
|
||||
|
|
|
@ -445,7 +445,6 @@ build_constant_data_ref (bool indirect)
|
|||
TREE_THIS_NOTRAP (klass) = 1;
|
||||
data = fold_convert (build_pointer_type (cpool_type), data);
|
||||
d = build1 (INDIRECT_REF, cpool_type, data);
|
||||
TREE_INVARIANT (d) = 1;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
@ -485,7 +484,6 @@ build_ref_from_constant_pool (int index)
|
|||
i = build_int_cst (NULL_TREE, index);
|
||||
d = build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (d)), d, i,
|
||||
NULL_TREE, NULL_TREE);
|
||||
TREE_INVARIANT (d) = 1;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
|
|
@ -3809,7 +3809,6 @@ cache_cpool_data_ref (void)
|
|||
tree cpool_ptr = build_decl (VAR_DECL, NULL_TREE,
|
||||
build_pointer_type (TREE_TYPE (d)));
|
||||
java_add_local_var (cpool_ptr);
|
||||
TREE_INVARIANT (cpool_ptr) = 1;
|
||||
TREE_CONSTANT (cpool_ptr) = 1;
|
||||
|
||||
java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (cpool_ptr),
|
||||
|
|
|
@ -73,7 +73,6 @@ compile_resource_data (const char *name, const char *buffer, int length)
|
|||
PUSH_FIELD_VALUE (rinit, "data", data);
|
||||
FINISH_RECORD_CONSTRUCTOR (rinit);
|
||||
TREE_CONSTANT (rinit) = 1;
|
||||
TREE_INVARIANT (rinit) = 1;
|
||||
|
||||
decl = build_decl (VAR_DECL, java_mangle_resource_name (name), rtype);
|
||||
TREE_STATIC (decl) = 1;
|
||||
|
|
|
@ -64,7 +64,7 @@ extern const char *lhd_comdat_group (tree);
|
|||
extern tree lhd_expr_size (const_tree);
|
||||
extern size_t lhd_tree_size (enum tree_code);
|
||||
extern HOST_WIDE_INT lhd_to_target_charset (HOST_WIDE_INT);
|
||||
extern tree lhd_expr_to_decl (tree, bool *, bool *, bool *);
|
||||
extern tree lhd_expr_to_decl (tree, bool *, bool *);
|
||||
extern tree lhd_builtin_function (tree decl);
|
||||
|
||||
/* Declarations of default tree inlining hooks. */
|
||||
|
|
|
@ -502,8 +502,7 @@ lhd_to_target_charset (HOST_WIDE_INT c)
|
|||
}
|
||||
|
||||
tree
|
||||
lhd_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED,
|
||||
bool *ti ATTRIBUTE_UNUSED, bool *se ATTRIBUTE_UNUSED)
|
||||
lhd_expr_to_decl (tree expr, bool *tc ATTRIBUTE_UNUSED, bool *se ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return expr;
|
||||
}
|
||||
|
|
|
@ -400,10 +400,9 @@ struct lang_hooks
|
|||
void (*init_ts) (void);
|
||||
|
||||
/* Called by recompute_tree_invariant_for_addr_expr to go from EXPR
|
||||
to a contained expression or DECL, possibly updating *TC, *TI or
|
||||
*SE if in the process TREE_CONSTANT, TREE_INVARIANT or
|
||||
TREE_SIDE_EFFECTS need updating. */
|
||||
tree (*expr_to_decl) (tree expr, bool *tc, bool *ti, bool *se);
|
||||
to a contained expression or DECL, possibly updating *TC or *SE
|
||||
if in the process TREE_CONSTANT or TREE_SIDE_EFFECTS need updating. */
|
||||
tree (*expr_to_decl) (tree expr, bool *tc, bool *se);
|
||||
|
||||
/* Whenever you add entries here, make sure you adjust langhooks-def.h
|
||||
and langhooks.c accordingly. */
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-04-23 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* objc-act.c (objc_build_string_object): Don't set TREE_INVARIANT.
|
||||
|
||||
2008-04-03 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* Make-lang.in (objc_OBJS): New variable.
|
||||
|
|
|
@ -1953,7 +1953,6 @@ objc_build_string_object (tree string)
|
|||
initlist);
|
||||
constructor = objc_build_constructor (internal_const_str_type,
|
||||
nreverse (initlist));
|
||||
TREE_INVARIANT (constructor) = true;
|
||||
|
||||
if (!flag_next_runtime)
|
||||
constructor
|
||||
|
|
|
@ -293,8 +293,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
|
|||
else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
|
||||
fputs (" sizes-gimplified", file);
|
||||
|
||||
if (TREE_INVARIANT (node))
|
||||
fputs (" invariant", file);
|
||||
if (TREE_ADDRESSABLE (node))
|
||||
fputs (" addressable", file);
|
||||
if (TREE_THIS_VOLATILE (node))
|
||||
|
|
|
@ -3188,28 +3188,20 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
|
|||
|
||||
case ADDR_EXPR:
|
||||
{
|
||||
bool old_invariant;
|
||||
bool old_constant;
|
||||
bool old_side_effects;
|
||||
bool new_invariant;
|
||||
bool new_constant;
|
||||
bool new_side_effects;
|
||||
|
||||
old_invariant = TREE_INVARIANT (t);
|
||||
gcc_assert (is_gimple_address (t));
|
||||
|
||||
old_constant = TREE_CONSTANT (t);
|
||||
old_side_effects = TREE_SIDE_EFFECTS (t);
|
||||
|
||||
recompute_tree_invariant_for_addr_expr (t);
|
||||
new_invariant = TREE_INVARIANT (t);
|
||||
new_side_effects = TREE_SIDE_EFFECTS (t);
|
||||
new_constant = TREE_CONSTANT (t);
|
||||
|
||||
if (old_invariant != new_invariant)
|
||||
{
|
||||
error ("invariant not recomputed when ADDR_EXPR changed");
|
||||
return t;
|
||||
}
|
||||
|
||||
if (old_constant != new_constant)
|
||||
{
|
||||
error ("constant not recomputed when ADDR_EXPR changed");
|
||||
|
|
|
@ -194,6 +194,45 @@ is_gimple_constant (const_tree t)
|
|||
}
|
||||
}
|
||||
|
||||
/* Return true if T is a gimple address. */
|
||||
|
||||
bool
|
||||
is_gimple_address (const_tree t)
|
||||
{
|
||||
tree op;
|
||||
|
||||
if (TREE_CODE (t) != ADDR_EXPR)
|
||||
return false;
|
||||
|
||||
op = TREE_OPERAND (t, 0);
|
||||
while (handled_component_p (op))
|
||||
{
|
||||
if ((TREE_CODE (op) == ARRAY_REF
|
||||
|| TREE_CODE (op) == ARRAY_RANGE_REF)
|
||||
&& !is_gimple_val (TREE_OPERAND (op, 1)))
|
||||
return false;
|
||||
|
||||
op = TREE_OPERAND (op, 0);
|
||||
}
|
||||
|
||||
if (CONSTANT_CLASS_P (op) || INDIRECT_REF_P (op))
|
||||
return true;
|
||||
|
||||
switch (TREE_CODE (op))
|
||||
{
|
||||
case PARM_DECL:
|
||||
case RESULT_DECL:
|
||||
case LABEL_DECL:
|
||||
case FUNCTION_DECL:
|
||||
case VAR_DECL:
|
||||
case CONST_DECL:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return true if T is a gimple invariant address. */
|
||||
|
||||
bool
|
||||
|
@ -227,40 +266,7 @@ is_gimple_invariant_address (const_tree t)
|
|||
op = TREE_OPERAND (op, 0);
|
||||
}
|
||||
|
||||
if (CONSTANT_CLASS_P (op))
|
||||
return true;
|
||||
|
||||
if (INDIRECT_REF_P (op))
|
||||
return false;
|
||||
|
||||
switch (TREE_CODE (op))
|
||||
{
|
||||
case PARM_DECL:
|
||||
case RESULT_DECL:
|
||||
case LABEL_DECL:
|
||||
case FUNCTION_DECL:
|
||||
return true;
|
||||
|
||||
case VAR_DECL:
|
||||
if (((TREE_STATIC (op) || DECL_EXTERNAL (op))
|
||||
&& ! DECL_DLLIMPORT_P (op))
|
||||
|| DECL_THREAD_LOCAL_P (op)
|
||||
|| DECL_CONTEXT (op) == current_function_decl
|
||||
|| decl_function_context (op) == current_function_decl)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CONST_DECL:
|
||||
if ((TREE_STATIC (op) || DECL_EXTERNAL (op))
|
||||
|| decl_function_context (op) == current_function_decl)
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
|
||||
return false;
|
||||
return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op);
|
||||
}
|
||||
|
||||
/* Return true if T is a GIMPLE minimal invariant. It's a restricted
|
||||
|
|
|
@ -62,6 +62,8 @@ extern bool is_gimple_addressable (tree);
|
|||
/* Returns true iff T is any valid GIMPLE lvalue. */
|
||||
extern bool is_gimple_lvalue (tree);
|
||||
|
||||
/* Returns true iff T is a GIMPLE address. */
|
||||
bool is_gimple_address (const_tree);
|
||||
/* Returns true iff T is a GIMPLE invariant address. */
|
||||
bool is_gimple_invariant_address (const_tree);
|
||||
/* Returns true iff T is a valid GIMPLE constant. */
|
||||
|
|
|
@ -83,7 +83,6 @@ mf_build_string (const char *string)
|
|||
TREE_TYPE (result) = build_array_type
|
||||
(char_type_node, build_index_type (build_int_cst (NULL_TREE, len)));
|
||||
TREE_CONSTANT (result) = 1;
|
||||
TREE_INVARIANT (result) = 1;
|
||||
TREE_READONLY (result) = 1;
|
||||
TREE_STATIC (result) = 1;
|
||||
|
||||
|
|
|
@ -1037,8 +1037,8 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
|
|||
{
|
||||
tree save_context;
|
||||
|
||||
/* If we changed anything, then TREE_INVARIANT is be wrong,
|
||||
since we're no longer directly referencing a decl. */
|
||||
/* If we changed anything, we might no longer be directly
|
||||
referencing a decl. */
|
||||
save_context = current_function_decl;
|
||||
current_function_decl = info->context;
|
||||
recompute_tree_invariant_for_addr_expr (t);
|
||||
|
|
|
@ -2097,8 +2097,8 @@ fold_stmt_r (tree *expr_p, int *walk_subtrees, void *data)
|
|||
return t;
|
||||
*walk_subtrees = 0;
|
||||
|
||||
/* Set TREE_INVARIANT properly so that the value is properly
|
||||
considered constant, and so gets propagated as expected. */
|
||||
/* Make sure the value is properly considered constant, and so gets
|
||||
propagated as expected. */
|
||||
if (*changed_p)
|
||||
recompute_tree_invariant_for_addr_expr (expr);
|
||||
return NULL_TREE;
|
||||
|
|
191
gcc/tree.c
191
gcc/tree.c
|
@ -621,7 +621,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
|
|||
|
||||
case tcc_constant:
|
||||
TREE_CONSTANT (t) = 1;
|
||||
TREE_INVARIANT (t) = 1;
|
||||
break;
|
||||
|
||||
case tcc_expression:
|
||||
|
@ -1192,7 +1191,6 @@ build_string (int len, const char *str)
|
|||
memset (s, 0, sizeof (struct tree_common));
|
||||
TREE_SET_CODE (s, STRING_CST);
|
||||
TREE_CONSTANT (s) = 1;
|
||||
TREE_INVARIANT (s) = 1;
|
||||
TREE_STRING_LENGTH (s) = len;
|
||||
memcpy (s->string.str, str, len);
|
||||
s->string.str[len] = '\0';
|
||||
|
@ -2056,7 +2054,111 @@ staticp (tree arg)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Return whether OP is a DECL whose address is function-invariant. */
|
||||
|
||||
bool
|
||||
decl_address_invariant_p (const_tree op)
|
||||
{
|
||||
/* The conditions below are slightly less strict than the one in
|
||||
staticp. */
|
||||
|
||||
switch (TREE_CODE (op))
|
||||
{
|
||||
case PARM_DECL:
|
||||
case RESULT_DECL:
|
||||
case LABEL_DECL:
|
||||
case FUNCTION_DECL:
|
||||
return true;
|
||||
|
||||
case VAR_DECL:
|
||||
if (((TREE_STATIC (op) || DECL_EXTERNAL (op))
|
||||
&& !DECL_DLLIMPORT_P (op))
|
||||
|| DECL_THREAD_LOCAL_P (op)
|
||||
|| DECL_CONTEXT (op) == current_function_decl
|
||||
|| decl_function_context (op) == current_function_decl)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CONST_DECL:
|
||||
if ((TREE_STATIC (op) || DECL_EXTERNAL (op))
|
||||
|| decl_function_context (op) == current_function_decl)
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Return true if T is function-invariant (internal function, does
|
||||
not handle arithmetic; that's handled in skip_simple_arithmetic and
|
||||
tree_invariant_p). */
|
||||
|
||||
static bool tree_invariant_p (tree t);
|
||||
|
||||
static bool
|
||||
tree_invariant_p_1 (tree t)
|
||||
{
|
||||
tree op;
|
||||
|
||||
if (TREE_CONSTANT (t)
|
||||
|| (TREE_READONLY (t) && !TREE_SIDE_EFFECTS (t)))
|
||||
return true;
|
||||
|
||||
switch (TREE_CODE (t))
|
||||
{
|
||||
case SAVE_EXPR:
|
||||
return true;
|
||||
|
||||
case ADDR_EXPR:
|
||||
op = TREE_OPERAND (t, 0);
|
||||
while (handled_component_p (op))
|
||||
{
|
||||
switch (TREE_CODE (op))
|
||||
{
|
||||
case ARRAY_REF:
|
||||
case ARRAY_RANGE_REF:
|
||||
if (!tree_invariant_p (TREE_OPERAND (op, 1))
|
||||
|| TREE_OPERAND (op, 2) != NULL_TREE
|
||||
|| TREE_OPERAND (op, 3) != NULL_TREE)
|
||||
return false;
|
||||
break;
|
||||
|
||||
case COMPONENT_REF:
|
||||
if (TREE_OPERAND (op, 2) != NULL_TREE)
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:;
|
||||
}
|
||||
op = TREE_OPERAND (op, 0);
|
||||
}
|
||||
|
||||
return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true if T is function-invariant. */
|
||||
|
||||
static bool
|
||||
tree_invariant_p (tree t)
|
||||
{
|
||||
tree inner = skip_simple_arithmetic (t);
|
||||
return tree_invariant_p_1 (inner);
|
||||
}
|
||||
|
||||
/* Wrap a SAVE_EXPR around EXPR, if appropriate.
|
||||
Do this to any expression which may be used in more than one place,
|
||||
but must be evaluated only once.
|
||||
|
@ -2091,11 +2193,10 @@ save_expr (tree expr)
|
|||
Since it is no problem to reevaluate literals, we just return the
|
||||
literal node. */
|
||||
inner = skip_simple_arithmetic (t);
|
||||
if (TREE_CODE (inner) == ERROR_MARK)
|
||||
return inner;
|
||||
|
||||
if (TREE_INVARIANT (inner)
|
||||
|| (TREE_READONLY (inner) && ! TREE_SIDE_EFFECTS (inner))
|
||||
|| TREE_CODE (inner) == SAVE_EXPR
|
||||
|| TREE_CODE (inner) == ERROR_MARK)
|
||||
if (tree_invariant_p_1 (inner))
|
||||
return t;
|
||||
|
||||
/* If INNER contains a PLACEHOLDER_EXPR, we must evaluate it each time, since
|
||||
|
@ -2116,7 +2217,6 @@ save_expr (tree expr)
|
|||
value was computed on both sides of the jump. So make sure it isn't
|
||||
eliminated as dead. */
|
||||
TREE_SIDE_EFFECTS (t) = 1;
|
||||
TREE_INVARIANT (t) = 1;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -2144,9 +2244,9 @@ skip_simple_arithmetic (tree expr)
|
|||
inner = TREE_OPERAND (inner, 0);
|
||||
else if (BINARY_CLASS_P (inner))
|
||||
{
|
||||
if (TREE_INVARIANT (TREE_OPERAND (inner, 1)))
|
||||
if (tree_invariant_p (TREE_OPERAND (inner, 1)))
|
||||
inner = TREE_OPERAND (inner, 0);
|
||||
else if (TREE_INVARIANT (TREE_OPERAND (inner, 0)))
|
||||
else if (tree_invariant_p (TREE_OPERAND (inner, 0)))
|
||||
inner = TREE_OPERAND (inner, 1);
|
||||
else
|
||||
break;
|
||||
|
@ -2815,7 +2915,7 @@ stabilize_reference_1 (tree e)
|
|||
ignore things that are actual constant or that already have been
|
||||
handled by this function. */
|
||||
|
||||
if (TREE_INVARIANT (e))
|
||||
if (tree_invariant_p (e))
|
||||
return e;
|
||||
|
||||
switch (TREE_CODE_CLASS (code))
|
||||
|
@ -2868,7 +2968,6 @@ stabilize_reference_1 (tree e)
|
|||
TREE_READONLY (result) = TREE_READONLY (e);
|
||||
TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (e);
|
||||
TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
|
||||
TREE_INVARIANT (result) = 1;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -2876,13 +2975,13 @@ stabilize_reference_1 (tree e)
|
|||
/* Low-level constructors for expressions. */
|
||||
|
||||
/* A helper function for build1 and constant folders. Set TREE_CONSTANT,
|
||||
TREE_INVARIANT, and TREE_SIDE_EFFECTS for an ADDR_EXPR. */
|
||||
and TREE_SIDE_EFFECTS for an ADDR_EXPR. */
|
||||
|
||||
void
|
||||
recompute_tree_invariant_for_addr_expr (tree t)
|
||||
{
|
||||
tree node;
|
||||
bool tc = true, ti = true, se = false;
|
||||
bool tc = true, se = false;
|
||||
|
||||
/* We started out assuming this address is both invariant and constant, but
|
||||
does not have side effects. Now go down any handled components and see if
|
||||
|
@ -2892,9 +2991,8 @@ recompute_tree_invariant_for_addr_expr (tree t)
|
|||
??? Note that this code makes no attempt to deal with the case where
|
||||
taking the address of something causes a copy due to misalignment. */
|
||||
|
||||
#define UPDATE_TITCSE(NODE) \
|
||||
#define UPDATE_FLAGS(NODE) \
|
||||
do { tree _node = (NODE); \
|
||||
if (_node && !TREE_INVARIANT (_node)) ti = false; \
|
||||
if (_node && !TREE_CONSTANT (_node)) tc = false; \
|
||||
if (_node && TREE_SIDE_EFFECTS (_node)) se = true; } while (0)
|
||||
|
||||
|
@ -2908,11 +3006,11 @@ do { tree _node = (NODE); \
|
|||
|| TREE_CODE (node) == ARRAY_RANGE_REF)
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (node, 0))) == ARRAY_TYPE)
|
||||
{
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 1));
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 1));
|
||||
if (TREE_OPERAND (node, 2))
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 2));
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 2));
|
||||
if (TREE_OPERAND (node, 3))
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 3));
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 3));
|
||||
}
|
||||
/* Likewise, just because this is a COMPONENT_REF doesn't mean we have a
|
||||
FIELD_DECL, apparently. The G++ front end can put something else
|
||||
|
@ -2921,46 +3019,35 @@ do { tree _node = (NODE); \
|
|||
&& TREE_CODE (TREE_OPERAND (node, 1)) == FIELD_DECL)
|
||||
{
|
||||
if (TREE_OPERAND (node, 2))
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 2));
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 2));
|
||||
}
|
||||
else if (TREE_CODE (node) == BIT_FIELD_REF)
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 2));
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 2));
|
||||
}
|
||||
|
||||
node = lang_hooks.expr_to_decl (node, &tc, &ti, &se);
|
||||
node = lang_hooks.expr_to_decl (node, &tc, &se);
|
||||
|
||||
/* Now see what's inside. If it's an INDIRECT_REF, copy our properties from
|
||||
the address, since &(*a)->b is a form of addition. 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 address of a volatile variable
|
||||
is not volatile. If it's a constant, the address is both invariant and
|
||||
constant. Otherwise it's neither. */
|
||||
the address, since &(*a)->b is a form of addition. If it's a constant, the
|
||||
address is constant too. If it's a decl, its address is constant if the
|
||||
decl is static. Everything else is not constant and, furthermore,
|
||||
taking the address of a volatile variable is not volatile. */
|
||||
if (TREE_CODE (node) == INDIRECT_REF)
|
||||
UPDATE_TITCSE (TREE_OPERAND (node, 0));
|
||||
else if (DECL_P (node))
|
||||
{
|
||||
if (staticp (node))
|
||||
;
|
||||
else if (decl_function_context (node) == current_function_decl
|
||||
/* Addresses of thread-local variables are invariant. */
|
||||
|| (TREE_CODE (node) == VAR_DECL
|
||||
&& DECL_THREAD_LOCAL_P (node)))
|
||||
tc = false;
|
||||
else
|
||||
ti = tc = false;
|
||||
}
|
||||
UPDATE_FLAGS (TREE_OPERAND (node, 0));
|
||||
else if (CONSTANT_CLASS_P (node))
|
||||
;
|
||||
else if (DECL_P (node))
|
||||
tc &= (staticp (node) != NULL_TREE);
|
||||
else
|
||||
{
|
||||
ti = tc = false;
|
||||
tc = false;
|
||||
se |= TREE_SIDE_EFFECTS (node);
|
||||
}
|
||||
|
||||
|
||||
TREE_CONSTANT (t) = tc;
|
||||
TREE_INVARIANT (t) = ti;
|
||||
TREE_SIDE_EFFECTS (t) = se;
|
||||
#undef UPDATE_TITCSE
|
||||
#undef UPDATE_FLAGS
|
||||
}
|
||||
|
||||
/* Build an expression of code CODE, data type TYPE, and operands as
|
||||
|
@ -3057,9 +3144,6 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
|
|||
&& node && !TYPE_P (node)
|
||||
&& TREE_CONSTANT (node))
|
||||
TREE_CONSTANT (t) = 1;
|
||||
if ((TREE_CODE_CLASS (code) == tcc_unary || code == VIEW_CONVERT_EXPR)
|
||||
&& node && TREE_INVARIANT (node))
|
||||
TREE_INVARIANT (t) = 1;
|
||||
if (TREE_CODE_CLASS (code) == tcc_reference
|
||||
&& node && TREE_THIS_VOLATILE (node))
|
||||
TREE_THIS_VOLATILE (t) = 1;
|
||||
|
@ -3080,15 +3164,13 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
|
|||
read_only = 0; \
|
||||
if (!TREE_CONSTANT (arg##N)) \
|
||||
constant = 0; \
|
||||
if (!TREE_INVARIANT (arg##N)) \
|
||||
invariant = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
tree
|
||||
build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
|
||||
{
|
||||
bool constant, read_only, side_effects, invariant;
|
||||
bool constant, read_only, side_effects;
|
||||
tree t;
|
||||
|
||||
gcc_assert (TREE_CODE_LENGTH (code) == 2);
|
||||
|
@ -3125,14 +3207,12 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
|
|||
|| TREE_CODE_CLASS (code) == tcc_binary);
|
||||
read_only = 1;
|
||||
side_effects = TREE_SIDE_EFFECTS (t);
|
||||
invariant = constant;
|
||||
|
||||
PROCESS_ARG(0);
|
||||
PROCESS_ARG(1);
|
||||
|
||||
TREE_READONLY (t) = read_only;
|
||||
TREE_CONSTANT (t) = constant;
|
||||
TREE_INVARIANT (t) = invariant;
|
||||
TREE_SIDE_EFFECTS (t) = side_effects;
|
||||
TREE_THIS_VOLATILE (t)
|
||||
= (TREE_CODE_CLASS (code) == tcc_reference
|
||||
|
@ -3161,7 +3241,7 @@ tree
|
|||
build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
|
||||
tree arg2 MEM_STAT_DECL)
|
||||
{
|
||||
bool constant, read_only, side_effects, invariant;
|
||||
bool constant, read_only, side_effects;
|
||||
tree t;
|
||||
|
||||
gcc_assert (TREE_CODE_LENGTH (code) == 3);
|
||||
|
@ -3197,7 +3277,7 @@ tree
|
|||
build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
|
||||
tree arg2, tree arg3 MEM_STAT_DECL)
|
||||
{
|
||||
bool constant, read_only, side_effects, invariant;
|
||||
bool constant, read_only, side_effects;
|
||||
tree t;
|
||||
|
||||
gcc_assert (TREE_CODE_LENGTH (code) == 4);
|
||||
|
@ -3224,7 +3304,7 @@ tree
|
|||
build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
|
||||
tree arg2, tree arg3, tree arg4 MEM_STAT_DECL)
|
||||
{
|
||||
bool constant, read_only, side_effects, invariant;
|
||||
bool constant, read_only, side_effects;
|
||||
tree t;
|
||||
|
||||
gcc_assert (TREE_CODE_LENGTH (code) == 5);
|
||||
|
@ -3253,7 +3333,7 @@ build7_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
|
|||
tree arg2, tree arg3, tree arg4, tree arg5,
|
||||
tree arg6 MEM_STAT_DECL)
|
||||
{
|
||||
bool constant, read_only, side_effects, invariant;
|
||||
bool constant, read_only, side_effects;
|
||||
tree t;
|
||||
|
||||
gcc_assert (code == TARGET_MEM_REF);
|
||||
|
@ -3883,8 +3963,7 @@ merge_dllimport_decl_attributes (tree old, tree new)
|
|||
"after being referenced with dll linkage", new);
|
||||
/* If we have used a variable's address with dllimport linkage,
|
||||
keep the old DECL_DLLIMPORT_P flag: the ADDR_EXPR using the
|
||||
decl may already have had TREE_INVARIANT and TREE_CONSTANT
|
||||
computed.
|
||||
decl may already have had TREE_CONSTANT computed.
|
||||
We still remove the attribute so that assembler code refers
|
||||
to '&foo rather than '_imp__foo'. */
|
||||
if (TREE_CODE (old) == VAR_DECL && TREE_ADDRESSABLE (old))
|
||||
|
|
15
gcc/tree.h
15
gcc/tree.h
|
@ -387,7 +387,6 @@ struct tree_base GTY(())
|
|||
unsigned private_flag : 1;
|
||||
unsigned protected_flag : 1;
|
||||
unsigned deprecated_flag : 1;
|
||||
unsigned invariant_flag : 1;
|
||||
unsigned saturating_flag : 1;
|
||||
unsigned default_def_flag : 1;
|
||||
|
||||
|
@ -400,7 +399,7 @@ struct tree_base GTY(())
|
|||
unsigned lang_flag_6 : 1;
|
||||
unsigned visited : 1;
|
||||
|
||||
unsigned spare : 22;
|
||||
unsigned spare : 23;
|
||||
|
||||
/* FIXME tuples: Eventually, we need to move this somewhere external to
|
||||
the trees. */
|
||||
|
@ -579,11 +578,6 @@ struct gimple_stmt GTY(())
|
|||
|
||||
Used in tree traversals to mark visited nodes.
|
||||
|
||||
invariant_flag:
|
||||
|
||||
TREE_INVARIANT in
|
||||
all expressions.
|
||||
|
||||
saturating_flag:
|
||||
|
||||
TYPE_SATURATING in
|
||||
|
@ -1372,12 +1366,6 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
|
|||
#define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
|
||||
(IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)
|
||||
|
||||
/* Value of expression is function invariant. A strict subset of
|
||||
TREE_CONSTANT, such an expression is constant over any one function
|
||||
invocation, though not across different invocations. May appear in
|
||||
any expression node. */
|
||||
#define TREE_INVARIANT(NODE) ((NODE)->base.invariant_flag)
|
||||
|
||||
/* In fixed-point types, means a saturating type. */
|
||||
#define TYPE_SATURATING(NODE) ((NODE)->base.saturating_flag)
|
||||
|
||||
|
@ -4886,6 +4874,7 @@ extern tree strip_float_extensions (tree);
|
|||
|
||||
/* In tree.c */
|
||||
extern int really_constant_p (const_tree);
|
||||
extern bool decl_address_invariant_p (const_tree);
|
||||
extern int int_fits_type_p (const_tree, const_tree);
|
||||
#ifndef GENERATOR_FILE
|
||||
extern void get_type_static_bounds (const_tree, mpz_t, mpz_t);
|
||||
|
|
Loading…
Reference in New Issue