This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: {tree-ssa] Fixes re multiple type nodes from IMA

This goes a long way towards fixing the problems with duplicate copies of type
nodes from different files. Not everything works yet, but this is stable and far
enough along that I think it should go in. It does the following:

1) Promote current_file_decl, which determines whether multiple source files
were given or not, to a global. (The concept is language-independent although
it is currently implemented only for C.)

2) Add a langhook for type comparisons. Currently this does something other
than pointer comparison only for C and C++; for those languages it calls
comptypes() instead.

3) Teach the C-specific aliasing code about possible compatible types.
Currently this is only implemented for C90, and does something different
only when IMA is in effect.

4) Change all the places in tree-ssa doing pointer comparison for types
to use the langhook.

5) When doing constant prop into the lhs of a COMPONENT_REF, it's
possible the type changed because of (4), so alter the rhs to refer to the
corresponding FIELD_DECL in the new type.

Bootstrapped and tested on Darwin with no regressions; in fact, there
are about 250 more passes in C++ now, presumably because of (2).
This was unexpected, but I'll take it.  (I can probably break this up if
you really want, but the patches aren't entirely independent...)

2004-03-08 Dale Johannesen <>

* (tree-ssa-phiopt.o): add langhooks.h dependency.
(tree-nrv.o): Ditto.
(tree-ssa-copy.o): Ditto.
(tree-ssa-dom.o): Ditto.
(tree-ssa-ccp.o): Ditto.
* c-common.c: Add #include hashtab.h.
(c_type_hash): New.
(c_common_get_alias_set): Handle multiple type nodes referring
to "the same" type, currently for C90 only.
* c-decl.c (current_file_decl): Move to toplev.c.
* c-lang.c (LANG_HOOKS_TYPES_EQ_P): Define to c_types_eq_p.
(c_types_eq_p): New.
* c-tree.h (c_types_eq_p): New declaration.
* c-typeck.c (tagged_types_tu_compatible_p): Allow for compiler-generated
* gimplify.c (canonicalize_addr_expr): Use types_eq_p langhook.
(cpt_same_type): Ditto.
* langhooks-def.h (lhd_types_eq_p): New declaration.
* langhooks.c (lhd_types_eq_p): New.
* langhooks.h (struct lang_hooks): Add types_eq_p.
* stmt.c (tail_recursion_args): Use types_eq_p langhook.
* toplev.c (current_file_decl): New, moved from c-decl.c.
* tree-nrv.c: Include langhooks.h.
(tree_nrv): Use types_eq_p langhook.
* tree-ssa-ccp.c: Include langhooks.h.
(maybe_fold_offset_to_array_ref): Use types_eq_p langhook.
(maybe_fold_offset_to_component_ref): Ditto (2 places).
(fold_stmt_r): Make sure rhs of COMPONENT_REF is in lhs type.
* tree-ssa-copy.c: Include langhooks.h.
(cprop_into_stmt): Use types_eq_p langhook.
* tree-ssa-dom.c: Include langhooks.h.
(avail_expr_p): Use types_eq_p langhook.
* tree-ssa-phiopt.c: Include langhooks.h.
(conditional_replacement): Use types_eq_p langhook.
* tree-ssa.c (tree_ssa_useless_type_conversion_1): Use types_eq_p langhook.
* tree.h (current_file_decl): New declaration.
* cp/cp-lang.c (cxx_types_eq_p): New.

Attachment: patch.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]