Index: Makefile.in =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/Makefile.in,v retrieving revision 1.1533.2.3 diff -c -3 -p -r1.1533.2.3 Makefile.in *** Makefile.in 3 Sep 2005 21:18:48 -0000 1.1533.2.3 --- Makefile.in 15 Sep 2005 15:39:52 -0000 *************** OBJS-md = $(out_object_file) *** 979,985 **** OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) tree-inline.o \ cgraph.o cgraphunit.o tree-nomudflap.o ipa.o ipa-inline.o \ ipa-utils.o ipa-reference.o ipa-pure-const.o ipa-type-escape.o \ ! ipa-prop.o ipa-cp.o ipa-alias.o OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive) --- 979,985 ---- OBJS-archive = $(EXTRA_OBJS) $(host_hook_obj) tree-inline.o \ cgraph.o cgraphunit.o tree-nomudflap.o ipa.o ipa-inline.o \ ipa-utils.o ipa-reference.o ipa-pure-const.o ipa-type-escape.o \ ! ipa-prop.o ipa-cp.o ipa-alias.o ipa-cha.o OBJS = $(OBJS-common) $(out_object_file) $(OBJS-archive) *************** tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $ *** 1859,1865 **** tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) errors.h tree-inline.h \ $(FLAGS_H) function.h $(TM_H) $(TIMEVAR_H) tree-pass.h toplev.h \ ! gt-tree-ssa-operands.h coretypes.h langhooks.h tree-ssa-opfinalize.h \ $(IPA_REFERENCE_H) tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_H) $(FLAGS_H) function.h except.h langhooks.h \ --- 1859,1865 ---- tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) errors.h tree-inline.h \ $(FLAGS_H) function.h $(TM_H) $(TIMEVAR_H) tree-pass.h toplev.h \ ! tree-ssa-operands.h coretypes.h langhooks.h tree-ssa-opfinalize.h \ $(IPA_REFERENCE_H) tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_H) $(FLAGS_H) function.h except.h langhooks.h \ *************** ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM *** 2168,2173 **** --- 2168,2176 ---- ipa-alias.o : ipa-alias.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ langhooks.h $(GGC_H) target.h $(CGRAPH_H) output.h $(IPA_PROP_H) tree-iterator.h \ tree-inline.h function.h $(TREE_FLOW_H) alloc-pool.h $(TM_H) + ipa-cha.o : ipa-cha.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ + langhooks.h $(GGC_H) target.h $(CGRAPH_H) output.h $(IPA_PROP_H) tree-iterator.h \ + tree-inline.h function.h $(TREE_FLOW_H) alloc-pool.h $(TM_H) ipa-inline.o : ipa-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) langhooks.h tree-inline.h $(FLAGS_H) $(CGRAPH_H) intl.h \ $(DIAGNOSTIC_H) $(FIBHEAP_H) $(PARAMS_H) $(TIMEVAR_H) tree-pass.h \ *************** GTFILES = $(srcdir)/input.h $(srcdir)/co *** 2727,2733 **** $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \ $(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \ $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ ! $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-alias.c \ $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \ $(srcdir)/dojump.c $(srcdir)/tree-profile.c \ $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \ --- 2730,2736 ---- $(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \ $(srcdir)/c-common.h $(srcdir)/c-tree.h $(srcdir)/reload.h \ $(srcdir)/alias.c $(srcdir)/bitmap.c $(srcdir)/cselib.c $(srcdir)/cgraph.c \ ! $(srcdir)/ipa-prop.c $(srcdir)/ipa-cp.c $(srcdir)/ipa-alias.c $(srcdir)/ipa-cha.c \ $(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \ $(srcdir)/dojump.c $(srcdir)/tree-profile.c \ $(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \ Index: common.opt =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/common.opt,v retrieving revision 1.87.2.2 diff -c -3 -p -r1.87.2.2 common.opt *** common.opt 3 Sep 2005 21:19:06 -0000 1.87.2.2 --- common.opt 15 Sep 2005 15:39:52 -0000 *************** finstrument-functions *** 499,504 **** --- 499,508 ---- Common Report Var(flag_instrument_function_entry_exit) Instrument function entry and exit with profiling calls + fipa-cha + Common Report Var(flag_ipa_cha) + Perform IPA class hierarchy analysis + fipa-cp Common Report Var(flag_ipa_cp) Perform Interprocedural constant propagation Index: ipa-prop.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/ipa-prop.h,v retrieving revision 1.2.2.2 diff -c -3 -p -r1.2.2.2 ipa-prop.h *** ipa-prop.h 3 Sep 2005 21:19:35 -0000 1.2.2.2 --- ipa-prop.h 15 Sep 2005 15:39:52 -0000 *************** void ipa_calc_formals_counts (void); *** 241,246 **** --- 241,247 ---- void ipcp_driver (void); void ipaa_driver (void); + void cha_driver (void); /* ipaa external interface. */ enum alias_info_d ipaa_get_aliasing_of_formals (tree, tree); Index: langhooks-def.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/langhooks-def.h,v retrieving revision 1.101 diff -c -3 -p -r1.101 langhooks-def.h *** langhooks-def.h 8 Jul 2005 23:36:41 -0000 1.101 --- langhooks-def.h 15 Sep 2005 15:39:52 -0000 *************** extern int lhd_gimplify_expr (tree *, tr *** 193,198 **** --- 193,201 ---- #define LANG_HOOKS_GIMPLIFY_EXPR lhd_gimplify_expr #define LANG_HOOKS_FOLD_OBJ_TYPE_REF NULL + /* Hooks for CHA */ + #define LANG_HOOKS_CHA_IS_CONSTRUCTOR NULL + /* Tree dump hooks. */ extern bool lhd_tree_dump_dump_tree (void *, tree); extern int lhd_tree_dump_type_quals (tree); *************** extern tree lhd_make_node (enum tree_cod *** 301,306 **** --- 304,310 ---- LANG_HOOKS_FOR_TYPES_INITIALIZER, \ LANG_HOOKS_GIMPLIFY_EXPR, \ LANG_HOOKS_FOLD_OBJ_TYPE_REF, \ + LANG_HOOKS_CHA_IS_CONSTRUCTOR, \ LANG_HOOKS_BUILTIN_FUNCTION, \ LANG_HOOKS_INIT_TS, \ LANG_HOOKS_EXPR_TO_DECL, \ Index: langhooks.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/langhooks.h,v retrieving revision 1.109 diff -c -3 -p -r1.109 langhooks.h *** langhooks.h 8 Jul 2005 23:36:41 -0000 1.109 --- langhooks.h 15 Sep 2005 15:39:53 -0000 *************** struct lang_hooks *** 400,405 **** --- 400,409 ---- KNOWN_TYPE carries the true type of the OBJ_TYPE_REF_OBJECT. */ tree (*fold_obj_type_ref) (tree, tree); + /* For a FUNCTION_DECL, return true if the method is a constructor + for a type. */ + int (*cha_is_constructor) (tree); + /* Return a definition for a builtin function named NAME and whose data type is TYPE. TYPE should be a function type with argument types. FUNCTION_CODE tells later passes how to compile calls to this function. Index: passes.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/passes.c,v retrieving revision 2.108.2.3 diff -c -3 -p -r2.108.2.3 passes.c *** passes.c 3 Sep 2005 21:19:44 -0000 2.108.2.3 --- passes.c 15 Sep 2005 15:39:53 -0000 *************** init_optimization_passes (void) *** 433,438 **** --- 433,439 ---- p = &all_ipa_passes; NEXT_PASS (pass_early_ipa_inline); NEXT_PASS (pass_early_local_passes); + NEXT_PASS (pass_ipa_cha); /*NEXT_PASS (pass_ipa_cp);*/ NEXT_PASS (pass_ipa_inline); /*NEXT_PASS (pass_ipa_alias); Index: print-tree.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/print-tree.c,v retrieving revision 1.104.4.1 diff -c -3 -p -r1.104.4.1 print-tree.c *** print-tree.c 3 Sep 2005 21:19:45 -0000 1.104.4.1 --- print-tree.c 15 Sep 2005 15:39:53 -0000 *************** print_node (FILE *file, const char *pref *** 536,541 **** --- 536,544 ---- else if (TREE_CODE (node) == ARRAY_TYPE && TYPE_NONALIASED_COMPONENT (node)) fputs (" nonaliased-component", file); + else if (TREE_CODE (node) == RECORD_TYPE + && TYPE_OBJ_CREATED (node)) + fputs (" obj-created", file); if (TYPE_PACKED (node)) fputs (" packed", file); Index: timevar.def =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/timevar.def,v retrieving revision 1.54.2.1 diff -c -3 -p -r1.54.2.1 timevar.def *** timevar.def 9 Aug 2005 11:25:34 -0000 1.54.2.1 --- timevar.def 15 Sep 2005 15:39:53 -0000 *************** DEFTIMEVAR (TV_DUMP , " *** 43,48 **** --- 43,49 ---- DEFTIMEVAR (TV_CGRAPH , "callgraph construction") DEFTIMEVAR (TV_CGRAPHOPT , "callgraph optimization") DEFTIMEVAR (TV_IPA_CONSTANT_PROP , "ipa cp") + DEFTIMEVAR (TV_IPA_CHA , "ipa cha") DEFTIMEVAR (TV_IPA_REFERENCE , "ipa reference") DEFTIMEVAR (TV_IPA_PURE_CONST , "ipa pure const") DEFTIMEVAR (TV_IPA_ALIAS_ANALYSIS , "ipa alias analysis") Index: tree-pass.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/tree-pass.h,v retrieving revision 2.54.2.3 diff -c -3 -p -r2.54.2.3 tree-pass.h *** tree-pass.h 3 Sep 2005 21:20:01 -0000 2.54.2.3 --- tree-pass.h 15 Sep 2005 15:39:53 -0000 *************** extern struct tree_opt_pass pass_rebuild *** 286,291 **** --- 286,292 ---- extern struct tree_opt_pass pass_eliminate_useless_stores; /* IPA Passes */ + extern struct tree_opt_pass pass_ipa_cha; extern struct tree_opt_pass pass_ipa_cp; extern struct tree_opt_pass pass_ipa_inline; extern struct tree_opt_pass pass_ipa_alias; Index: tree.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/tree.h,v retrieving revision 1.750.4.1 diff -c -3 -p -r1.750.4.1 tree.h *** tree.h 3 Sep 2005 21:20:07 -0000 1.750.4.1 --- tree.h 15 Sep 2005 15:39:54 -0000 *************** struct tree_block GTY(()) *** 1777,1782 **** --- 1777,1787 ---- #define TYPE_NONALIASED_COMPONENT(NODE) \ (ARRAY_TYPE_CHECK (NODE)->type.transparent_union_flag) + /* For a RECORD_TYPE (a class) indicates that the class have + been instantied. */ + #define TYPE_OBJ_CREATED(NODE) \ + (RECORD_TYPE_CHECK (NODE)->type.transparent_union_flag) + /* Indicated that objects of this type should be laid out in as compact a way as possible. */ #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->type.packed_flag) *************** struct tree_type GTY(()) *** 1942,1947 **** --- 1947,1957 ---- #define BINFO_INHERITANCE_CHAIN(NODE) \ (TREE_BINFO_CHECK(NODE)->binfo.inheritance) + /* For a (degenerated) base, points to the list of primary bases of + (degenerated) derived bases in the class hierarchy. */ + #define BINFO_CHA_INHERITANCE_CHAIN(NODE) \ + (TREE_BINFO_CHECK(NODE)->binfo.cha_inheritance) + struct tree_binfo GTY (()) { struct tree_common common; *************** struct tree_binfo GTY (()) *** 1952,1957 **** --- 1962,1968 ---- tree vptr_field; VEC(tree,gc) *base_accesses; tree inheritance; + tree cha_inheritance; tree vtt_subvtt; tree vtt_vptr; Index: cp/class.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/cp/class.c,v retrieving revision 1.730.2.1 diff -c -3 -p -r1.730.2.1 class.c *** cp/class.c 3 Sep 2005 21:21:37 -0000 1.730.2.1 --- cp/class.c 15 Sep 2005 15:39:57 -0000 *************** cp_fold_obj_type_ref (tree ref, tree kno *** 7674,7679 **** --- 7674,7686 ---- tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type)); tree fndecl; + if (!CLASS_TYPE_P (known_type)) + return NULL; + + /* Still not supported. */ + if (CLASSTYPE_USE_TEMPLATE (known_type)) + return NULL; + while (i != index) { i += (TARGET_VTABLE_USES_DESCRIPTORS *************** cp_fold_obj_type_ref (tree ref, tree kno *** 7693,7696 **** --- 7700,7721 ---- return build_address (fndecl); } + /* Return 1 if the FNDECL is a complete constructor of a class. */ + + int + cp_cha_is_constructor (tree fndecl) + { + if (!DECL_COMPLETE_CONSTRUCTOR_P (fndecl)) + return 0; + if (!CLASS_TYPE_P (DECL_CONTEXT (fndecl))) + return 0; + if (TREE_CODE (DECL_CONTEXT (fndecl)) == UNION_TYPE) + return 0; + /* Still not supported. */ + if (CLASSTYPE_USE_TEMPLATE (DECL_CONTEXT (fndecl))) + return 0; + + return 1; + } + #include "gt-cp-class.h" Index: cp/cp-lang.c =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/cp/cp-lang.c,v retrieving revision 1.100 diff -c -3 -p -r1.100 cp-lang.c *** cp/cp-lang.c 9 Jul 2005 15:45:08 -0000 1.100 --- cp/cp-lang.c 15 Sep 2005 15:39:57 -0000 *************** static void cp_init_ts (void); *** 48,53 **** --- 48,55 ---- #define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #undef LANG_HOOKS_FOLD_OBJ_TYPE_REF #define LANG_HOOKS_FOLD_OBJ_TYPE_REF cp_fold_obj_type_ref + #undef LANG_HOOKS_CHA_IS_CONSTRUCTOR + #define LANG_HOOKS_CHA_IS_CONSTRUCTOR cp_cha_is_constructor #undef LANG_HOOKS_INIT_TS #define LANG_HOOKS_INIT_TS cp_init_ts Index: cp/cp-tree.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/cp/cp-tree.h,v retrieving revision 1.1157.4.1 diff -c -3 -p -r1.1157.4.1 cp-tree.h *** cp/cp-tree.h 3 Sep 2005 21:21:37 -0000 1.1157.4.1 --- cp/cp-tree.h 15 Sep 2005 15:39:57 -0000 *************** extern tree get_primary_binfo (tree); *** 3720,3725 **** --- 3720,3726 ---- extern void debug_class (tree); extern void debug_thunks (tree); extern tree cp_fold_obj_type_ref (tree, tree); + extern int cp_cha_is_constructor (tree); extern void set_linkage_according_to_type (tree, tree); extern void determine_key_method (tree); extern void check_for_override (tree, tree);