From patchwork Tue Aug 16 08:09:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 73955 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1863247qga; Tue, 16 Aug 2016 01:10:01 -0700 (PDT) X-Received: by 10.98.1.137 with SMTP id 131mr61816996pfb.165.1471335001680; Tue, 16 Aug 2016 01:10:01 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id qj2si31043675pac.7.2016.08.16.01.10.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 01:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-434031-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-434031-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-434031-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=UVZHbAlqDNGzCEY99 Jok2Ilg2VW6J9cXCiv9Ovx1WX9E6GdDX3rjzh4m03lJ6lCYVVc540bM17P03G6E7 PIp/Uq/c4VQ7qbBE1JYftcq7jgopWUKsjnU+CmpmlTdSeqcYZ0X3oLCqKrGQWnnR CWzT+lFu7IKywvodMVFhlddEVM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=IP5DJRRW6rfYCLmBbUaM74C eqHk=; b=NQYW9LXpsTKy5zIC0eMoqXamCoJMDhmU9qb752uZYHS2QTPZlxe7zb3 2Y/xQ0GK/v5gkzQ+vs78tuLt5aUcolDrSYPfeMADOpnB2KfzeGCNpuVFFbdzTrJ1 BFQY+kXtTBwCvZSwpujK4U1TlE3OkO3li67VgxmFI1ILawovvFNI= Received: (qmail 85209 invoked by alias); 16 Aug 2016 08:09:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 85199 invoked by uid 89); 16 Aug 2016 08:09:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Minimum, factor, 1906, sk:gimple- X-HELO: mail-pa0-f48.google.com Received: from mail-pa0-f48.google.com (HELO mail-pa0-f48.google.com) (209.85.220.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Aug 2016 08:09:37 +0000 Received: by mail-pa0-f48.google.com with SMTP id ti13so24243800pac.0 for ; Tue, 16 Aug 2016 01:09:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=CX6n9yZ2xt2kNgnR5+4HIhPPvpLP+kuMZNTjUHpY0yM=; b=hWm5vwT+BLG3/CMEWIn5BTn0rOAIhQ+w9KwfAtprFtbvpjd+YDCLbKevVU0bapIUMk JfsjYVKtGf9RFVp9yga1Ujojs82+RzZMDuc5GUDmKCTnQt9Q/ra+USCSa02oQ+RJi47M B+KdDRcRH9XvWD/KzLVLk3gcwjrYLthDnYoK4WhXXjGHCDa3hj3xSfWQgGD9RiEs4W1t HsgPPwuuJeOl8t7L4AT5ldQf/DuRBRwYeXJsTEYeZHVy3cHQpAs4aH2+seAYPzaAFafS Cc27YmWXmtVShAvu6rIkOoA3fKflKJb4+2jTTO9MGSCLxi3LFtK9En/+IcX7sr/riDI7 xjzg== X-Gm-Message-State: AEkoouuYedCt4aXQloKdxCjygIEOONp0xMxbFW4ZbgEH/qQHLV/yDT85xJjUoet08XNxkRHk X-Received: by 10.66.123.105 with SMTP id lz9mr5101808pab.56.1471334976227; Tue, 16 Aug 2016 01:09:36 -0700 (PDT) Received: from [10.1.1.3] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by smtp.gmail.com with ESMTPSA id bw10sm36896061pac.27.2016.08.16.01.09.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 01:09:35 -0700 (PDT) Subject: Re: [RFC][IPA-VRP] Re-factor tree-vrp to factor out common code To: Richard Biener References: <57886949.8010300@linaro.org> <57886A2A.4070703@linaro.org> <21d3ea50-a799-0b5b-4736-3beeca7860c4@linaro.org> <89a0bb8c-2744-49c5-8c4b-e2b4e92a26c3@linaro.org> <64f0e8a8-a933-53ff-bc60-e21db86f2608@linaro.org> Cc: "gcc-patches@gcc.gnu.org" , Jan Hubicka , Martin Jambor From: kugan Message-ID: <83dbcfbd-8e81-7df9-3519-5f98a332dfd2@linaro.org> Date: Tue, 16 Aug 2016 18:09:30 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <64f0e8a8-a933-53ff-bc60-e21db86f2608@linaro.org> X-IsSubscribed: yes On 23/07/16 20:12, kugan wrote: > Hi Richard, > >>> As we had value_range_type in tree-ssanames.h why not put value_range there? >>> >> For IPA_VRP, we now need value_range used in ipa-prop.h (in ipa-vrp >> patch). Based on this, attached patch now adds struct value_range to >> tree-ssanames.h and fixes the header files. Please note that I also had >> to add other headers in few places due to the dependency. Are you OK >> with this ? > Here is alternate patch where we keep struct value_range and enum > value_range_type to tree-vrp.h. May be it is a better approach? Please > let me know what is your preference. > Ping? This patch places value_range_type and value_range in tree-vrp.h. May be this is better? Alternate patch which keeps value_range_type and value_range in tree-ssanames.h is in: https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01491.html I also added the necessary header files changed needed for ipa-vrp as part of this patch so that changes needed are clear. Thaks, Kugan >From b2d81fdf31df08ca94da46fe93faf1a7f2d0ac1a Mon Sep 17 00:00:00 2001 From: Kugan Vivekanandarajah Date: Mon, 15 Aug 2016 09:19:52 +1000 Subject: [PATCH 1/5] Factor out and expose value_range api for IPA-VRP --- gcc/Makefile.in | 1 + gcc/asan.c | 1 + gcc/builtins.c | 1 + gcc/cgraph.c | 1 + gcc/cgraphunit.c | 1 + gcc/fold-const.c | 1 + gcc/gengtype.c | 2 +- gcc/gimple-builder.c | 1 + gcc/gimple-laddress.c | 1 + gcc/hsa-gen.c | 1 + gcc/internal-fn.c | 1 + gcc/ipa-cp.c | 1 + gcc/ipa-devirt.c | 1 + gcc/ipa-inline-transform.c | 1 + gcc/ipa-inline.c | 1 + gcc/ipa-profile.c | 1 + gcc/ipa-utils.c | 1 + gcc/ipa.c | 1 + gcc/lto/lto-partition.c | 1 + gcc/lto/lto.c | 1 + gcc/ssa.h | 1 + gcc/targhooks.c | 1 + gcc/toplev.c | 1 + gcc/tree-ssa-address.c | 1 + gcc/tree-ssanames.h | 5 ----- gcc/tree-vrp.c | 43 +++++++----------------------------- gcc/tree-vrp.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 27 files changed, 86 insertions(+), 41 deletions(-) create mode 100644 gcc/tree-vrp.h diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7a0160f..8d7cc51 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 9047e1b..4fe2447 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 03a0dc8..abc934b 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/cgraph.c b/gcc/cgraph.c index 9bc5b6b..0a43850 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "ipa-utils.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "cfgloop.h" diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index d8f7903..5bb6904 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -190,6 +190,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "debug.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "gimple-pretty-print.h" #include "plugin.h" diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 30c1e0d..103ed2d 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 0518355..cecd552 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 f124554..4fb21e4 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 4cc57cf..1a3c8e1 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 fb6d8a2..314bb5b 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 49f3495..cd4b625 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/ipa-cp.c b/gcc/ipa-cp.c index 5b6cb9a..e9562a5 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -114,6 +114,7 @@ along with GCC; see the file COPYING3. If not see #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" diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 2cf018b..62a08f8 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -122,6 +122,7 @@ along with GCC; see the file COPYING3. If not see #include "ipa-utils.h" #include "gimple-fold.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "demangle.h" diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c index 98c7f96..efe7421 100644 --- a/gcc/ipa-inline-transform.c +++ b/gcc/ipa-inline-transform.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "tree-cfg.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "tree-inline.h" diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 5c9366a..82bb94f 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -108,6 +108,7 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "profile.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "ipa-utils.h" diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c index da17bcd..e87615a 100644 --- a/gcc/ipa-profile.c +++ b/gcc/ipa-profile.c @@ -62,6 +62,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "tree-inline.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c index 5eb7d5f..61d8dd1 100644 --- a/gcc/ipa-utils.c +++ b/gcc/ipa-utils.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "splay-tree.h" #include "ipa-utils.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" diff --git a/gcc/ipa.c b/gcc/ipa.c index 6f4693f..b02713f 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-iterator.h" #include "ipa-utils.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "dbgcnt.h" diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c index 453343a..b52d175 100644 --- a/gcc/lto/lto-partition.c +++ b/gcc/lto/lto-partition.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "lto-streamer.h" #include "params.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "ipa-inline.h" #include "lto-partition.h" diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 73d1e26..bbf02e8 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see #include "toplev.h" #include "stor-layout.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "common.h" #include "debug.h" diff --git a/gcc/ssa.h b/gcc/ssa.h index 40bc1c7..0ec1bf0 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 69037c1..6f67210 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/toplev.c b/gcc/toplev.c index 2607904..668eccd 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -71,6 +71,7 @@ along with GCC; see the file COPYING3. If not see #include "dwarf2out.h" #include "ipa-reference.h" #include "symbol-summary.h" +#include "tree-vrp.h" #include "ipa-prop.h" #include "gcse.h" #include "tree-chkp.h" diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c index b04545c..30f0c32 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 c81b1a1..8e66ce6 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 6934914..cf04bec 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -60,32 +60,7 @@ along with GCC; see the file COPYING3. If not see #include "case-cfn-macros.h" #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; -}; +#include "domwalk.h" #define VR_INITIALIZER { VR_UNDEFINED, NULL_TREE, NULL_TREE, NULL } @@ -109,8 +84,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 *); @@ -4633,7 +4606,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); @@ -4644,7 +4617,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, "[]"); @@ -8534,7 +8507,7 @@ intersect_ranges (enum value_range_type *vr0type, /* Intersect the two value-ranges *VR0 and *VR1 and store the result in *VR0. This may not be the smallest possible such range. */ -static void +void vrp_intersect_ranges_1 (value_range *vr0, value_range *vr1) { value_range saved; @@ -8586,7 +8559,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)) @@ -8611,7 +8584,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; @@ -8683,8 +8656,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 0000000..e514c1e --- /dev/null +++ b/gcc/tree-vrp.h @@ -0,0 +1,54 @@ +/* Support routines for Value Range Propagation (VRP). + Copyright (C) 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 *); + -- 2.7.4