From: Kugan Vivekanandarajah Date: Sat, 20 Aug 2016 05:43:01 +0000 (+0000) Subject: Makefile.in: Add tree-vrp.h to GTFILES. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f90aa46c0f97bb69a4d6004f74f6fbcb7818431d;p=gcc.git Makefile.in: Add tree-vrp.h to GTFILES. gcc/ChangeLog: 2016-08-20 Kugan Vivekanandarajah * Makefile.in: Add tree-vrp.h to GTFILES. * gengtype.c (open_base_files): Add tree-vrp.h. * asan.c: Add tree-vrp.h which now has the definition value_range_type. * builtins.c: Likewise. * fold-const.c: Likewise. * gimple-builder.c: Likewise. * gimple-laddress.c: Likewise. * hsa-gen.c: Likewise. * internal-fn.c: Likewise. * ssa.h: Likewise. * targhooks.c: Liewise, * tree-ssa-address.c: Likewise. * tree-ssanames.h (value_range_type: Move to tree-vrp.h. * tree-vrp.c (struct value_range): Move to tree-vrp.h * tree-vrp.h: New file. From-SVN: r239638 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9946a9134b..1929ba8d000 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2016-08-20 Kugan Vivekanandarajah + + * Makefile.in: Add tree-vrp.h to GTFILES. + * gengtype.c (open_base_files): Add tree-vrp.h. + * asan.c: Add tree-vrp.h which now has the definition value_range_type. + * builtins.c: Likewise. + * fold-const.c: Likewise. + * gimple-builder.c: Likewise. + * gimple-laddress.c: Likewise. + * hsa-gen.c: Likewise. + * internal-fn.c: Likewise. + * ssa.h: Likewise. + * targhooks.c: Liewise, + * tree-ssa-address.c: Likewise. + * tree-ssanames.h (value_range_type: Move to tree-vrp.h. + * tree-vrp.c (struct value_range): Move to tree-vrp.h + * tree-vrp.h: New file. + 2016-08-20 Kugan Vivekanandarajah PR tree-optimization/61839 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7a0160f89b6..8d7cc51940b 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2456,6 +2456,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(srcdir)/tree-phinodes.c \ $(srcdir)/tree-ssa-alias.h \ $(srcdir)/tree-ssanames.h \ + $(srcdir)/tree-vrp.h \ $(srcdir)/ipa-prop.h \ $(srcdir)/trans-mem.c \ $(srcdir)/lto-streamer.h \ diff --git a/gcc/asan.c b/gcc/asan.c index 9047e1bfc8f..4fe2447fe7f 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "tm_p.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "optabs.h" #include "emit-rtl.h" diff --git a/gcc/builtins.c b/gcc/builtins.c index 03a0dc84d53..abc934b408a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "predict.h" #include "tm_p.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "expmed.h" #include "optabs.h" diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 30c1e0d440a..103ed2d3ba0 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -75,6 +75,7 @@ along with GCC; see the file COPYING3. If not see #include "md5.h" #include "case-cfn-macros.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "selftest.h" diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 05183554b2a..cecd552f714 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1713,7 +1713,7 @@ open_base_files (void) "explow.h", "calls.h", "cilk.h", "emit-rtl.h", "varasm.h", "stmt.h", "expr.h", "alloc-pool.h", "cselib.h", "insn-addr.h", "optabs.h", "libfuncs.h", "debug.h", "internal-fn.h", "gimple-fold.h", "tree-eh.h", - "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h", + "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h", "tree-vrp.h", "tree-phinodes.h", "ssa-iterators.h", "stringpool.h", "tree-ssanames.h", "tree-ssa-loop.h", "tree-ssa-loop-ivopts.h", "tree-ssa-loop-manip.h", "tree-ssa-loop-niter.h", "tree-into-ssa.h", "tree-dfa.h", diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c index f124554fc13..4fb21e4da00 100644 --- a/gcc/gimple-builder.c +++ b/gcc/gimple-builder.c @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" diff --git a/gcc/gimple-laddress.c b/gcc/gimple-laddress.c index 4cc57cf17d2..1a3c8e15a0d 100644 --- a/gcc/gimple-laddress.c +++ b/gcc/gimple-laddress.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "symtab.h" #include "tree.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "fold-const.h" #include "gimple-expr.h" diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index fb6d8a2dd8d..314bb5b231c 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-ssa.h" #include "tree-phinodes.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "tree-dfa.h" #include "ssa-iterators.h" diff --git a/gcc/internal-fn.c b/gcc/internal-fn.c index 49f34958663..cd4b6254c81 100644 --- a/gcc/internal-fn.c +++ b/gcc/internal-fn.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple.h" #include "predict.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "expmed.h" #include "optabs.h" diff --git a/gcc/ssa.h b/gcc/ssa.h index 40bc1c70de0..0ec1bf07817 100644 --- a/gcc/ssa.h +++ b/gcc/ssa.h @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "stringpool.h" #include "gimple-ssa.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "tree-phinodes.h" #include "ssa-iterators.h" diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 9d5be1706dd..97856face38 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-expr.h" #include "tm_p.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "optabs.h" #include "regs.h" diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index b04545c2ed5..30f0c325ae2 100644 --- a/gcc/tree-ssa-address.c +++ b/gcc/tree-ssa-address.c @@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" #include "stringpool.h" +#include "tree-vrp.h" #include "tree-ssanames.h" #include "expmed.h" #include "insn-config.h" diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h index c81b1a14184..8e66ce6f3ce 100644 --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -62,11 +62,6 @@ struct GTY ((variable_size)) range_info_def { #define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names)) #define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)]) - -/* Type of value ranges. See value_range_d In tree-vrp.c for a - description of these types. */ -enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING }; - /* Sets the value range to SSA. */ extern void set_range_info (tree, enum value_range_type, const wide_int_ref &, const wide_int_ref &); diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index d350a86c50c..192dbbdf845 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -61,32 +61,6 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "alloc-pool.h" -/* Range of values that can be associated with an SSA_NAME after VRP - has executed. */ -struct value_range -{ - /* Lattice value represented by this range. */ - enum value_range_type type; - - /* Minimum and maximum values represented by this range. These - values should be interpreted as follows: - - - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must - be NULL. - - - If TYPE == VR_RANGE then MIN holds the minimum value and - MAX holds the maximum value of the range [MIN, MAX]. - - - If TYPE == ANTI_RANGE the variable is known to NOT - take any values in the range [MIN, MAX]. */ - tree min; - tree max; - - /* Set of SSA names whose value ranges are equivalent to this one. - This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */ - bitmap equiv; -}; - #define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL } /* Allocation pools for tree-vrp allocations. */ @@ -109,8 +83,6 @@ live_on_edge (edge e, tree name) /* Local functions. */ static int compare_values (tree val1, tree val2); static int compare_values_warnv (tree val1, tree val2, bool *); -static void vrp_meet (value_range *, value_range *); -static void vrp_intersect_ranges (value_range *, value_range *); static tree vrp_evaluate_conditional_warnv_with_ops (enum tree_code, tree, tree, bool, bool *, bool *); @@ -4648,7 +4620,7 @@ compare_range_with_value (enum tree_code comp, value_range *vr, tree val, /* Debugging dumps. */ -void dump_value_range (FILE *, value_range *); +void dump_value_range (FILE *, const value_range *); void debug_value_range (value_range *); void dump_all_value_ranges (FILE *); void debug_all_value_ranges (void); @@ -4659,7 +4631,7 @@ void debug_vr_equiv (bitmap); /* Dump value range VR to FILE. */ void -dump_value_range (FILE *file, value_range *vr) +dump_value_range (FILE *file, const value_range *vr) { if (vr == NULL) fprintf (file, "[]"); @@ -8600,7 +8572,7 @@ vrp_intersect_ranges_1 (value_range *vr0, value_range *vr1) bitmap_copy (vr0->equiv, vr1->equiv); } -static void +void vrp_intersect_ranges (value_range *vr0, value_range *vr1) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -8625,7 +8597,7 @@ vrp_intersect_ranges (value_range *vr0, value_range *vr1) may not be the smallest possible such range. */ static void -vrp_meet_1 (value_range *vr0, value_range *vr1) +vrp_meet_1 (value_range *vr0, const value_range *vr1) { value_range saved; @@ -8697,8 +8669,8 @@ vrp_meet_1 (value_range *vr0, value_range *vr1) bitmap_clear (vr0->equiv); } -static void -vrp_meet (value_range *vr0, value_range *vr1) +void +vrp_meet (value_range *vr0, const value_range *vr1) { if (dump_file && (dump_flags & TDF_DETAILS)) { diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h new file mode 100644 index 00000000000..7ffb7e76a13 --- /dev/null +++ b/gcc/tree-vrp.h @@ -0,0 +1,54 @@ +/* Support routines for Value Range Propagation (VRP). + Copyright (C) 2016 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3, 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; see the file COPYING3. If not see +. */ + +/* Type of value ranges. See value_range_d In tree-vrp.c for a + description of these types. */ +enum value_range_type { VR_UNDEFINED, VR_RANGE, + VR_ANTI_RANGE, VR_VARYING, VR_LAST }; + +/* Range of values that can be associated with an SSA_NAME after VRP + has executed. */ +struct GTY(()) value_range +{ + /* Lattice value represented by this range. */ + enum value_range_type type; + + /* Minimum and maximum values represented by this range. These + values should be interpreted as follows: + + - If TYPE is VR_UNDEFINED or VR_VARYING then MIN and MAX must + be NULL. + + - If TYPE == VR_RANGE then MIN holds the minimum value and + MAX holds the maximum value of the range [MIN, MAX]. + + - If TYPE == ANTI_RANGE the variable is known to NOT + take any values in the range [MIN, MAX]. */ + tree min; + tree max; + + /* Set of SSA names whose value ranges are equivalent to this one. + This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */ + bitmap equiv; +}; + +extern void vrp_intersect_ranges (value_range *vr0, value_range *vr1); +extern void vrp_meet (value_range *vr0, const value_range *vr1); +extern void dump_value_range (FILE *, const value_range *); +