public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5222] path solver: Merge path_range_query constructors.
Date: Sat, 13 Nov 2021 10:48:30 +0000 (GMT)	[thread overview]
Message-ID: <20211113104830.16BD9385840E@sourceware.org> (raw)

https://gcc.gnu.org/g:dc777f6b0646fed2f18a580ce249cb6404f89205

commit r12-5222-gdc777f6b0646fed2f18a580ce249cb6404f89205
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri Nov 12 09:06:55 2021 +0100

    path solver: Merge path_range_query constructors.
    
    There's no need for two constructors, when we can do it all with one
    that defaults to the common behavior:
    
    path_range_query (bool resolve = true, gimple_ranger *ranger = NULL);
    
    Tested on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * gimple-range-path.cc (path_range_query::path_range_query): Merge
            ctors.
            (path_range_query::import_p): Move from header file.
            (path_range_query::~path_range_query): Adjust for combined ctors.
            * gimple-range-path.h: Merge ctors.
            (path_range_query::import_p): Move to .cc file.

Diff:
---
 gcc/gimple-range-path.cc | 31 +++++++++++++++++--------------
 gcc/gimple-range-path.h  | 17 ++++-------------
 2 files changed, 21 insertions(+), 27 deletions(-)

diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc
index 71b290434cb..32b2cb57597 100644
--- a/gcc/gimple-range-path.cc
+++ b/gcc/gimple-range-path.cc
@@ -36,33 +36,36 @@ along with GCC; see the file COPYING3.  If not see
 // Internal construct to help facilitate debugging of solver.
 #define DEBUG_SOLVER (dump_file && (param_threader_debug == THREADER_DEBUG_ALL))
 
-path_range_query::path_range_query (gimple_ranger *ranger, bool resolve)
+path_range_query::path_range_query (bool resolve, gimple_ranger *ranger)
   : m_cache (new ssa_global_cache),
     m_has_cache_entry (BITMAP_ALLOC (NULL)),
-    m_ranger (ranger),
     m_resolve (resolve),
-    m_alloced_ranger (false)
+    m_alloced_ranger (!ranger)
 {
-  m_oracle = new path_oracle (ranger->oracle ());
-}
+  if (m_alloced_ranger)
+    m_ranger = new gimple_ranger;
+  else
+    m_ranger = ranger;
 
-path_range_query::path_range_query (bool resolve)
-  : m_cache (new ssa_global_cache),
-    m_has_cache_entry (BITMAP_ALLOC (NULL)),
-    m_ranger (new gimple_ranger),
-    m_resolve (resolve),
-    m_alloced_ranger (true)
-{
   m_oracle = new path_oracle (m_ranger->oracle ());
 }
 
 path_range_query::~path_range_query ()
 {
-  BITMAP_FREE (m_has_cache_entry);
-  delete m_cache;
   delete m_oracle;
   if (m_alloced_ranger)
     delete m_ranger;
+  BITMAP_FREE (m_has_cache_entry);
+  delete m_cache;
+}
+
+// Return TRUE if NAME is in the import bitmap.
+
+bool
+path_range_query::import_p (tree name)
+{
+  return (TREE_CODE (name) == SSA_NAME
+	  && bitmap_bit_p (m_imports, SSA_NAME_VERSION (name)));
 }
 
 // Mark cache entry for NAME as unused.
diff --git a/gcc/gimple-range-path.h b/gcc/gimple-range-path.h
index ea4864d35ef..f8b2b04e57c 100644
--- a/gcc/gimple-range-path.h
+++ b/gcc/gimple-range-path.h
@@ -32,10 +32,10 @@ along with GCC; see the file COPYING3.  If not see
 class path_range_query : public range_query
 {
 public:
-  path_range_query (class gimple_ranger *ranger, bool resolve = true);
-  path_range_query (bool resolve = true);
+  path_range_query (bool resolve = true, class gimple_ranger *ranger = NULL);
   virtual ~path_range_query ();
-  void compute_ranges (const vec<basic_block> &, const bitmap_head *imports = NULL);
+  void compute_ranges (const vec<basic_block> &,
+		       const bitmap_head *imports = NULL);
   void compute_ranges (edge e);
   void compute_imports (bitmap imports, basic_block exit);
   bool range_of_expr (irange &r, tree name, gimple * = NULL) override;
@@ -64,7 +64,7 @@ private:
   void compute_phi_relations (basic_block bb, basic_block prev);
   void maybe_register_phi_relation (gphi *, tree arg);
   bool add_to_imports (tree name, bitmap imports);
-  inline bool import_p (tree name);
+  bool import_p (tree name);
 
   // Path navigation.
   void set_path (const vec<basic_block> &);
@@ -104,13 +104,4 @@ private:
   bool m_alloced_ranger;
 };
 
-// Return TRUE if NAME is in the import bitmap.
-
-bool
-path_range_query::import_p (tree name)
-{
-  return (TREE_CODE (name) == SSA_NAME
-	  && bitmap_bit_p (m_imports, SSA_NAME_VERSION (name)));
-}
-
 #endif // GCC_TREE_SSA_THREADSOLVER_H


                 reply	other threads:[~2021-11-13 10:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211113104830.16BD9385840E@sourceware.org \
    --to=aldyh@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).