summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErick Ochoa <erick.ochoa@theobroma-systems.com>2020-06-04 14:21:22 +0200
committerErick Ochoa <erick.ochoa@theobroma-systems.com>2020-06-04 14:21:22 +0200
commit30e6d5260363592e65b3b9b768809a414759820b (patch)
tree5193507497cb0a386a604d01ea99779637555764
parent247fbdc30ea94d20ec179e801156490beb68f65a (diff)
remove ipa-typa-collector
-rw-r--r--gcc/Makefile.in1
-rw-r--r--gcc/common.opt4
-rw-r--r--gcc/gimple-collector.c1
-rw-r--r--gcc/gimple-walker.c1
-rw-r--r--gcc/ipa-prototype.c8
-rw-r--r--gcc/ipa-type-collector.c174
-rw-r--r--gcc/ipa-type-collector.h5
-rw-r--r--gcc/passes.def1
-rw-r--r--gcc/tree-pass.h1
9 files changed, 5 insertions, 191 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7f8a633b7ff..f6f1db31d6b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1408,7 +1408,6 @@ OBJS = \
init-regs.o \
internal-fn.o \
ipa-prototype.o \
- ipa-type-collector.o \
expr-walker.o \
expr-collector.o \
type-walker.o \
diff --git a/gcc/common.opt b/gcc/common.opt
index ec5c5e50864..d648d87221a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -3420,10 +3420,6 @@ fipa-ra
Common Report Var(flag_ipa_ra) Optimization
Use caller save register across calls if possible.
-fipa-type-collector
-Common Report Var(flag_ipa_type_collector) Optimization
-TBD
-
ftp-types-compared=
Common Joined Report Var(flag_tp_types_compared) Init(0)
diff --git a/gcc/gimple-collector.c b/gcc/gimple-collector.c
index 7b29f35a7ab..7950a1e9090 100644
--- a/gcc/gimple-collector.c
+++ b/gcc/gimple-collector.c
@@ -38,7 +38,6 @@
#include "name-types.h"
#include "type-stringifier.hpp"
-#include "ipa-type-collector.h"
#include "type-collector.hpp"
#include "expr-walker.hpp"
#include "expr-collector.hpp"
diff --git a/gcc/gimple-walker.c b/gcc/gimple-walker.c
index ca2f874ce3a..496979e7b76 100644
--- a/gcc/gimple-walker.c
+++ b/gcc/gimple-walker.c
@@ -38,7 +38,6 @@
#include "name-types.h"
#include "type-stringifier.hpp"
-#include "ipa-type-collector.h"
#include "type-collector.hpp"
#include "expr-walker.hpp"
#include "expr-collector.hpp"
diff --git a/gcc/ipa-prototype.c b/gcc/ipa-prototype.c
index be14113007d..f194bb568fb 100644
--- a/gcc/ipa-prototype.c
+++ b/gcc/ipa-prototype.c
@@ -33,7 +33,6 @@
#include "types-inlines.h"
#include "name-types.h"
#include "compare-types.h"
-#include "ipa-type-collector.h"
#include "ipa-prototype.h"
#include "type-collector.hpp"
#include "type-stringifier.hpp"
@@ -714,10 +713,13 @@ update_escape_info_expr(ptrset_t &types, typemap &calc, const_tree expr, Reason
static unsigned int
iphw_execute()
{
- ptrset_t types;
+
+ GimpleTypeCollector collector;
+ collector.collect();
+ ptrset_t types = collector.get_pointer_set();
+
TypeEscaper::types = &types;
ExprEscaper::typeEscaper = &_typeEscaper;
- collect_types(types);
typemap eacalc; // Escape Analysis Calculation
// Intermediate results
diff --git a/gcc/ipa-type-collector.c b/gcc/ipa-type-collector.c
deleted file mode 100644
index 4bf2ca4f9af..00000000000
--- a/gcc/ipa-type-collector.c
+++ /dev/null
@@ -1,174 +0,0 @@
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "backend.h"
-#include "tree.h"
-#include "gimple-expr.h"
-#include "predict.h"
-#include "alloc-pool.h"
-#include "tree-pass.h"
-#include "cgraph.h"
-#include "diagnostic.h"
-#include "fold-const.h"
-#include "gimple-fold.h"
-#include "symbol-summary.h"
-#include "tree-vrp.h"
-#include "ipa-prop.h"
-#include "tree-pretty-print.h"
-#include "tree-inline.h"
-#include "ipa-fnsummary.h"
-#include "ipa-utils.h"
-#include "tree-ssa-ccp.h"
-#include "stringpool.h"
-#include "attribs.h"
-#include "tree-ssa-alias.h"
-#include "tree-ssanames.h"
-#include "gimple.h"
-#include "cfg.h"
-#include "gimple-iterator.h"
-#include "gimple-ssa.h"
-
-#include "compare-types.h"
-#include "types-inlines.h"
-#include <set>
-#include <string>
-#include <map>
-
-#include "collect-types.h"
-#include "name-types.h"
-#include "type-stringifier.hpp"
-
-#include "ipa-type-collector.h"
-#include "type-collector.hpp"
-#include "expr-walker.hpp"
-#include "expr-collector.hpp"
-#include "gimple-collector.hpp"
-
-//#define FUZZ_MODE 1
-
-namespace type_playground {
-enum type_comparison_func_enum {
- EQ_POINTER = 0,
- EQ_IDENTIFIER,
- EQ_MAIN_VARIANT,
- EQ_CANONICAL,
- EQ_STRUCTURAL,
- EQ_CANONICAL_STRICT,
- EQ_COMPARE,
- EQ_END
-};
-static unsigned const type_comparisons = EQ_END;
-static const char* names[type_comparisons] = {
- "EQ_POINTER",
- "EQ_IDENTIFIER",
- "EQ_MAIN_VARIANT",
- "EQ_CANONICAL",
- "EQ_CANONICAL_STRICT",
- "EQ_STRUCTURAL",
- "EQ_COMPARE"
-};
-typedef unsigned (*type_comparison_func_t)(const_tree, const_tree);
-static type_comparison_func_t comparisons[type_comparisons] = {
- eq_pointer,
- eq_identifier,
- eq_main_variant,
- eq_canonical,
- eq_canonical_internal,
- eq_type_structural,
- eq_type_compare
-};
-}
-
-
-static TypeCollector _typeCollector;
-static ExprCollector exprCollector;
-
-static void
-print_types_in_set(ptrset_t &types)
-{
- for (auto it = types.points_to_record.cbegin(); it != types.points_to_record.cend(); ++it)
- {
- const_tree type = *it;
- std::string name = type_to_string(type);
- }
-}
-
-static void
-sanity_check_ptr_xor_complement(ptrset_t &types)
-{
- for (auto i = types.points_to_record.cbegin(), e = types.points_to_record.cend(); i != e; ++i)
- {
- for (auto j = types.complement.cbegin(), f = types.complement.cend(); j != f; ++j)
- {
- const_tree type_ptr = *i;
- gcc_assert(type_ptr);
- const_tree type_com = *j;
- gcc_assert(type_com);
- const bool valid_sets = type_ptr != type_com;
- if (valid_sets) continue;
- // Normally, we want a stronger type comparison
- // that is not just the pointer address
- // but this is the first sanity check and then we will need to determine
- // the stronger type comparison.
- // But first we will need to fix the types...
- TypeStringifier stringifier;
- std::string name_ptr = stringifier.stringify(type_ptr);
- std::string name_com = stringifier.stringify(type_com);
- log("%p %s == %p %s\n", type_ptr, name_ptr.c_str(), type_com, name_com.c_str());
- gcc_unreachable();
- }
- }
-}
-
-void
-collect_types(ptrset_t &types)
-{
- GimpleTypeCollector collector;
- collector.collect();
- types = collector.get_pointer_set();
- sanity_check_ptr_xor_complement(types);
-}
-
-
-static unsigned int
-iphw_execute()
-{
- //test_type_equality::run_tests();
- //test_naming_types::run_tests();
- ptrset_t types;
- //ExprCollector::typeCollector = &_typeCollector;
- collect_types(types);
- return 0;
-}
-
-namespace {
-const pass_data pass_data_ipa_type_collector =
-{
- SIMPLE_IPA_PASS,
- "type-collector",
- OPTGROUP_NONE,
- TV_NONE,
- (PROP_cfg | PROP_ssa),
- 0,
- 0,
- TODO_rebuild_alias,
- 0,
-};
-
-class pass_ipa_type_collector : public simple_ipa_opt_pass
-{
-public:
- pass_ipa_type_collector (gcc::context *ctx)
- : simple_ipa_opt_pass(pass_data_ipa_type_collector, ctx)
- {}
-
- virtual bool gate(function*) { return flag_ipa_type_collector; }
- virtual unsigned execute (function*) { return iphw_execute(); }
-};
-} // anon namespace
-
-simple_ipa_opt_pass*
-make_pass_ipa_type_collector (gcc::context *ctx)
-{
- return new pass_ipa_type_collector (ctx);
-}
diff --git a/gcc/ipa-type-collector.h b/gcc/ipa-type-collector.h
deleted file mode 100644
index 16611c2db56..00000000000
--- a/gcc/ipa-type-collector.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include "collect-types.h"
-
-void collect_types(ptrset_t &types);
diff --git a/gcc/passes.def b/gcc/passes.def
index 16030e69e9d..72a83e28e4a 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -149,7 +149,6 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_ipa_profile);
NEXT_PASS (pass_ipa_icf);
NEXT_PASS (pass_ipa_devirt);
- NEXT_PASS (pass_ipa_type_collector);
NEXT_PASS (pass_ipa_cp);
NEXT_PASS (pass_ipa_sra);
NEXT_PASS (pass_ipa_cdtor_merge);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 554af1539a4..e760d29bc92 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -502,7 +502,6 @@ extern ipa_opt_pass_d *make_pass_ipa_fn_summary (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_inline (gcc::context *ctxt);
extern simple_ipa_opt_pass *make_pass_ipa_free_lang_data (gcc::context *ctxt);
extern simple_ipa_opt_pass *make_pass_ipa_free_fn_summary (gcc::context *ctxt);
-extern simple_ipa_opt_pass *make_pass_ipa_type_collector (gcc::context *ctxt);
extern simple_ipa_opt_pass *make_pass_ipa_prototype (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_cp (gcc::context *ctxt);
extern ipa_opt_pass_d *make_pass_ipa_sra (gcc::context *ctxt);