diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 20:53:41 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-09 20:53:41 +0000 |
commit | 39a1c4e92418b71a82b2eb725b8a077c532e3548 (patch) | |
tree | e6d9fc1af5cc4eae0924109da7c638ebc146d00c /gcc | |
parent | 4ea3f05cabe184459f585af348dab261fa4f6ae1 (diff) | |
download | gcc-39a1c4e92418b71a82b2eb725b8a077c532e3548.tar.gz |
Toplevel:
2004-09-09 Daniel Berlin <dberlin@dberlin.org>
* Makefile.def: Remove libbanshee.
* Makefile.tpl: Ditto.
* configure.in: Ditto.
* Makefile.in: Regen.
* configure: Ditto.
gcc/
2004-09-09 Daniel Berlin <dberlin@dberlin.org>
* Makefile.in: Remove libbanshee, tree-alias-*.
Remove tree-alias-common.h dependencies.
* common.opt: Remove -ftree-points-to.
* configure.ac: Remove libbanshee.
* flags.h: Remove pta_type, flag_tree_points_to.
* gengtype.c (open_base_files): Remove tree-alias-type.h.
* opts.c (OPT_ftree_points_to): Remove.
* toplev.c: Remove tree-alias-common.h, flag_tree_points_to.
* tree-dfa.c: Remove tree-alias-common.h
* tree-into-ssa.c: Ditto.
* tree-outof-ssa.c: Ditto.
* tree-ssa-copyrename.c: Ditto.
* tree-ssa-live.c: Ditto.
* tree-optimize.c: Ditto.
* tree-ssa.c: Ditto.
Remove pass_build_pta, pass_del_pta.
* tree-pass.h: Ditto.
* tree-ssa-alias.c: Remove tree-alias-common.h.
(struct alias_stats_d): Remove pta_queries, pta_resolved.
(pass_may_alias): Remove PROP_pta requirement.
(may_alias_p): Remove pta_queries, pta_resolved, use of andersens.
(get_tmt_for): Ditto.
(dump_alias_stats): Ditto.
* doc/passes.texi: Remove blurb about points-to analysis.
* fortran/Make-lang.in: Remove tree-alias-*.o.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87253 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 28 | ||||
-rw-r--r-- | gcc/Makefile.in | 51 | ||||
-rw-r--r-- | gcc/common.opt | 3 | ||||
-rwxr-xr-x | gcc/configure | 40 | ||||
-rw-r--r-- | gcc/configure.ac | 22 | ||||
-rw-r--r-- | gcc/doc/passes.texi | 6 | ||||
-rw-r--r-- | gcc/flags.h | 8 | ||||
-rw-r--r-- | gcc/fortran/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/gengtype.c | 2 | ||||
-rw-r--r-- | gcc/opts.c | 16 | ||||
-rw-r--r-- | gcc/toplev.c | 4 | ||||
-rw-r--r-- | gcc/tree-alias-ander.c | 933 | ||||
-rw-r--r-- | gcc/tree-alias-ander.h | 29 | ||||
-rw-r--r-- | gcc/tree-alias-common.c | 1251 | ||||
-rw-r--r-- | gcc/tree-alias-common.h | 123 | ||||
-rw-r--r-- | gcc/tree-alias-type.c | 37 | ||||
-rw-r--r-- | gcc/tree-alias-type.h | 68 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 1 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 1 | ||||
-rw-r--r-- | gcc/tree-optimize.c | 3 | ||||
-rw-r--r-- | gcc/tree-outof-ssa.c | 1 | ||||
-rw-r--r-- | gcc/tree-pass.h | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 25 | ||||
-rw-r--r-- | gcc/tree-ssa-copyrename.c | 1 | ||||
-rw-r--r-- | gcc/tree-ssa-live.c | 1 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 1 |
26 files changed, 50 insertions, 2609 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ba72d1c2766..99aab874f9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2004-09-09 Daniel Berlin <dberlin@dberlin.org> + + * Makefile.in: Remove libbanshee, tree-alias-*. + Remove tree-alias-common.h dependencies. + * common.opt: Remove -ftree-points-to. + * configure.ac: Remove libbanshee. + * flags.h: Remove pta_type, flag_tree_points_to. + * gengtype.c (open_base_files): Remove tree-alias-type.h. + * opts.c (OPT_ftree_points_to): Remove. + * toplev.c: Remove tree-alias-common.h, flag_tree_points_to. + * tree-dfa.c: Remove tree-alias-common.h + * tree-into-ssa.c: Ditto. + * tree-outof-ssa.c: Ditto. + * tree-ssa-copyrename.c: Ditto. + * tree-ssa-live.c: Ditto. + * tree-optimize.c: Ditto. + * tree-ssa.c: Ditto. + Remove pass_build_pta, pass_del_pta. + * tree-pass.h: Ditto. + * tree-ssa-alias.c: Remove tree-alias-common.h. + (struct alias_stats_d): Remove pta_queries, pta_resolved. + (pass_may_alias): Remove PROP_pta requirement. + (may_alias_p): Remove pta_queries, pta_resolved, use of andersens. + (get_tmt_for): Ditto. + (dump_alias_stats): Ditto. + * doc/passes.texi: Remove blurb about points-to analysis. + * fortran/Make-lang.in: Remove tree-alias-*.o. + 2004-09-09 Richard Sandiford <rsandifo@redhat.com> * genattrtab.c (write_insn_cases): New function, split out from diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 89f0ca1cd7b..01c771775a3 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -200,8 +200,6 @@ SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error # recognizing that the loop will always be executed at least once. We need # a new loop optimizer. reload1.o-warn = -Wno-error -# These warnings are due to libbanshee. -tree-alias-ander.o-warn = -Wno-error # All warnings have to be shut off in stage1 if the compiler used then # isn't gcc; configure determines that. WARN_CFLAGS will be either @@ -286,9 +284,6 @@ ZLIBINC = @zlibinc@ GMPLIBS = @GMPLIBS@ GMPINC = @GMPINC@ -BANSHEELIB = @BANSHEELIB@ -BANSHEEINC = @BANSHEEINC@ - CPPLIB = ../libcpp/libcpp.a CPPINC = -I$(srcdir)/../libcpp/include @@ -757,7 +752,7 @@ LIBIBERTY = ../libiberty/libiberty.a BUILD_LIBIBERTY = ../$(build_subdir)/libiberty/libiberty.a # Dependencies on the intl and portability libraries. -LIBDEPS= $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) $(BANSHEELIB) +LIBDEPS= $(CPPLIB) $(LIBIBERTY) $(LIBINTL_DEP) $(LIBICONV_DEP) # Likewise, for use in the tools that must run on this machine # even if we are cross-building GCC. @@ -765,7 +760,7 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY) # How to link with both our special library facilities # and the system's installed libraries. -LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(BANSHEELIB) $(LIBIBERTY) +LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) # Any system libraries needed just for GNAT. SYSLIBS = @GNAT_LIBEXC@ @@ -794,7 +789,7 @@ BUILD_VARRAY = build-varray.o # libintl.h will be found in ../intl if we are using the included libintl. INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ -I$(srcdir)/../include @INCINTL@ \ - $(CPPINC) $(BANSHEEINC) $(GMPINC) + $(CPPINC) $(GMPINC) .c.o: $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) @@ -890,9 +885,9 @@ C_OBJS = c-parse.o c-lang.o stub-objc.o $(C_AND_OBJC_OBJS) OBJS-common = \ tree-chrec.o tree-scalar-evolution.o tree-data-ref.o \ tree-cfg.o tree-dfa.o tree-eh.o tree-ssa.o tree-optimize.o tree-gimple.o \ - tree-alias-type.o gimplify.o tree-pretty-print.o tree-into-ssa.o \ - tree-outof-ssa.o tree-alias-common.o tree-ssa-ccp.o tree-vn.o \ - @ANDER@ tree-ssa-dce.o tree-ssa-copy.o tree-nrv.o tree-ssa-copyrename.o \ + gimplify.o tree-pretty-print.o tree-into-ssa.o \ + tree-outof-ssa.o tree-ssa-ccp.o tree-vn.o \ + tree-ssa-dce.o tree-ssa-copy.o tree-nrv.o tree-ssa-copyrename.o \ tree-ssa-pre.o tree-ssa-live.o tree-ssa-operands.o tree-ssa-alias.o \ tree-ssa-phiopt.o tree-ssa-forwprop.o tree-nested.o tree-ssa-dse.o \ tree-ssa-dom.o domwalk.o tree-tailcall.o gimple-low.o tree-iterator.o \ @@ -1556,7 +1551,7 @@ gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ varray.h $(HASHTAB_H) $(SPLAY_TREE_H) bitmap.h $(TREE_H) $(RTL_H) \ function.h insn-config.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \ cselib.h insn-addr.h $(OPTABS_H) libfuncs.h debug.h $(GGC_H) \ - cgraph.h tree-alias-type.h $(TREE_FLOW_H) reload.h $(CPP_ID_DATA_H) + cgraph.h $(TREE_FLOW_H) reload.h $(CPP_ID_DATA_H) ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \ $(HASHTAB_H) toplev.h $(PARAMS_H) hosthooks.h @@ -1599,31 +1594,19 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(PARAMS_H) $(FLAGS_H) function.h $(EXPR_H) $(RTL_H) toplev.h \ $(GGC_H) $(TM_P_H) $(TARGET_H) \ langhooks.h $(REGS_H) -tree-alias-type.o: tree-alias-type.c tree-alias-type.h $(SYSTEM_H) $(CONFIG_H) \ - $(GGC_H) $(TM_H) coretypes.h $(VARRAY_H) -tree-alias-ander.o: tree-alias-ander.c tree-alias-ander.h $(SYSTEM_H) \ - $(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) tree-alias-common.h \ - $(TM_H) coretypes.h cgraph.h tree-pass.h -tree-alias-common.o: tree-alias-common.c tree-alias-common.h $(SYSTEM_H) \ - $(CONFIG_H) $(GGC_H) $(TREE_H) gt-tree-alias-common.h $(TREE_FLOW_H) \ - $(TM_H) coretypes.h cgraph.h tree-pass.h $(TIMEVAR_H) tree-alias-type.h \ - bitmap.h tree-alias-ander.h $(FLAGS_H) $(RTL_H) $(TM_P_H) \ - hard-reg-set.h $(BASIC_BLOCK_H) output.h errors.h $(EXPR_H) \ - $(DIAGNOSTIC_H) $(C_COMMON_H) tree-inline.h varray.h $(C_TREE_H) \ - $(TREE_GIMPLE_H) $(HASHTAB_H) function.h tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \ - errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \ + errors.h toplev.h function.h $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h $(CFGLOOP_H) \ tree-pass.h tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \ - errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \ + errors.h toplev.h function.h $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h domwalk.h tree-pass.h \ $(GGC_H) tree-outof-ssa.o : tree-outof-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h diagnostic.h \ - errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \ + errors.h toplev.h function.h $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) langhooks.h domwalk.h \ tree-pass.h $(TREE_SSA_LIVE_H) tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ @@ -1665,12 +1648,12 @@ domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) domwalk.h $(GGC_H) tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \ - errors.h toplev.h function.h $(TIMEVAR_H) tree-alias-common.h \ + errors.h toplev.h function.h $(TIMEVAR_H) \ $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H) tree-ssa-copyrename.o : tree-ssa-copyrename.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h \ diagnostic.h errors.h toplev.h function.h $(TIMEVAR_H) tree-pass.h \ - tree-alias-common.h $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H) + $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_SSA_LIVE_H) tree-ssa-pre.o : tree-ssa-pre.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \ $(GGC_H) output.h diagnostic.h errors.h toplev.h $(TIMEVAR_H) \ @@ -1697,7 +1680,7 @@ tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) output.h diagnostic.h \ errors.h tree-inline.h $(HASHTAB_H) $(FLAGS_H) function.h $(TIMEVAR_H) \ - tree-alias-common.h convert.h $(TM_H) coretypes.h langhooks.h \ + convert.h $(TM_H) coretypes.h langhooks.h \ $(TREE_DUMP_H) tree-pass.h params.h tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(GGC_H) diagnostic.h errors.h \ @@ -1736,11 +1719,11 @@ tree-ssa-loop-im.o : tree-ssa-loop-im.c $(TREE_FLOW_H) $(CONFIG_H) \ tree-pass.h flags.h tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) tree-inline.h $(FLAGS_H) \ - function.h $(TIMEVAR_H) tree-alias-common.h convert.h $(TM_H) coretypes.h \ + function.h $(TIMEVAR_H) convert.h $(TM_H) coretypes.h \ langhooks.h $(TREE_DUMP_H) tree-pass.h params.h tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) \ $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \ - $(GGC_H) output.h diagnostic.h errors.h $(FLAGS_H) tree-alias-common.h \ + $(GGC_H) output.h diagnostic.h errors.h $(FLAGS_H) \ $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) toplev.h function.h \ langhooks.h $(FLAGS_H) cgraph.h tree-inline.h tree-mudflap.h $(GGC_H) \ cgraph.h tree-pass.h @@ -2430,8 +2413,6 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/tree-phinodes.c $(srcdir)/tree-cfg.c \ $(srcdir)/tree-dfa.c $(srcdir)/tree-ssa-propagate.c \ $(srcdir)/tree-iterator.c $(srcdir)/gimplify.c \ - $(srcdir)/tree-alias-type.h $(srcdir)/tree-alias-common.h \ - $(srcdir)/tree-alias-type.c $(srcdir)/tree-alias-common.c \ $(srcdir)/tree-chrec.h \ $(srcdir)/tree-ssa-operands.h $(srcdir)/tree-ssa-operands.c \ $(srcdir)/tree-profile.c $(srcdir)/rtl-profile.c $(srcdir)/tree-nested.c \ @@ -2451,7 +2432,7 @@ gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dojump.h \ gt-dwarf2out.h gt-ra-build.h gt-reg-stack.h gt-dwarf2asm.h \ gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parse.h \ gt-c-pragma.h gtype-c.h gt-input.h gt-cfglayout.h \ -gt-tree-alias-common.h gt-tree-mudflap.h \ +gt-tree-mudflap.h \ gt-tree-ssa-ccp.h gt-tree-eh.h \ gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \ gt-tree-phinodes.h gt-tree-cfg.h gt-tree-nested.h \ diff --git a/gcc/common.opt b/gcc/common.opt index 77862f07e34..619740c24de 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -876,9 +876,6 @@ ftree-loop-optimize Common Report Var(flag_tree_loop_optimize) Init(1) Enable loop optimizations on tree level -ftree-points-to= -Common Joined RejectNegative - ftree-pre Common Report Var(flag_tree_pre) Enable SSA-PRE optimization on trees diff --git a/gcc/configure b/gcc/configure index 617d8af55ee..e44ca74819f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -309,7 +309,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag TREEBROWSER EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2 libgcc_visibility GGC zlibdir zlibinc MAINT ANDER BANSHEEINC BANSHEELIB gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical build_subdir host_subdir target_subdir GENINSRC CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT NO_MINUS_C_MINUS_O OUTPUT_OPTION CPP strict1_warn warn_cflags WERROR nocommon_flag TREEBROWSER EGREP valgrind_path valgrind_path_defines valgrind_command coverage_flags enable_multilib enable_shared TARGET_SYSTEM_ROOT TARGET_SYSTEM_ROOT_DEFINE CROSS_SYSTEM_HEADER_DIR onestep SET_MAKE AWK LN_S LN RANLIB ac_ct_RANLIB ranlib_flags INSTALL INSTALL_PROGRAM INSTALL_DATA make_compare_target have_mktemp_command MAKEINFO BUILD_INFO GENERATED_MANPAGES FLEX BISON NM AR stage1_cflags COLLECT2_LIBS GNAT_LIBEXC LDEXP_LIB TARGET_GETGROUPS_T LIBICONV LIBICONV_DEP manext objext gthread_flags extra_modes_file PACKAGE VERSION USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS CROSS ALL SYSTEM_HEADER_DIR inhibit_libc CC_FOR_BUILD BUILD_CFLAGS STMP_FIXINC STMP_FIXPROTO collect2 libgcc_visibility GGC zlibdir zlibinc MAINT gcc_tooldir dollar slibdir objdir subdirs srcdir all_boot_languages all_compilers all_gtfiles all_gtfiles_files_langs all_gtfiles_files_files all_lang_makefrags all_lang_makefiles all_languages all_stagestuff build_exeext build_install_headers_dir build_xm_file_list build_xm_include_list build_xm_defines check_languages cc_set_by_configure quoted_cc_set_by_configure cpp_install_dir xmake_file tmake_file extra_gcc_objs extra_headers_list extra_objs extra_parts extra_passes extra_programs float_h_file gcc_config_arguments gcc_gxx_include_dir libstdcxx_incdir gcc_version gcc_version_full gcc_version_trigger host_exeext host_xm_file_list host_xm_include_list host_xm_defines out_host_hook_obj install lang_opt_files lang_specs_files lang_tree_files local_prefix md_file objc_boehm_gc out_file out_object_file stage_prefix_set_by_configure quoted_stage_prefix_set_by_configure symbolic_link thread_file tm_file_list tm_include_list tm_defines tm_p_file_list tm_p_include_list xm_file_list xm_include_list xm_defines c_target_objs cxx_target_objs target_cpu_default GMPLIBS GMPINC LIBOBJS LTLIBOBJS' ac_subst_files='language_hooks' # Initialize some variables set by options. @@ -925,7 +925,6 @@ Optional Packages: --with-gc={page,zone} choose the garbage collection mechanism to use with the compiler --with-system-zlib use installed libz - --with-libbanshee enable libbanshee --with-slibdir=DIR shared libraries in DIR LIBDIR Some influential environment variables: @@ -5291,7 +5290,7 @@ if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:5294: version of makeinfo is $ac_prog_version" >&5 + echo "configure:5293: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[2-9]*) @@ -12186,38 +12185,6 @@ else MAINT='#' fi -echo "$as_me:$LINENO: checking whether to use libbanshee for points-to alias analysis" >&5 -echo $ECHO_N "checking whether to use libbanshee for points-to alias analysis... $ECHO_C" >&6 - -# Check whether --with-libbanshee or --without-libbanshee was given. -if test "${with_libbanshee+set}" = set; then - withval="$with_libbanshee" - libbanshee="$with_libbanshee" -else - libbanshee=no -fi; - -if test x"$libbanshee" = xyes; then - BANSHEELIB="../libbanshee/points-to/libandersen.a ../libbanshee/engine/libbansheeengine.a ../libbanshee/libcompat/libbansheecompat.a " - BANSHEEINC="-I\$(srcdir)/../libbanshee/libcompat -I\$(srcdir)/../libbanshee -I\$(srcdir)/../libbanshee/points-to" - ANDER="tree-alias-ander.o" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_BANSHEE 1 -_ACEOF - -else - BANSHEELIB="" - BANSHEEINC="" - ANDER="" -fi -echo "$as_me:$LINENO: result: $with_libbanshee" >&5 -echo "${ECHO_T}$with_libbanshee" >&6 - - - - - # -------------- # Language hooks # -------------- @@ -13250,9 +13217,6 @@ s,@GGC@,$GGC,;t t s,@zlibdir@,$zlibdir,;t t s,@zlibinc@,$zlibinc,;t t s,@MAINT@,$MAINT,;t t -s,@ANDER@,$ANDER,;t t -s,@BANSHEEINC@,$BANSHEEINC,;t t -s,@BANSHEELIB@,$BANSHEELIB,;t t s,@gcc_tooldir@,$gcc_tooldir,;t t s,@dollar@,$dollar,;t t s,@slibdir@,$slibdir,;t t diff --git a/gcc/configure.ac b/gcc/configure.ac index fc1fb98230c..6dbb8021460 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2973,28 +2973,6 @@ else fi AC_SUBST(MAINT)dnl -AC_MSG_CHECKING([whether to use libbanshee for points-to alias analysis]) -AC_ARG_WITH(libbanshee, -[ --with-libbanshee enable libbanshee], -libbanshee="$with_libbanshee", -libbanshee=no) - -if test x"$libbanshee" = xyes; then - BANSHEELIB="../libbanshee/points-to/libandersen.a ../libbanshee/engine/libbansheeengine.a ../libbanshee/libcompat/libbansheecompat.a " - BANSHEEINC="-I\$(srcdir)/../libbanshee/libcompat -I\$(srcdir)/../libbanshee -I\$(srcdir)/../libbanshee/points-to" - ANDER="tree-alias-ander.o" - AC_DEFINE(HAVE_BANSHEE, 1, [Define if BANSHEE is available]) -else - BANSHEELIB="" - BANSHEEINC="" - ANDER="" -fi -AC_MSG_RESULT($with_libbanshee) - -AC_SUBST(ANDER) -AC_SUBST(BANSHEEINC) -AC_SUBST(BANSHEELIB) - # -------------- # Language hooks # -------------- diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi index 4937d721224..0ffeae757e9 100644 --- a/gcc/doc/passes.texi +++ b/gcc/doc/passes.texi @@ -240,12 +240,6 @@ for the variable within this function. This data is needed by the SSA rewriting routines. The pass is located in @file{tree-dfa.c} and is described by @code{pass_referenced_vars}. -@item Points-to analysis - -This pass constructs flow-insensitive alias analysis information. -The pass is located in @file{tree-alias-common.c} and described by -@code{pass_build_pta}. - @item Enter static single assignment form This pass rewrites the function such that it is in SSA form. After diff --git a/gcc/flags.h b/gcc/flags.h index fb240356f7a..78c6d5a8885 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -240,14 +240,6 @@ extern enum graph_dump_types graph_dump_format; and to print them when we are done. */ extern int flag_detailed_statistics; -/* Enable points-to analysis on trees. */ -enum pta_type - { - PTA_NONE, - PTA_ANDERSEN - }; -extern enum pta_type flag_tree_points_to; - extern int flag_web; /* Nonzero means that we defer emitting functions until they are actually diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index 1649f328eea..9517f56ffa6 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -83,7 +83,7 @@ F95_OBJS = $(F95_PARSER_OBJS) \ F95_ADDITIONAL_OBJS = \ tree-cfg.o tree-dfa.o tree-optimize.o tree-gimple.o \ tree-ssa.o tree-ssa-ccp.o tree-ssa-dce.o \ - tree-alias-common.o tree-alias-type.o gimplify.o stor-layout.o + gimplify.o stor-layout.o # GFORTRAN uses GMP for its internal arithmetics. F95_LIBS = $(GMPLIBS) $(LIBS) diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 01040cc82b2..aaf69f42f14 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1085,7 +1085,7 @@ open_base_files (void) "function.h", "insn-config.h", "expr.h", "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", - "tree-alias-type.h", "tree-flow.h", "reload.h", + "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", NULL diff --git a/gcc/opts.c b/gcc/opts.c index e0271287c5e..d570b8fe7f0 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -954,22 +954,6 @@ common_handle_option (size_t scode, const char *arg, int value) flag_tracer_set = true; break; - case OPT_ftree_points_to_: - if (!strcmp (arg, "andersen")) -#ifdef HAVE_BANSHEE - flag_tree_points_to = PTA_ANDERSEN; -#else - warning ("Andersen's PTA not available - libbanshee not compiled."); -#endif - else if (!strcmp (arg, "none")) - flag_tree_points_to = PTA_NONE; - else - { - warning ("`%s`: unknown points-to analysis algorithm", arg); - return 0; - } - break; - case OPT_funroll_loops: flag_unroll_loops_set = true; break; diff --git a/gcc/toplev.c b/gcc/toplev.c index b0a297b991f..eeb111df3c5 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -74,7 +74,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "target.h" #include "langhooks.h" #include "cfglayout.h" -#include "tree-alias-common.h" #include "cfgloop.h" #include "hosthooks.h" #include "cgraph.h" @@ -332,9 +331,6 @@ rtx stack_limit_rtx; one, unconditionally renumber instruction UIDs. */ int flag_renumber_insns = 1; -/* Enable points-to analysis on trees. */ -enum pta_type flag_tree_points_to = PTA_NONE; - /* Nonzero if we should track variables. When flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according to optimize, debug_info_level and debug_hooks in process_options (). */ diff --git a/gcc/tree-alias-ander.c b/gcc/tree-alias-ander.c deleted file mode 100644 index 471a7fd99f3..00000000000 --- a/gcc/tree-alias-ander.c +++ /dev/null @@ -1,933 +0,0 @@ -/* Tree based Andersen points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "ggc.h" -#include "bitmap.h" -#include "tree-alias-type.h" -#include "tree-alias-ander.h" -#include "flags.h" -#include "rtl.h" -#include "tm_p.h" -#include "hard-reg-set.h" -#include "basic-block.h" -#include "output.h" -#include "errors.h" -#include "expr.h" -#include "diagnostic.h" -#include "tree.h" -#include "tree-flow.h" -#include "tree-inline.h" -#include "varray.h" -#include "tree-gimple.h" -#include "splay-tree.h" -#include "engine/util.h" -#include "libcompat/regions.h" -#include "andersen_terms.h" -#include "cgraph.h" -#include "tree-pass.h" - - -/* Andersen's interprocedural points-to analysis. - This is a flow-insensitive, context insensitive algorithm. - - This file is an implementation of the alias_ops structure used by - tree-alias-common.c to drive PTA analysis. - - All these functions do is generate constraints for and through - libbanshee. When we query for a points-to set, we ask libbanshee - to solve the constraints and give us the answer. The terms of the - constraints are the aterms, which are an opaque data structure - that stores libbanshee specific data for the constraints. - - The constraints to be generated come from andersen's paper. By - constraint, we mean something like "the points-to set of A must be - a subset or equal to the points-to set of B" or "the points-to set - of A must include Q". In order to avoid having to write all the - constraints directly in the code, we use helper functions such as - pta_assignment, pta_rvalue, etc, that generate the necessary - constraint terms for us, making for much more readable code. - - One could replace libbanshee with some other constraint solving - engine, and you'd simply have to replace the implementation of the - pta_* functions, and provide replacements for the aterm specific - functions (like making a list of aterms, printing the label of an - aterm). However, libbanshee is extremely fast, and extremely low - memory usage, so one would be hard pressed to do better than it - anyway. - - Understanding how constraint solving and what each constraint means is - beyond the scope of this documentation. See the libbanshee - documentation, and references therein for more enlightenment. - - That said, our constraints inclusion constraints of set - expressions. Given the helper functions, the various inference - functions we implement should *look* relatively straightforward. - - In order to save time during queries, we cache the resulting - points-to sets of each variable, rather than recalculate them - again and again. (libbanshee actually has it's own internal - caching, but the function call overhead for calling the solver is - non-trivial, given the number of queries). - - Todo: Don't pass alias ops as first argument, just have a global - "current_alias_ops". */ - -static unsigned int id_num = 1; -static region andersen_rgn; -static void andersen_simple_assign (struct tree_alias_ops *, - alias_var, alias_var); -static void andersen_addr_assign (struct tree_alias_ops *, - alias_var, alias_var); -static void andersen_ptr_assign (struct tree_alias_ops *, - alias_var, alias_var); -static void andersen_op_assign (struct tree_alias_ops *, - alias_var, varray_type, tree, bitmap); -static void andersen_heap_assign (struct tree_alias_ops *, alias_var); -static void andersen_assign_ptr (struct tree_alias_ops *, - alias_var, alias_var); -static void andersen_function_def (struct tree_alias_ops *, alias_var, - varray_type, alias_var); -static int andersen_function_call (struct tree_alias_ops *, alias_var, - alias_var, varray_type, bitmap); -static void andersen_init (struct tree_alias_ops *); -static int print_out_result (splay_tree_node, void *); -static void andersen_cleanup (struct tree_alias_ops *); -static bool andersen_may_alias (struct tree_alias_ops *, alias_var, - alias_var); -static bool andersen_same_points_to_set (struct tree_alias_ops *, - alias_var, alias_var); -static bool andersen_empty_points_to_set (struct tree_alias_ops *, - alias_var); -static alias_var andersen_add_var (struct tree_alias_ops *, tree); -static alias_var andersen_add_var_same (struct tree_alias_ops *, - tree, alias_var); -static bool pointer_destroying_op (tree); -static aterm_list get_ptset (alias_var); -static splay_tree ptamap; - - -static struct tree_alias_ops andersen_ops = { - andersen_init, - andersen_cleanup, - andersen_add_var, - andersen_add_var_same, - andersen_simple_assign, - andersen_addr_assign, - andersen_ptr_assign, - andersen_op_assign, - andersen_heap_assign, - andersen_assign_ptr, - andersen_function_def, - andersen_function_call, - andersen_may_alias, - andersen_same_points_to_set, - andersen_empty_points_to_set, - 0, /* data */ - 0, /* Currently non-interprocedural */ - 1 /* Can do IP on all statics without help. */ -}; -struct tree_alias_ops *andersen_alias_ops = &andersen_ops; - -static void term_inclusion (aterm, aterm); -static void pta_init (void); -static void pta_reset (void); -static aterm get_ref (aterm); -static argterm fun_rec_aterm (aterm_list); -static aterm pta_make_lam (const char *, aterm, aterm_list); -static aterm pta_make_ref (const char *); -static aterm pta_bottom (void); -static aterm pta_join (aterm, aterm); -static aterm pta_deref (aterm); -static aterm pta_rvalue (aterm); -static aterm pta_address (aterm); -static void pta_assignment (aterm, aterm); -static aterm pta_make_fun (const char *, aterm, aterm_list); -static aterm pta_application (aterm, aterm_list); - -typedef aterm contents_type; -static contents_type pta_get_contents (aterm); -static void pr_ptset_aterm_elem (aterm); -static void pta_pr_ptset (contents_type); - -/* Hook for debugging. This function is called instead of - aterm_inclusion, and lets us print the actual constraints as they - are generated. */ - -static void -term_inclusion (aterm t1, aterm t2) -{ - if (dump_file) - { - fprintf (dump_file, "Constraint: "); - aterm_print (dump_file, t1); - fprintf (dump_file, " <= "); - aterm_print (dump_file, t2); - fprintf (dump_file, "\n"); - } - - aterm_inclusion (t1, t2); -} - -/* Initialize libbanshee's constraint engine. */ - -static void -pta_init (void) -{ - andersen_terms_init (); -} - -/* Reset libbanshee's constraint engine. We do this when we are done - using it, as it releases the memory libbanshee is using. */ - -static void -pta_reset (void) -{ - andersen_terms_reset (); -} - -static aterm -get_ref (aterm t) -{ - struct ref_decon r_decon; - r_decon = ref_decon (t); - - assert (r_decon.f1); - - return r_decon.f1; -} - -/* Make a function record out of the arguments. */ - -static argterm -fun_rec_aterm (aterm_list args) -{ - region scratch; - int counter = 0; - argterm rest, result; - aterm_list_scanner scan; - aterm temp; - char field_name[512]; - argterm_map map; - - scratch = newregion (); - map = new_argterm_map (scratch); - aterm_list_scan (args, &scan); - while (aterm_list_next (&scan, &temp)) - { - snprintf (field_name, 512, "%d", counter++); - argterm_map_cons (argterm_make_field (field_name, temp), map); - } - - rest = argterm_wild (); - /* rest = argterm_fresh(); */ - - /* safe since field_add makes a copy of the string*/ - result = argterm_row (map, rest); - - deleteregion (scratch); - - return result; -} - - -static aterm -pta_make_lam (const char *id, aterm ret, aterm_list args) -{ - return lam (label_term_constant (id), fun_rec_aterm (args), ret); -} - -/* Make a label reference to the given id. */ - -static aterm -pta_make_ref (const char *id) -{ - - aterm var = aterm_fresh (id); - - label_term tag = label_term_constant (id); - - return ref (tag, var, var); -} - -/* Return the empty set. */ - -static aterm -pta_bottom (void) -{ - return aterm_zero (); -} - -/* Join two terms, such that anything in set t1 will also be in set - t2, and vice versa. */ - -static aterm -pta_join (aterm t1, aterm t2) -{ - aterm result; - region scratch_rgn = newregion (); - aterm_list list = new_aterm_list (scratch_rgn); - - aterm_list_cons (t1, list); - aterm_list_cons (t2, list); - - - result = aterm_union (list); - deleteregion (scratch_rgn); - - return result; -} - -/* Generate the constraint for a dereference of term t1. */ - -static aterm -pta_deref (aterm t1) -{ - return ref_proj2 (t1); -} - -/* Generate the constraint for t1 being an rvalue. */ - -static aterm -pta_rvalue (aterm t1) -{ - return pta_deref (t1); -} - -/* Generate the constraint for taking the address of t1. */ - -static aterm -pta_address (aterm t1) -{ - return ref (label_term_one (), aterm_one (), t1); -} - -/* Generate the constraint for assigning t2 to t1. */ - -static void -pta_assignment (aterm t1, aterm t2) -{ - term_inclusion (t1, ref_pat1 (t2)); -} - -/* Make a function from the given name, return value, and arguments. */ - -static aterm -pta_make_fun (const char *name, aterm ret, aterm_list args) -{ - aterm temp; - aterm_list_scanner scan; - region scratch_rgn = newregion (); - aterm_list arg_list = new_aterm_list (scratch_rgn); - - aterm_list_scan (args, &scan); - - while (aterm_list_next (&scan, &temp)) - { - aterm_list_cons (get_ref (temp), arg_list); - } - - return pta_make_lam (name, get_ref (ret), arg_list); -} - -/* Return the constraint for calling function T with arguments - ACTUALS. */ - -static aterm -pta_application (aterm t, aterm_list actuals) -{ - argterm args = fun_rec_aterm (actuals); - - term_inclusion (t, lam_pat1 (args)); - return pta_address (lam_proj2 (t)); -} - -/* Return the contents of set expression T. */ - -static contents_type -pta_get_contents (aterm t) -{ - struct ref_decon t_decon; - t_decon = ref_decon (t); - - return t_decon.f1; -} - -/* Print out a points-to set element. */ - -static void -pr_ptset_aterm_elem (aterm t) -{ - struct ref_decon ref; - struct lam_decon lam; - - ref = ref_decon (t); - lam = lam_decon (t); - - fprintf (dump_file, ","); - if (ref.f0) - label_term_print (dump_file, ref.f0); - else if (lam.f0) - label_term_print (dump_file, lam.f0); -} - - -/* Print out a points-to set. */ - -static void -pta_pr_ptset (contents_type t) -{ - int size; - region scratch_rgn; - aterm_list ptset; - scratch_rgn = newregion (); - ptset = aterm_list_copy (scratch_rgn, aterm_tlb (t)); - - size = aterm_list_length (ptset); - - fprintf (dump_file, "{"); - if (!aterm_list_empty (ptset)) - { - struct ref_decon ref; - struct lam_decon lam; - ref = ref_decon (aterm_list_head (ptset)); - lam = lam_decon (aterm_list_head (ptset)); - if (ref.f0) - label_term_print (dump_file, ref.f0); - else if (lam.f0) - label_term_print (dump_file, lam.f0); - - /* aterm_pr(stdout,aterm_hd(ptset)); */ - ptset = aterm_list_tail (ptset); - } - aterm_list_app (ptset, pr_ptset_aterm_elem); - fprintf (dump_file, "}(%d)\n", size); - deleteregion (scratch_rgn); -} - -/* Initialize Andersen alias analysis. */ -static int initted = 0; - -static void -andersen_init (struct tree_alias_ops *ops ATTRIBUTE_UNUSED) -{ -#if 0 - /* Don't claim we can do ip partial unless we have unit_at_a_time on. */ - if (!flag_unit_at_a_time) -#endif - andersen_ops.ip_partial = 0; - if (!initted || (!andersen_ops.ip_partial && !andersen_ops.ip)) - { - pta_init (); - andersen_rgn = newregion (); - initted = 1; - } - - ptamap = splay_tree_new (splay_tree_compare_pointers, NULL, NULL); - -} - -static int -print_out_result (splay_tree_node node, void *data ATTRIBUTE_UNUSED) -{ - fprintf (dump_file, "%s :=", - alias_get_name (ALIAS_VAR_DECL (((alias_var) node->value)))); - pta_pr_ptset (pta_get_contents ((aterm) node->key)); - return 0; -} - -/* Cleanup after Andersen alias analysis. */ - -static void -andersen_cleanup (struct tree_alias_ops *ops ATTRIBUTE_UNUSED) -{ - if (dump_file) - { - if (dump_flags & TDF_STATS) - { - fprintf (dump_file, "\nPoints-to stats:\n"); - andersen_terms_stats (dump_file); - } - - fprintf (dump_file, "\nPoints-to sets:\n"); - splay_tree_foreach (ptamap, print_out_result, NULL); - } - - splay_tree_delete (ptamap); - - if (!andersen_ops.ip_partial && !andersen_ops.ip) - { - pta_reset (); - deleteregion (andersen_rgn); - andersen_rgn = NULL; - } -} - -/* Add decl to the analyzer, and return a var for it. For - Andersen, we create a new alias var for the declaration, and - return that. */ - -static alias_var -andersen_add_var (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl) -{ - alias_var ret; - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Adding variable %s\n", - alias_get_name (decl)); - - if (alias_get_name (decl) != NULL) - { - ret = alias_var_new_with_aterm (decl, - pta_make_ref (alias_get_name (decl))); - } - else - { - char *tmp_name; - ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++); - ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name)); - } - splay_tree_insert (ptamap, (splay_tree_key) ALIAS_VAR_ATERM (ret), - (splay_tree_value) ret); - ALIAS_VAR_PTSET (ret) = NULL; - - return ret; -} - -/* Add a variable to the analyzer that is equivalent (as far as - aliases go) to some existing alias variable. - For Andersen, we just call a function that does this for us. */ - -static alias_var -andersen_add_var_same (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, tree decl, - alias_var tv) -{ - alias_var ret; - - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Adding variable %s same as %s\n", - alias_get_name (decl), alias_get_name (ALIAS_VAR_DECL (tv))); - - if (alias_get_name (decl) != NULL) - ret = alias_var_new_with_aterm (decl, - pta_make_ref (alias_get_name (decl))); - else - { - char *tmp_name; - ASM_FORMAT_PRIVATE_NAME (tmp_name, "unnamed var", id_num++); - ret = alias_var_new_with_aterm (decl, pta_make_ref (tmp_name)); - } - - pta_join (ALIAS_VAR_ATERM (tv), ALIAS_VAR_ATERM (ret)); - splay_tree_insert (ptamap, (splay_tree_key) ALIAS_VAR_ATERM (ret), - (splay_tree_value) ret); - ALIAS_VAR_PTSET (tv) = NULL; - ALIAS_VAR_PTSET (ret) = NULL; - - return ret; -} - -/* Inference for simple assignment (lhs = rhs) */ - -static void -andersen_simple_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs, alias_var rhs) -{ - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Simple assignment %s = %s\n", - alias_get_name (ALIAS_VAR_DECL (lhs)), - alias_get_name (ALIAS_VAR_DECL (rhs))); - if (lhs == rhs) - return; - - /* The rvalue is just the term itself, and we generate a constraint - for assigning it to the lhs. */ - pta_assignment (ALIAS_VAR_ATERM (lhs), - pta_rvalue (ALIAS_VAR_ATERM (rhs))); -} - -/* Inference for address assignment (lhs = &addr) */ - -static void -andersen_addr_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs, alias_var addr) -{ - if (addr == NULL) - return; - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Address assignment %s = &%s\n", - alias_get_name (ALIAS_VAR_DECL (lhs)), - alias_get_name (ALIAS_VAR_DECL (addr))); - - /* The rvalue here is the address of a term, and we generate a - constraint to assign this address to the lhs. */ - pta_assignment (ALIAS_VAR_ATERM (lhs), - pta_rvalue (pta_address (ALIAS_VAR_ATERM (addr)))); -} - - -/* Inference for pointer assignment (lhs = *ptr) */ - -static void -andersen_ptr_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs, alias_var ptr) -{ - - if (ptr == NULL) - return; - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Pointer assignment %s = *%s\n", - alias_get_name (ALIAS_VAR_DECL (lhs)), - alias_get_name (ALIAS_VAR_DECL (ptr))); - - pta_assignment (ALIAS_VAR_ATERM (lhs), - pta_rvalue (pta_deref (ALIAS_VAR_ATERM (ptr)))); - -} - -/* Determine if OP destroys the current assumed to be valid pointer - (whether it generates a new valid pointer is not relevant). */ - -static bool -pointer_destroying_op (tree op) -{ - switch (TREE_CODE (op)) - { - case TRUTH_AND_EXPR: - case TRUTH_OR_EXPR: - case TRUTH_NOT_EXPR: - case LT_EXPR: - case GT_EXPR: - case GE_EXPR: - case LE_EXPR: - case EQ_EXPR: - case NE_EXPR: - case MULT_EXPR: - case TRUNC_DIV_EXPR: - case LSHIFT_EXPR: - case RSHIFT_EXPR: - case LROTATE_EXPR: - case RROTATE_EXPR: - return true; - default: - return false; - } - return false; -} - -/* Inference rule for operations (lhs = operation(operands)). */ - -static void -andersen_op_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs, varray_type operands, tree operation, - bitmap addrargs) -{ - aterm newvar = NULL; - - if (VARRAY_ACTIVE_SIZE (operands) == 0) - return; - - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Op assignment %s = ", - alias_get_name (ALIAS_VAR_DECL (lhs))); - print_generic_stmt (dump_file, operation, dump_flags); - fprintf (dump_file, "\n"); - } - - - /* Pointer destroying operations do not give us the same valid pointer - back, and thus, are assignment to pta_bottom. */ - if (pointer_destroying_op (operation)) - { - pta_assignment (ALIAS_VAR_ATERM (lhs), pta_rvalue (pta_bottom ())); - return; - } - - /* Operations in general we can't track the exact effect of. Thus, - we conservatively assume that it could make the LHS point to - *anything* the RHS points to. To signify this, we join the RHS - variables together and assign it to the LHS. */ - /* The >2 case occurs when we are dealing with constructors. */ - if (VARRAY_ACTIVE_SIZE (operands) > 2) - { - size_t i; - alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0); - newvar = ALIAS_VAR_ATERM (tv1); - for (i = 1; i < VARRAY_ACTIVE_SIZE (operands); i++) - { - alias_var tempvar = VARRAY_GENERIC_PTR (operands, i); - aterm t2 = ALIAS_VAR_ATERM (tempvar); - if (bitmap_bit_p (addrargs, i)) - newvar = pta_join (newvar, pta_address (t2)); - else - newvar = pta_join (newvar, t2); - } - } - else if (VARRAY_ACTIVE_SIZE (operands) == 2) - { - alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0); - alias_var tv2 = VARRAY_GENERIC_PTR (operands, 1); - aterm t1 = ALIAS_VAR_ATERM (tv1); - aterm t2 = ALIAS_VAR_ATERM (tv2); - if (bitmap_bit_p (addrargs, 0) && bitmap_bit_p (addrargs, 1)) - newvar = pta_join (pta_address (t1), pta_address (t2)); - else if (bitmap_bit_p (addrargs, 0)) - newvar = pta_join (pta_address (t1), t2); - else if (bitmap_bit_p (addrargs, 1)) - newvar = pta_join (t1, pta_address (t2)); - else - newvar = pta_join (t1, t2); - } - else if (VARRAY_ACTIVE_SIZE (operands) == 1) - { - alias_var tv1 = VARRAY_GENERIC_PTR (operands, 0); - aterm t1 = ALIAS_VAR_ATERM (tv1); - if (bitmap_bit_p (addrargs, 0)) - newvar = pta_address (t1); - else - newvar = t1; - } - pta_assignment (ALIAS_VAR_ATERM (lhs), pta_rvalue (newvar)); -} - -/* Inference for heap assignment (lhs = alloc). */ - -static void -andersen_heap_assign (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var lhs ATTRIBUTE_UNUSED) -{ -#if 0 - alias_type type1; - ECR tau; - type1 = ECR_get_type (alias_var_get_ECR (lhs)); - tau = alias_ltype_loc (type1); - - if (ECR_get_type (tau) == alias_bottom) - ECR_set_type (tau, alias_ltype_new ()); -#endif -} - -/* Inference for assignment to a pointer (*ptr = rhs). */ - -static void -andersen_assign_ptr (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var ptr, alias_var rhs) -{ - - if (rhs == NULL) - return; - if (dump_file && (dump_flags & TDF_DETAILS)) - fprintf (dump_file, "Assignment to pointer *%s = %s\n", - alias_get_name (ALIAS_VAR_DECL (ptr)), - alias_get_name (ALIAS_VAR_DECL (rhs))); - /* The RHS is a standard rvalue, and the LHS is a pointer - dereference. */ - pta_assignment (pta_deref (ALIAS_VAR_ATERM (ptr)), - pta_rvalue (ALIAS_VAR_ATERM (rhs))); -} - -/* Inference for a function definition. */ - -static void -andersen_function_def (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var func, varray_type params, - alias_var retval) -{ - aterm_list args = new_aterm_list (andersen_rgn); - aterm fun_type; - - size_t l = VARRAY_ACTIVE_SIZE (params); - size_t i; - - /* Set up the arguments for the new function type. */ - for (i = 0; i < l; i++) - { - alias_var tv = VARRAY_GENERIC_PTR (params, i); - aterm_list_cons (ALIAS_VAR_ATERM (tv), args); - } - /* Create the function type. */ - fun_type = pta_make_fun (alias_get_name (ALIAS_VAR_DECL (func)), - ALIAS_VAR_ATERM (retval), args); - - /* Assign the function type itself to the function. */ - pta_assignment (ALIAS_VAR_ATERM (func), fun_type); -} - -/* Inference for a function call assignment. */ - -static int -andersen_function_call (struct tree_alias_ops *ops, - alias_var lhs, alias_var func, - varray_type args, bitmap addrargs) -{ - aterm_list actuals = new_aterm_list (andersen_rgn); - aterm ftype = ALIAS_VAR_ATERM (func); - aterm ret = NULL; - aterm res; - tree decl = ALIAS_VAR_DECL (func); - - size_t i; - - if (lhs) - ret = ALIAS_VAR_ATERM (lhs); - for (i = 0; i < VARRAY_ACTIVE_SIZE (args); i++) - { - alias_var argtv = VARRAY_GENERIC_PTR (args, i); - aterm arg = ALIAS_VAR_ATERM (argtv); - if (bitmap_bit_p (addrargs, i)) - aterm_list_cons (pta_rvalue (pta_address (arg)), actuals); - else - aterm_list_cons (pta_rvalue (arg), actuals); - } - aterm_list_reverse (actuals); - - /* Generate the constraint that calls the function with it's - arguments, and gives us the result. This in turn applies - whatever constraints are in that function. */ - res = pta_application (pta_rvalue (ftype), actuals); - /* We only need care about the result if we have an LHS. If we do, - assign the result of function application back to the LHS. */ - if (ret) - pta_assignment (ret, pta_rvalue (res)); - - /* We can handle functions we've got trees for. non-statics will - just have incoming parameters assigned to global_var if - necessary. */ - if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_PTA_ALIASVAR (decl) - && ops->ip_partial - && (cgraph_local_info (decl)->local)) - { - return 0; - } - return 1; -} - - -/* Simple pointer comparison function for list sorting. */ - -static int -simple_cmp (const aterm a, const aterm b) -{ - return (int *)a - (int *)b; -} - - -/* Get the points-to set for TV, caching if it we had to compute it. */ - -static aterm_list -get_ptset (alias_var tv) -{ - aterm_list ptset; - ptset = ALIAS_VAR_PTSET (tv); - if (ptset != NULL) - return ptset; - ptset = aterm_tlb (pta_get_contents (ALIAS_VAR_ATERM (tv))); - ALIAS_VAR_PTSET (tv) = ptset; - return ptset; -} - - -/* Determine if two aterm's have the same points-to set. */ - -static bool -andersen_same_points_to_set (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var ptrtv, alias_var vartv) -{ - aterm_list ptset1, ptset2; - aterm_list_scanner scan1, scan2; - aterm data1, data2; - region scratch_rgn = newregion (); - - ptset1 = get_ptset (ptrtv); - ptset2 = get_ptset (vartv); - - if (aterm_list_length (ptset1) != aterm_list_length (ptset2)) - { - deleteregion (scratch_rgn); - return false; - } - - if (ptset1 == ptset2) - { - deleteregion (scratch_rgn); - return true; - } - - ptset1 = aterm_list_copy (scratch_rgn, ptset1); - ptset2 = aterm_list_copy (scratch_rgn, ptset2); - - if (aterm_list_length (ptset1) != aterm_list_length (ptset2)) - { - deleteregion (scratch_rgn); - return false; - } - - ptset1 = aterm_list_sort (ptset1, simple_cmp); - ptset2 = aterm_list_sort (ptset2, simple_cmp); - - aterm_list_scan (ptset1, &scan1); - aterm_list_scan (ptset2, &scan2); - while (aterm_list_next (&scan1, &data1)) - { - aterm_list_next (&scan2, &data2); - if (data1 != data2) - { - deleteregion(scratch_rgn); - return false; - } - } - deleteregion(scratch_rgn); - return true; -} - - -/* Determine if two variables may alias. In our case, this means - whether the decl represented by PTRTV can point to VARTV. */ - -static bool -andersen_may_alias (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var ptrtv, alias_var vartv) -{ - aterm_list ptset; - ptset = get_ptset (ptrtv); - - if (aterm_list_empty (ptset)) - return false; - - return aterm_list_member (ptset, ALIAS_VAR_ATERM (vartv)); -} - -/* Determine whether PTRTV has an empty points-to set. IE it may not - point to anything. */ - -static bool -andersen_empty_points_to_set (struct tree_alias_ops *ops ATTRIBUTE_UNUSED, - alias_var ptrtv) -{ - aterm_list ptset; - ptset = get_ptset (ptrtv); - return aterm_list_empty (ptset); -} diff --git a/gcc/tree-alias-ander.h b/gcc/tree-alias-ander.h deleted file mode 100644 index 4af8b2c99d6..00000000000 --- a/gcc/tree-alias-ander.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Tree based Andersen points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef TREE_ALIAS_ANDER -#define TREE_ALIAS_ANDER - -#include "tree-alias-common.h" - -extern struct tree_alias_ops *andersen_alias_ops; - -#endif /* TREE_ALIAS_ANDER */ diff --git a/gcc/tree-alias-common.c b/gcc/tree-alias-common.c deleted file mode 100644 index 21b8b497039..00000000000 --- a/gcc/tree-alias-common.c +++ /dev/null @@ -1,1251 +0,0 @@ -/* Tree based points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "ggc.h" -#include "tree-alias-type.h" -#include "bitmap.h" -#include "tree-alias-common.h" - -/* If we have andersen's points-to analysis, include it. */ -#ifdef HAVE_BANSHEE -#include "tree-alias-ander.h" -#endif - -#include "flags.h" -#include "rtl.h" -#include "tm_p.h" -#include "hard-reg-set.h" -#include "basic-block.h" -#include "output.h" -#include "errors.h" -#include "expr.h" -#include "diagnostic.h" -#include "tree.h" -#include "c-common.h" -#include "tree-flow.h" -#include "tree-inline.h" -#include "varray.h" -#include "c-tree.h" -#include "tree-gimple.h" -#include "hashtab.h" -#include "function.h" -#include "cgraph.h" -#include "tree-pass.h" -#include "timevar.h" - -/* Reduce ifdefery later. */ -#ifndef HAVE_BANSHEE -#define HAVE_BANSHEE 0 -#endif - -/* This file contains the implementation of the common parts of the - tree points-to analysis infrastructure. - - Overview: - - This file contains the points-to analysis driver. It does two main things: - 1. Keeps track of the PTA data for each variable (IE the data each - specific PTA implementation wants to keep associated with a - variable). - 2. Walks the function trees, calling the appropriate functions that - each PTA implementation has implemented. - - In order to speed up PTA queries, the PTA specific data is stored - in the tree for *_DECL's, in DECL_PTA_ALIASVAR. This way, we only - need to use the hash table for non-DECL's. */ -#define FIELD_BASED 0 - -/* Array of all created alias_vars. - Note that this should contain all the alias_vars we wanted - marked during GC. */ -static GTY((param_is (union alias_var_def))) varray_type alias_vars = NULL; -struct tree_alias_ops *current_alias_ops; - -/* Array of local (to a function) alias_vars. - Note that this should contain all the alias_vars that are - local to this function. We delete these from alias_vars before - collection. */ -static GTY(()) varray_type local_alias_vars; -static GTY(()) varray_type local_alias_varnums; -tree pta_global_var; -static bitmap addrargs; -static alias_var get_alias_var_decl (tree); -static alias_var get_alias_var (tree); -static void find_func_aliases (tree); -static void deal_with_call_aliasing (tree, alias_var); -static alias_var create_fun_alias_var_ptf (tree, tree); -static alias_var create_fun_alias_var (tree, int); -static alias_var create_alias_var (tree); -static void intra_function_call (varray_type); -static void get_values_from_constructor (tree, varray_type *, bitmap, int *); -static bool call_may_clobber (tree); -static bool call_may_return (tree); - -/* Return true if a EXPR, which is a CALL_EXPR, may clobber variables. */ - -static bool -call_may_clobber (tree expr) -{ - int flags; - - if (TREE_CODE (expr) != CALL_EXPR) - return false; - - flags = call_expr_flags (expr); - return (! (flags & (ECF_CONST | ECF_PURE | ECF_NORETURN))); -} - -/* Return true if a EXPR, which is a CALL_EXPR, may return. */ - -static bool -call_may_return (tree expr) -{ - int flags; - - if (TREE_CODE (expr) != CALL_EXPR) - return false; - - flags = call_expr_flags (expr); - return ! (flags & ECF_NORETURN); -} - -/* Get the alias_var for DECL. - Creates the alias_var if it does not exist already. Also - handles FUNCTION_DECL properly. */ - -static alias_var -get_alias_var_decl (tree decl) -{ - alias_var newvar; - gcc_assert (TREE_CODE (decl) != FIELD_DECL); - if (DECL_P (decl)) - { - if (DECL_PTA_ALIASVAR (decl)) - return DECL_PTA_ALIASVAR (decl); - } - - if (TREE_CODE (decl) == FUNCTION_DECL) - newvar = create_fun_alias_var (decl, 0); - else - { - newvar = create_alias_var (decl); - /* Assign globals to global var for purposes of intraprocedural - analysis. */ - if (TREE_STATIC (decl) && decl != pta_global_var) - { - current_alias_ops->addr_assign (current_alias_ops, - get_alias_var (pta_global_var), - newvar); - /* If the global has some DECL_INITIAL, we need to process - it here. */ - if (DECL_INITIAL (decl)) - find_func_aliases (decl); - } - } - - if (!current_alias_ops->ip) - { - if (!current_alias_ops->ip_partial - || (TREE_CODE (decl) != FUNCTION_DECL - && TREE_CODE (decl) != PARM_DECL)) - { - VARRAY_PUSH_INT (local_alias_varnums, ALIAS_VAR_VARNUM (newvar)); - VARRAY_PUSH_TREE (local_alias_vars, decl); - } - } - return newvar; -} - -/* Get the alias_var for an expression EXPR. - Note that this function expects to only be handed a RHS or LHS, not - a MODIFY_EXPR. */ - -static alias_var -get_alias_var (tree expr) -{ - /* If it's a decl, get the alias var of the decl. We farm this off - to get_alias_var_decl so it can abort if the alias var doesn't - exist, and in case something else *knows* it has a decl, and - wants the alias var. */ - - if (DECL_P (expr)) - return get_alias_var_decl (expr); - - /* True constants have no aliases (unless modifiable strings are on, - in which case i don't think we'll end up with a STRING_CST anyway) */ - if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c') - return NULL; - - - switch (TREE_CODE (expr)) - { - case ARRAY_REF: - case ARRAY_RANGE_REF: - { - /* Find the first non-array ref, and return its alias variable. */ - tree p; - - for (p = expr; - TREE_CODE (p) == ARRAY_REF || TREE_CODE (p) == ARRAY_RANGE_REF; - p = TREE_OPERAND (p, 0)) - ; - return get_alias_var (p); - } - break; - case COMPONENT_REF: - { -#if FIELD_BASED - bool safe = true; - tree p; - for (p = expr; - TREE_CODE (p) == COMPONENT_REF || TREE_CODE (p) == INDIRECT_REF; - p = TREE_OPERAND (p, 0)) - { - if (TREE_CODE (TREE_TYPE (p)) == UNION_TYPE - || TREE_CODE (TREE_TYPE (p)) == QUAL_UNION_TYPE) - { - safe = false; - break; - } - } - if (!safe) - { - for (p = expr; TREE_CODE (p) == COMPONENT_REF; - p = TREE_OPERAND (p, 0)); - return get_alias_var (p); - } - else - { - return get_alias_var (TREE_OPERAND (expr, 1)); - } -#else - /* Find the first non-component ref, and return its alias variable. */ - tree p; - for (p = expr; TREE_CODE (p) == COMPONENT_REF; - p = TREE_OPERAND (p, 0)); - return get_alias_var (p); -#endif - } - break; - case REALPART_EXPR: - case IMAGPART_EXPR: - case NOP_EXPR: - case CONVERT_EXPR: - case FIX_TRUNC_EXPR: - case FIX_CEIL_EXPR: - case FIX_FLOOR_EXPR: - case FIX_ROUND_EXPR: - case ADDR_EXPR: - case INDIRECT_REF: - case BIT_FIELD_REF: - /* If it's a ref or cast or conversion of something, get the - alias var of the something. */ - return get_alias_var (TREE_OPERAND (expr, 0)); - break; - - default: - return NULL; - } -} - -/* Perform conservative aliasing for an intraprocedural mode function - call. ARGS are the arguments that were passed to that function - call. */ - -static void -intra_function_call (varray_type args) -{ - size_t l = VARRAY_ACTIVE_SIZE (args); - size_t i; - alias_var av = get_alias_var (pta_global_var); - - /* We assume assignments among the actual parameters. */ - for (i = 0; i < l; i++) - { - alias_var argi = VARRAY_GENERIC_PTR (args, i); - size_t j; - for (j = 0; j < l; j++) - { - alias_var argj; - if (i == j) - continue; - argj = VARRAY_GENERIC_PTR (args, j); - /* Restricted pointers can't be aliased with other - restricted pointers. */ - if (!TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (argi))) - || !TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (argj)))) - /* Do a bit of TBAA to avoid pointless assignments. */ - if (alias_sets_conflict_p (get_alias_set (ALIAS_VAR_DECL (argi)), - get_alias_set (ALIAS_VAR_DECL (argj)))) - current_alias_ops->simple_assign (current_alias_ops, argi, argj); - } - } - /* We assume that an actual parameter can point to any global. */ - for (i = 0; i < l; i++) - { - alias_var argav = VARRAY_GENERIC_PTR (args, i); - /* Restricted pointers can't be aliased with other - restricted pointers. */ - if (!TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (argav))) - || !TYPE_RESTRICT (TREE_TYPE (ALIAS_VAR_DECL (av)))) - { - /* Arguments can alias globals, and whatever they point to - can point to a global as well. */ - current_alias_ops->simple_assign (current_alias_ops, argav, av); - } - } -} - -/* Put all pointers in a constructor in an array. */ - -static void -get_values_from_constructor (tree constructor, varray_type *vals, - bitmap addrargs, int *i) -{ - tree elt_list; - switch (TREE_CODE (constructor)) - { - case CONSTRUCTOR: - { - for (elt_list = CONSTRUCTOR_ELTS (constructor); - elt_list; - elt_list = TREE_CHAIN (elt_list)) - { - tree value = TREE_VALUE (elt_list); - if (TREE_CODE (value) == TREE_LIST - || TREE_CODE (value) == CONSTRUCTOR) - { - get_values_from_constructor (value, vals, addrargs, i); } - else - { - alias_var aav; - aav = get_alias_var (value); - if (aav) - VARRAY_PUSH_GENERIC_PTR (*vals, aav); - if (TREE_CODE (value) == ADDR_EXPR) - bitmap_set_bit (addrargs, *i); - *i = *i + 1; - } - } - } - break; - case TREE_LIST: - for (elt_list = constructor; - elt_list; - elt_list = TREE_CHAIN (elt_list)) - { - get_values_from_constructor (TREE_VALUE (elt_list), vals, addrargs, i); - } - break; - default: - gcc_unreachable (); - } -} - -/* Deal with the possible return values of a call that we don't have - actual PTA info about. */ - -static void -deal_with_call_aliasing (tree callargs, alias_var lhsAV) -{ - tree arg, argp; - - for (argp = callargs; - argp; - argp = TREE_CHAIN (argp)) - { - arg = TREE_VALUE (argp); - /* If we take the address of a variable directly in the - argument, the return value could be the address of that - variable. */ - if (TREE_CODE (arg) == ADDR_EXPR) - current_alias_ops->addr_assign (current_alias_ops, lhsAV, - get_alias_var (arg)); - /* If we pass in a pointer, we could return that pointer. */ - else if (POINTER_TYPE_P (TREE_TYPE (arg))) - { - alias_var argtv = get_alias_var (arg); - if (argtv) - current_alias_ops->simple_assign (current_alias_ops, lhsAV, - argtv); - } - } -} - -/* Find the operand of the component ref that actually is doing - something to the DECL */ -static tree -find_op_of_decl (tree cref) -{ - while (!DECL_P (TREE_OPERAND (cref, 0))) - { - cref = TREE_OPERAND (cref, 0); - } - return cref; -} - - -/* Tree walker that is the heart of the aliasing infrastructure. - TP is a pointer to the current tree. - WALK_SUBTREES specifies whether to continue traversing subtrees or - not. - Returns NULL_TREE when we should stop. - - This function is the main part of the aliasing infrastructure. It - walks the trees, calling the appropriate alias analyzer functions to process - various statements. */ - -static void -find_func_aliases (tree stp) -{ - if (TREE_CODE (stp) == RETURN_EXPR) - { - stp = TREE_OPERAND (stp, 0); - if (!stp) - return; - } - - if (TREE_CODE (stp) == MODIFY_EXPR - || (DECL_P (stp) && DECL_INITIAL (stp) != NULL_TREE )) - { - tree op0, op1; - alias_var lhsAV = NULL; - alias_var rhsAV = NULL; - - if (DECL_P (stp)) - { - op0 = stp; - op1 = DECL_INITIAL (stp); - } - else - { - op0 = TREE_OPERAND (stp, 0); - op1 = TREE_OPERAND (stp, 1); - if (TREE_CODE (op1) == WITH_SIZE_EXPR) - op1 = TREE_OPERAND (op1, 0); - } - - /* lhsAV should always have an alias variable */ - lhsAV = get_alias_var (op0); - if (!lhsAV) - return; - /* rhsAV might not have one, c.f. c = 5 */ - rhsAV = get_alias_var (op1); -#if !FIELD_BASED - while (TREE_CODE (op1) == COMPONENT_REF - && TREE_CODE (TREE_OPERAND (op1, 0)) == COMPONENT_REF) - { - op1 = TREE_OPERAND (op1, 0); - } - while (TREE_CODE (op1) == BIT_FIELD_REF) - { - op1 = TREE_OPERAND (op1, 0); - } - /* Take care of fact that we may have multi-level component - refs. */ - if (TREE_CODE (op1) == COMPONENT_REF) - op1 = find_op_of_decl (op1); -#endif - - /* You would think we could test rhsAV at the top, rather than - 50 separate times, but we can't, because it can be NULL for - operator assignments, where we'd still collect the individual - alias vars for the operator. */ - - /* Note that structures are treated as a single alias - variable, since we can disambiguate based on TBAA first, - and fall back on points-to. */ - /* x = <something> */ - if (is_gimple_variable (op0)) - { - /* x = y */ - if (is_gimple_variable (op1)) - { - if (rhsAV != NULL) - current_alias_ops->simple_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* x = foo.y */ - else if (TREE_CODE (op1) == COMPONENT_REF - && DECL_P (TREE_OPERAND (op1, 0))) - { - if (rhsAV != NULL) - current_alias_ops->simple_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* x = (cast) [maybe-addr-expr] y */ - else if (is_gimple_cast (op1)) - { - tree stripped_op1 = op1; - STRIP_NOPS (stripped_op1); - if (rhsAV != NULL) - { - if (TREE_CODE (stripped_op1) == ADDR_EXPR) - current_alias_ops->addr_assign (current_alias_ops, lhsAV, - rhsAV); - else - current_alias_ops->simple_assign (current_alias_ops, lhsAV, - rhsAV); - } - } - /* x = *y or x = foo->y */ - else if (TREE_CODE (op1) == INDIRECT_REF - || TREE_CODE (op1) == ARRAY_REF - || (TREE_CODE (op1) == COMPONENT_REF - && TREE_CODE (TREE_OPERAND (op1, 0)) == INDIRECT_REF)) - { - if (rhsAV != NULL) - current_alias_ops->ptr_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* x = &y = x = &foo.y */ - else if (TREE_CODE (op1) == ADDR_EXPR) - { - if (rhsAV != NULL) - current_alias_ops->addr_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* x = func(...) */ - else if (TREE_CODE (op1) == CALL_EXPR) - { - /* Heap assignment. These are __attribute__ malloc or - something, I'll deal with it later. */ - if (0) - {} - else - { - - /* NORETURN functions have no effect on aliasing. */ - if (call_may_return (op1)) - { - varray_type args; - tree arg; - tree callop0, callop1; - int argnum; - - /* Collect the arguments */ - VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); - bitmap_clear (addrargs); - callop1 = TREE_OPERAND (op1, 1); - callop0 = TREE_OPERAND (op1, 0); - for (arg = callop1, argnum = 0; - arg; - arg = TREE_CHAIN (arg), argnum++) - { - alias_var aav = get_alias_var (TREE_VALUE (arg)); - if (aav) - { - VARRAY_PUSH_GENERIC_PTR (args, aav); - if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) - bitmap_set_bit (addrargs, argnum); - } - } - /* Simulate the call */ - if (current_alias_ops->function_call (current_alias_ops, lhsAV, - get_alias_var (callop0), - args, addrargs)) - { - if (call_may_clobber (op1) - && !current_alias_ops->ip - && flag_argument_noalias != 2) - { - intra_function_call (args); - } - if (POINTER_TYPE_P (TREE_TYPE (op0))) - deal_with_call_aliasing (callop1, lhsAV); - } - } - } - } - /* x = op (...) */ - else - { - bitmap_clear (addrargs); - if (TREE_CODE (op1) == CONSTRUCTOR) - { - varray_type ops; - int i = 0; - VARRAY_GENERIC_PTR_INIT (ops, 1, "Operands"); - get_values_from_constructor (op1, &ops, addrargs, &i); - current_alias_ops->op_assign (current_alias_ops, lhsAV, - ops, op1, addrargs); - } - else - switch (TREE_CODE_CLASS (TREE_CODE (op1))) - { - case 'e': /* an expression */ - case 's': /* an expression with side effects */ - case '<': /* a comparison expression */ - case '1': /* a unary arithmetic expression */ - case 'r': /* a reference */ - case '2': /* a binary arithmetic expression */ - { - tree op; - varray_type ops; - int i; - VARRAY_GENERIC_PTR_INIT (ops, 1, "Operands"); - for (i = 0; i < TREE_CODE_LENGTH (TREE_CODE (op1)); i++) - { - alias_var aav; - op = TREE_OPERAND (op1, i); - aav = get_alias_var (op); - if (aav) - VARRAY_PUSH_GENERIC_PTR (ops, aav); - if (TREE_CODE (op) == ADDR_EXPR) - bitmap_set_bit (addrargs, i); - } - current_alias_ops->op_assign (current_alias_ops, lhsAV, - ops, op1, addrargs); - } - break; - default: - break; - } - } - } - /* *x = <something> */ - else - { - /* x.f = y or x->f = y */ - if ((TREE_CODE (op0) == COMPONENT_REF - || TREE_CODE (op0) == BIT_FIELD_REF) - && is_gimple_variable (op1)) - { - if (rhsAV != NULL) - current_alias_ops->simple_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* x.f = &y or x->f = &y */ - else if (TREE_CODE (op0) == COMPONENT_REF - && TREE_CODE (op1) == ADDR_EXPR) - { - if (rhsAV != NULL) - current_alias_ops->addr_assign (current_alias_ops, lhsAV, - rhsAV); - } - /* *x.f = y or *x->f = y */ - else if ((TREE_CODE (op0) == INDIRECT_REF - || TREE_CODE (op0) == ARRAY_REF) - && TREE_CODE (TREE_OPERAND (op0, 0)) == COMPONENT_REF - && is_gimple_variable (op1)) - { - if (rhsAV != NULL) - current_alias_ops->assign_ptr (current_alias_ops, lhsAV, - rhsAV); - } - /* *x = &y */ - else if ((TREE_CODE (op0) == INDIRECT_REF - || TREE_CODE (op0) == ARRAY_REF) - && TREE_CODE (op1) == ADDR_EXPR) - { - /* This becomes temp = &y and *x = temp . */ - alias_var tempvar; - tree temp = create_tmp_var_raw (void_type_node, "aliastmp"); - tempvar = current_alias_ops->add_var (current_alias_ops, temp); - current_alias_ops->addr_assign (current_alias_ops, tempvar, - rhsAV); - current_alias_ops->assign_ptr (current_alias_ops, lhsAV, - tempvar); - } - - /* *x = *y */ - else if ((TREE_CODE (op0) == INDIRECT_REF - || TREE_CODE (op0) == ARRAY_REF) - && (TREE_CODE (op1) == INDIRECT_REF - || TREE_CODE (op1) == ARRAY_REF)) - { - /* This becomes temp = *y and *x = temp . */ - alias_var tempvar; - tree temp; - temp = create_tmp_var_raw (void_type_node, "aliastmp"); - tempvar = current_alias_ops->add_var (current_alias_ops, temp); - current_alias_ops->ptr_assign (current_alias_ops, tempvar, - rhsAV); - current_alias_ops->assign_ptr (current_alias_ops, lhsAV, - tempvar); - } - - /* *x = (cast) y */ - else if ((TREE_CODE (op0) == INDIRECT_REF - || TREE_CODE (op0) == ARRAY_REF) - && is_gimple_cast (op1)) - { - if (rhsAV != NULL) - { - /* This becomes temp = (cast) y and *x = temp. */ - alias_var tempvar; - tree temp; - temp = create_tmp_var_raw (void_type_node, "aliastmp"); - tempvar = current_alias_ops->add_var (current_alias_ops, - temp); - current_alias_ops->simple_assign (current_alias_ops, - tempvar, rhsAV); - current_alias_ops->assign_ptr (current_alias_ops, lhsAV, - tempvar); - } - } - /* *x = <something else> */ - else - { - if (rhsAV != NULL) - current_alias_ops->assign_ptr (current_alias_ops, lhsAV, - rhsAV); - } - } - } - /* Calls without return values. */ - else if (TREE_CODE (stp) == CALL_EXPR) - { - alias_var callvar; - varray_type args; - tree arg; - callvar = get_alias_var (TREE_OPERAND (stp, 0)); - if (callvar != NULL) - { - - /* NORETURN and CONST functions with no return value - have no effect on aliasing (as may be seen above, - const functions that return a value might have an - effect on aliasing, since the return value can point - to one of the arguments. */ - if (call_may_clobber (stp)) - { - int argnum; - VARRAY_GENERIC_PTR_INIT (args, 1, "Arguments"); - bitmap_clear (addrargs); - for (arg = TREE_OPERAND (stp, 1), argnum=0; - arg; - arg = TREE_CHAIN (arg), argnum++) - { - alias_var aav = get_alias_var (TREE_VALUE (arg)); - if (aav) - { - VARRAY_PUSH_GENERIC_PTR (args, aav); - if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR) - bitmap_set_bit (addrargs, argnum); - } - - } - - if (current_alias_ops->function_call (current_alias_ops, NULL, - callvar, args, addrargs)) - if (!current_alias_ops->ip && flag_argument_noalias != 2) - intra_function_call (args); - } - } - } -} - -/* Create the alias_var for a function definition DECL, it's - arguments, and it's return value. If FORCE is true, we force - creation of the alias_var, regardless of whether one exists already. - - This includes creation of alias_var's for - - The function itself. - - The arguments. - - The return value. */ - -static alias_var -create_fun_alias_var (tree decl, int force) -{ - alias_var avar, retvar; - tree rdecl; - varray_type params = NULL; - - if (!force) - { - if (DECL_PTA_ALIASVAR (decl)) - return DECL_PTA_ALIASVAR (decl); - } - - VARRAY_GENERIC_PTR_INIT (params, 1, "Arguments"); - if (DECL_ARGUMENTS (decl) != NULL) - { - tree arg; - for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg)) - { - alias_var var = get_alias_var (arg); - VARRAY_PUSH_GENERIC_PTR (params, var); - /* Incoming pointers can point to pta_global_var, unless - either we are interprocedural, or we can do ip on all - statics + this function has been defined + it's not an - external function. */ - if (POINTER_TYPE_P (TREE_TYPE (arg)) - && !current_alias_ops->ip - /* FIXME: Need to let analyzer decide in partial case. */ - && (!current_alias_ops->ip_partial - || !cgraph_local_info (decl)->local)) - current_alias_ops->simple_assign (current_alias_ops, var, - get_alias_var (pta_global_var)); - } - } - else if (TYPE_ARG_TYPES (TREE_TYPE (decl)) != NULL) - { - tree arg; - /* FIXME: Handle varargs */ - for (arg = TYPE_ARG_TYPES (TREE_TYPE (decl)); - arg && TREE_VALUE (arg) != void_type_node; - arg = TREE_CHAIN (arg)) - { - tree fakedecl = create_tmp_var_raw (TREE_VALUE (arg), "normarg"); - alias_var var; - DECL_CONTEXT (fakedecl) = current_function_decl; - var = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, var); - - /* Incoming pointers can point to pta_global_var, unless - either we are interprocedural, or we can do ip on all - statics + this function has been defined + it's not an - external function. */ - if (POINTER_TYPE_P (TREE_TYPE (fakedecl)) - && !current_alias_ops->ip - /* FIXME: need to let analyzer decide in partial case. */ - && (!current_alias_ops->ip_partial - || !TREE_STATIC (decl) - || TREE_PUBLIC (decl))) - current_alias_ops->simple_assign (current_alias_ops, var, - get_alias_var (pta_global_var)); - } - } - /* Functions declared like void f() are *not* equivalent to void - f(void). You can pass an argument to them. Thus, we need to - create some fake argument that would alias any actuals that get - passed to our function. */ - else - { - tree fakedecl = create_tmp_var_raw (void_type_node, "fakearg"); - alias_var fakevar; - DECL_CONTEXT (fakedecl) = current_function_decl; - fakevar = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, fakevar); - } - - if (!DECL_RESULT (decl)) - { - rdecl = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (decl)), "_rv_"); - retvar = current_alias_ops->add_var (current_alias_ops, rdecl); - DECL_PTA_ALIASVAR (rdecl) = retvar; - } - else - { - retvar = current_alias_ops->add_var (current_alias_ops, - DECL_RESULT (decl)); - DECL_PTA_ALIASVAR (DECL_RESULT (decl)) = retvar; - } - VARRAY_PUSH_GENERIC_PTR (alias_vars, retvar); - ALIAS_VAR_VARNUM (retvar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; - avar = current_alias_ops->add_var (current_alias_ops, decl); - VARRAY_PUSH_GENERIC_PTR (alias_vars, avar); - ALIAS_VAR_VARNUM (avar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; - - current_alias_ops->function_def (current_alias_ops, avar, params, retvar); - DECL_PTA_ALIASVAR (decl) = avar; - - /* FIXME: Also, if this is a defining declaration then add the annotation - to all extern definitions of the function. */ - return avar; -} - -/* Create an alias variable for a pointer-to-member function DECL of - type TYPE, it's arguments, and it's return value. - Returns the alias_var for the PTF. - - This includes creating alias_var's for - - The function itself. - - The arguments. - - The return value. */ - -static alias_var -create_fun_alias_var_ptf (tree decl, tree type) -{ - alias_var avar, retvar; - tree rdecl; - varray_type params = NULL; - - if (DECL_PTA_ALIASVAR (decl)) - return DECL_PTA_ALIASVAR (decl); - - VARRAY_GENERIC_PTR_INIT (params, 1, "Arguments"); - - if (TYPE_ARG_TYPES (type) != NULL) - { - tree arg; - /* FIXME: Handle varargs */ - for (arg = TYPE_ARG_TYPES (type); - arg && TREE_VALUE (arg) != void_type_node; - arg = TREE_CHAIN (arg)) - { - tree fakedecl = create_tmp_var_raw (TREE_VALUE (arg), "ptfarg"); - alias_var var; - DECL_CONTEXT (fakedecl) = DECL_CONTEXT (decl); - var = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, var); - } - } - /* Functions declared like void f() are *not* equivalent to void - f(void). You can pass an argument to them. Thus, we need to - create some fake argument that would alias any actuals that get - passed to our function. */ - else - { - tree fakedecl = create_tmp_var_raw (void_type_node, "fakearg"); - alias_var fakevar; - DECL_CONTEXT (fakedecl) = DECL_CONTEXT (decl); - fakevar = get_alias_var (fakedecl); - VARRAY_PUSH_GENERIC_PTR (params, fakevar); - } - - rdecl = create_tmp_var_raw (TREE_TYPE (type), "_rv_"); - retvar = current_alias_ops->add_var (current_alias_ops, rdecl); - VARRAY_PUSH_GENERIC_PTR (alias_vars, retvar); - ALIAS_VAR_VARNUM (retvar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; - - avar = current_alias_ops->add_var (current_alias_ops, decl); - VARRAY_PUSH_GENERIC_PTR (alias_vars, avar); - ALIAS_VAR_VARNUM (avar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; - - current_alias_ops->function_def (current_alias_ops, avar, params, retvar); - DECL_PTA_ALIASVAR (decl) = avar; - - return avar; -} - -/* Create the alias_var for a *_DECL node DECL. - Returns the alias_var for DECL. - - This function also handles creation of alias_var's for PTF - variables. */ - -static alias_var -create_alias_var (tree decl) -{ - alias_var avar; - - gcc_assert (DECL_P (decl)); - - if (DECL_PTA_ALIASVAR (decl)) - return DECL_PTA_ALIASVAR (decl); - - if (POINTER_TYPE_P (TREE_TYPE (decl)) - && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == FUNCTION_TYPE) - { - avar = create_fun_alias_var_ptf (decl, TREE_TYPE (TREE_TYPE (decl))); - } - else - avar = current_alias_ops->add_var (current_alias_ops, decl); - - if (DECL_P (decl)) - { - DECL_PTA_ALIASVAR (decl) = avar; - } - - VARRAY_PUSH_GENERIC_PTR (alias_vars, avar); - ALIAS_VAR_VARNUM (avar) = VARRAY_ACTIVE_SIZE (alias_vars) - 1; - return avar; -} - -/* Create points-to sets for the current function. */ - -static void -create_alias_vars (void) -{ - basic_block bb; -#if HAVE_BANSHEE - if (flag_tree_points_to == PTA_ANDERSEN) - current_alias_ops = andersen_alias_ops; - else -#endif - { - current_alias_ops = NULL; - flag_tree_points_to = PTA_NONE; - return; - } - - pta_global_var = build_decl (VAR_DECL, get_identifier (".pta_global_var"), - size_type_node); - DECL_ARTIFICIAL (pta_global_var) = 1; - TREE_READONLY (pta_global_var) = 1; - DECL_EXTERNAL (pta_global_var) = 0; - TREE_STATIC (pta_global_var) = 1; - TREE_USED (pta_global_var) = 1; - DECL_CONTEXT (pta_global_var) = current_function_decl; - TREE_THIS_VOLATILE (pta_global_var) = 1; - TREE_ADDRESSABLE (pta_global_var) = 0; - - init_alias_vars (); - - DECL_PTA_ALIASVAR (current_function_decl) = NULL; - get_alias_var (current_function_decl); - - /* First, walk the variables and their DECL_INITIAL's */ - if (cfun->unexpanded_var_list) - { - tree vars, var; - for (vars = cfun->unexpanded_var_list; vars; vars = TREE_CHAIN (vars)) - { - var = TREE_VALUE (vars); - if (TREE_CODE (var) != LABEL_DECL - && TREE_STATIC (var) - && DECL_INITIAL (var)) - find_func_aliases (var); - } - } - - /* Now walk all statements and derive aliases. */ - FOR_EACH_BB (bb) - { - block_stmt_iterator bsi; - for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) - find_func_aliases (bsi_stmt (bsi)); - } - - pta_global_var = NULL_TREE; -} - -static bool -gate_pta (void) -{ -#ifdef HAVE_BANSHEE - return flag_tree_points_to != PTA_NONE; -#else - return false; -#endif -} - -struct tree_opt_pass pass_build_pta = -{ - "pta", /* name */ - gate_pta, /* gate */ - create_alias_vars, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TREE_PTA, /* tv_id */ - PROP_cfg, /* properties_required */ - PROP_pta, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - 0 /* letter */ -}; - - -/* Delete created points-to sets. */ - -static void -delete_alias_vars (void) -{ - size_t i; - - for (i = 0; i < VARRAY_ACTIVE_SIZE (local_alias_vars); i++) - { - tree key = VARRAY_TREE (local_alias_vars, i); - gcc_assert (DECL_P (key)); - DECL_PTA_ALIASVAR (key) = NULL; - } - - for (i = 0; i < VARRAY_ACTIVE_SIZE (local_alias_varnums); i ++) - VARRAY_GENERIC_PTR (alias_vars, VARRAY_INT (local_alias_varnums, i)) = NULL; - if (!current_alias_ops->ip && !current_alias_ops->ip_partial) - { - /* VARRAY_CLEAR (alias_vars); */ - VARRAY_CLEAR (local_alias_vars); - VARRAY_CLEAR (local_alias_varnums); - } - BITMAP_XFREE (addrargs); - current_alias_ops->cleanup (current_alias_ops); -} - -struct tree_opt_pass pass_del_pta = -{ - "pta", /* name */ - gate_pta, /* gate */ - delete_alias_vars, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_TREE_PTA, /* tv_id */ - PROP_pta, /* properties_required */ - 0, /* properties_provided */ - PROP_pta, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ - 0 /* letter */ -}; - - -/* Initialize points-to analysis machinery. */ - -void -init_alias_vars (void) -{ - current_alias_ops->init (current_alias_ops); - addrargs = BITMAP_XMALLOC (); - VARRAY_TREE_INIT (local_alias_vars, 10, "Local alias vars"); - VARRAY_INT_INIT (local_alias_varnums, 10, "Local alias varnums"); - if ((!current_alias_ops->ip && !current_alias_ops->ip_partial) - || alias_vars == NULL) - VARRAY_GENERIC_PTR_INIT (alias_vars, 10, "Alias vars"); -} - -/* Return true if PTR can't point to anything (i.e. it has an empty - points-to set. */ -bool -empty_points_to_set (tree ptr) -{ - alias_var ptrtv; - -#if !FIELD_BASED -#else - if (TREE_CODE (ptr) == COMPONENT_REF) - ptr = TREE_OPERAND (ptr, 1); -#endif - - gcc_assert (DECL_P (ptr)); - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return true; - - return current_alias_ops->empty_points_to_set (current_alias_ops, ptrtv); -} - -/* Return true if PTR and VAR have the same points-to set. */ - -bool -same_points_to_set (tree ptr, tree var) -{ - alias_var ptrtv, vartv; - -#if !FIELD_BASED -#else - if (TREE_CODE (ptr) == COMPONENT_REF) - ptr = TREE_OPERAND (ptr, 1); - if (TREE_CODE (var) == COMPONENT_REF) - var = TREE_OPERAND (var, 1); -#endif - - if (ptr == var) - return true; - - gcc_assert (DECL_P (ptr)); - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return false; - - gcc_assert (DECL_P (var)); - vartv = DECL_PTA_ALIASVAR (var); - if (!vartv) - return false; - - return current_alias_ops->same_points_to_set (current_alias_ops, vartv, ptrtv); -} - -/* Determine whether two variables (PTR and VAR) may-alias. - Returns TRUE if PTR may-alias VAR. */ - -bool -ptr_may_alias_var (tree ptr, tree var) -{ - alias_var ptrtv, vartv; - -#if !FIELD_BASED -#else - if (TREE_CODE (ptr) == COMPONENT_REF) - ptr = TREE_OPERAND (ptr, 1); - if (TREE_CODE (var) == COMPONENT_REF) - var = TREE_OPERAND (var, 1); -#endif - - if (ptr == var) - return true; - - gcc_assert (DECL_P (ptr)); - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return false; - - gcc_assert (DECL_P (var)); - vartv = DECL_PTA_ALIASVAR (var); - if (!vartv) - return false; - - return current_alias_ops->may_alias (current_alias_ops, ptrtv, vartv); -} - -#define MASK_POINTER(P) ((unsigned)((unsigned long)(P) & 0xffff)) - -const char * -alias_get_name (tree t) -{ - const char *name; - -#if FIELD_BASED - if (TREE_CODE (t) == FIELD_DECL) - { - /* First get the name of the field, then the prefix, then smash them - together. */ - const char *fieldname = IDENTIFIER_POINTER (DECL_NAME (t)); - const char *prefix = alias_get_name (DECL_CONTEXT (t)); - char *smashed; - size_t neededlen = strlen (fieldname) + strlen (prefix) + 2; - smashed = ggc_alloc (neededlen); - sprintf (smashed, "%s.%s", prefix, fieldname); - name = smashed; - - } - else if (TYPE_P (t)) - { - if (TYPE_NAME (t) && IDENTIFIER_POINTER (TYPE_NAME (t))) - name = IDENTIFIER_POINTER (TYPE_NAME (t)); - else - name = "<unnamed type>"; - } - else -#endif - { - if (TREE_CODE (t) == FUNCTION_DECL) - name = IDENTIFIER_POINTER (DECL_NAME (t)); - else if (TREE_CODE (t) == RESULT_DECL) - name = "<return value>"; - else - name = get_name (t); - } - - if (!name) - { - char *namep; - /* 2 = UF - 4 = the masked pointer - 2 = the <> around it - 1 = the terminator. */ - namep = ggc_alloc (2 + 4 + 2 + 1); - sprintf (namep, "<UV%x>", MASK_POINTER (t)); - return namep; - } - - return name; -} - -#include "gt-tree-alias-common.h" diff --git a/gcc/tree-alias-common.h b/gcc/tree-alias-common.h deleted file mode 100644 index ec93ce3dad2..00000000000 --- a/gcc/tree-alias-common.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Tree based points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef TREE_ALIAS_COMMON -#define TREE_ALIAS_COMMON - -#include "tree-alias-type.h" - -/* Alias analysis function pointers. - Functions implemented by the actual alias analysis algorithms in - order for them to work with the common points-to structure. */ -struct tree_alias_ops -{ - /* Initialization. - Called right before we start using the other functions. */ - void (*init) (struct tree_alias_ops *); - - /* Cleanup. - Called when we are finished with the alias analyzer. */ - void (*cleanup) (struct tree_alias_ops *); - - /* Add variable. - Called when we want to inform the alias analyzer about a new - variable we've found. */ - alias_var (*add_var) (struct tree_alias_ops *, tree); - - /* Add variable equivalent to existing one. - Called when we want to inform the alias analyzer about a new - variable that has the same points-to set as an existing - variable. */ - alias_var (*add_var_same) (struct tree_alias_ops *, tree, - alias_var); - - /* Process a simple assignment (a = b). - Called to process simple assignment statements of the form a = b, - where a and b are both variables. */ - void (*simple_assign) (struct tree_alias_ops *, alias_var, - alias_var); - /* Process an address assignment (a = &b). - Called to process address assignment statements of the form a = - &b, where a and b are both variables. */ - void (*addr_assign) (struct tree_alias_ops *, alias_var, alias_var); - - /* Process a pointer assignment (a = *b). - Called to process pointer assignment statements of the form a = - *b, where a and b are both variables. */ - void (*ptr_assign) (struct tree_alias_ops *, alias_var, alias_var); - - /* Process an operator assignment (a = op (...)) - Called to process operators of the form a = op(...), where a is a - variable. */ - void (*op_assign) (struct tree_alias_ops *, alias_var, varray_type, - tree, bitmap); - /* Process a heap assignment (a = alloc (...)) - Called to process a heap assignment of the form a = alloc - (...), where a is a variable, and *alloc is a function that - returns new memory. */ - void (*heap_assign) (struct tree_alias_ops *, alias_var); - - /* Process an assignment to a pointer (*a = b) - Called to process assignment to pointer statements of the form - *a = b, where a and b are both variables. */ - void (*assign_ptr) (struct tree_alias_ops *, alias_var, alias_var); - - /* Process a function definition. - Called to inform the alias analyzer about a new function - definition. */ - void (*function_def) (struct tree_alias_ops *, alias_var, - varray_type, alias_var); - - /* Process a function call. - Return 1 if we need to assume conservative side-effects. */ - int (*function_call) (struct tree_alias_ops *, alias_var, - alias_var, varray_type, bitmap); - - /* Determine if two alias variables may alias. */ - bool (*may_alias) (struct tree_alias_ops *, alias_var, alias_var); - - /* Determine if two alias variables have the same points-to set. */ - bool (*same_points_to_set) (struct tree_alias_ops *, alias_var, - alias_var); - - /* Determine if the alias variable has an empty points-to set. */ - bool (*empty_points_to_set) (struct tree_alias_ops *, alias_var); - - /* Private data. */ - void *data; - - /* Interprocedural. */ - unsigned int ip:1; - - /* Can do conservative interprocedural analysis if we save the - * info. */ - unsigned int ip_partial:1; - -}; - -extern struct tree_alias_ops *current_alias_ops; -extern void init_alias_vars (void); -extern bool ptr_may_alias_var (tree, tree); -extern bool same_points_to_set (tree, tree); -extern bool empty_points_to_set (tree); -extern const char *alias_get_name (tree); - -#endif /* TREE_ALIAS_COMMON */ diff --git a/gcc/tree-alias-type.c b/gcc/tree-alias-type.c deleted file mode 100644 index 20bcbf733fd..00000000000 --- a/gcc/tree-alias-type.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Tree based linear points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "config.h" -#include "system.h" -#include "coretypes.h" -#include "tm.h" -#include "ggc.h" -#include "tree-alias-type.h" - -alias_var -alias_var_new_with_aterm (tree decl, struct aterm_ *term) -{ - alias_var ret = ggc_alloc (sizeof (struct alias_var_aterm)); - ALIAS_VAR_KIND (ret) = ATERM_AVAR; - ALIAS_VAR_DECL (ret) = decl; - ALIAS_VAR_ATERM (ret) = term; - return ret; -} diff --git a/gcc/tree-alias-type.h b/gcc/tree-alias-type.h deleted file mode 100644 index 5c81af76463..00000000000 --- a/gcc/tree-alias-type.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Tree based linear points-to analysis - Copyright (C) 2002, 2003 Free Software Foundation, Inc. - Contributed by Daniel Berlin <dberlin@dberlin.org> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GCC; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef TREE_ALIAS_TYPE_H -#define TREE_ALIAS_TYPE_H - -#include "varray.h" - -union alias_var_def; -struct aterm_; -struct aterm_list_a; - -enum alias_var_kind -{ - ATERM_AVAR -}; - -struct alias_var_common GTY (()) -{ - enum alias_var_kind kind; - unsigned int varnum; - tree decl; -}; - -struct alias_var_aterm GTY (()) -{ - struct alias_var_common common; - struct aterm_ * GTY((skip (""))) term; - struct aterm_list_a *GTY ((skip (""))) ptset; -}; - -union alias_var_def GTY ((desc ("%0.common.kind"))) -{ - struct alias_var_common GTY ((tag ("-1"))) common; - struct alias_var_aterm GTY ((tag ("ATERM_AVAR"))) aterm; -}; - -typedef union alias_var_def *alias_var; - -#define ALIAS_VAR_KIND(x) ((x)->common.kind) -#define ALIAS_VAR_VARNUM(x) ((x)->common.varnum) -#define ALIAS_VAR_DECL(x) ((x)->common.decl) -#define ALIAS_VAR_ATERM(x) ((x)->aterm.term) -#define ALIAS_VAR_PTSET(x) ((x)->aterm.ptset) -union alias_type_def; -typedef union alias_type_def *alias_type; - -alias_var alias_var_new_with_aterm (tree, struct aterm_ *); - -#endif /* TREE_ALIAS_TYPE_H */ diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index ad14e12bc7a..3ceb60afd3b 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-gimple.h" #include "tree-flow.h" #include "tree-inline.h" -#include "tree-alias-common.h" #include "tree-pass.h" #include "convert.h" #include "params.h" diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index bbec1b2d726..80e36dc29d2 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -41,7 +41,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-inline.h" #include "varray.h" #include "timevar.h" -#include "tree-alias-common.h" #include "hashtab.h" #include "tree-dump.h" #include "tree-pass.h" diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index e1687af4fc0..c07701a9c06 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -44,7 +44,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-inline.h" #include "tree-mudflap.h" #include "tree-pass.h" -#include "tree-alias-common.h" #include "ggc.h" #include "cgraph.h" #include "graph.h" @@ -346,7 +345,6 @@ init_tree_optimization_passes (void) p = &pass_all_optimizations.sub; NEXT_PASS (pass_referenced_vars); - NEXT_PASS (pass_build_pta); NEXT_PASS (pass_build_ssa); NEXT_PASS (pass_may_alias); NEXT_PASS (pass_rename_ssa_copies); @@ -384,7 +382,6 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_phiopt); NEXT_PASS (pass_tail_calls); NEXT_PASS (pass_late_warn_uninitialized); - NEXT_PASS (pass_del_pta); NEXT_PASS (pass_del_ssa); NEXT_PASS (pass_nrv); NEXT_PASS (pass_remove_useless_vars); diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 12f6cb97909..4c8c21677ca 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-inline.h" #include "varray.h" #include "timevar.h" -#include "tree-alias-common.h" #include "hashtab.h" #include "tree-dump.h" #include "tree-ssa-live.h" diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h index a7445cddda6..fa9151f105b 100644 --- a/gcc/tree-pass.h +++ b/gcc/tree-pass.h @@ -119,8 +119,6 @@ extern struct tree_opt_pass pass_lower_eh; extern struct tree_opt_pass pass_build_cfg; extern struct tree_opt_pass pass_tree_profile; extern struct tree_opt_pass pass_referenced_vars; -extern struct tree_opt_pass pass_build_pta; -extern struct tree_opt_pass pass_del_pta; extern struct tree_opt_pass pass_sra; extern struct tree_opt_pass pass_tail_recursion; extern struct tree_opt_pass pass_tail_calls; diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 70a45257066..f00fcc1e97b 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -39,7 +39,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-gimple.h" #include "tree-flow.h" #include "tree-inline.h" -#include "tree-alias-common.h" #include "tree-pass.h" #include "convert.h" #include "params.h" @@ -125,8 +124,6 @@ struct alias_stats_d unsigned int simple_resolved; unsigned int tbaa_queries; unsigned int tbaa_resolved; - unsigned int pta_queries; - unsigned int pta_resolved; }; @@ -354,7 +351,7 @@ struct tree_opt_pass pass_may_alias = NULL, /* next */ 0, /* static_pass_number */ TV_TREE_MAY_ALIAS, /* tv_id */ - PROP_cfg | PROP_ssa | PROP_pta, /* properties_required */ + PROP_cfg | PROP_ssa, /* properties_required */ PROP_alias, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ @@ -1618,18 +1615,6 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set, } } - if (flag_tree_points_to != PTA_NONE) - alias_stats.pta_queries++; - - /* If -ftree-points-to is given, check if PTR may point to VAR. */ - if (flag_tree_points_to == PTA_ANDERSEN - && !ptr_may_alias_var (ptr, var)) - { - alias_stats.alias_noalias++; - alias_stats.pta_resolved++; - return false; - } - alias_stats.alias_mayalias++; return true; } @@ -2119,9 +2104,7 @@ get_tmt_for (tree ptr, struct alias_info *ai) for (i = 0, tag = NULL_TREE; i < ai->num_pointers; i++) { struct alias_map_d *curr = ai->pointers[i]; - if (tag_set == curr->set - && (flag_tree_points_to == PTA_NONE - || same_points_to_set (curr->var, ptr))) + if (tag_set == curr->set) { tag = var_ann (curr->var)->type_mem_tag; break; @@ -2203,10 +2186,6 @@ dump_alias_stats (FILE *file) alias_stats.tbaa_queries); fprintf (file, "Total TBAA resolved:\t%u\n", alias_stats.tbaa_resolved); - fprintf (file, "Total PTA queries:\t%u\n", - alias_stats.pta_queries); - fprintf (file, "Total PTA resolved:\t%u\n", - alias_stats.pta_resolved); } diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index e38b77ac494..1db85ff9f08 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -33,7 +33,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-gimple.h" #include "tree-inline.h" #include "timevar.h" -#include "tree-alias-common.h" #include "hashtab.h" #include "tree-dump.h" #include "tree-ssa-live.h" diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index d65d6fb20d8..a1c716bf71f 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -34,7 +34,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-inline.h" #include "varray.h" #include "timevar.h" -#include "tree-alias-common.h" #include "hashtab.h" #include "tree-dump.h" #include "tree-ssa-live.h" diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 4d8096b2294..2da6c99651e 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -41,7 +41,6 @@ Boston, MA 02111-1307, USA. */ #include "tree-inline.h" #include "varray.h" #include "timevar.h" -#include "tree-alias-common.h" #include "hashtab.h" #include "tree-dump.h" #include "tree-pass.h" |