public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Subject: [COMMITTED] Make back_threader_registry inherit from back_jt_path_registry.
Date: Thu, 28 Oct 2021 14:32:14 +0200	[thread overview]
Message-ID: <20211028123215.498066-1-aldyh@redhat.com> (raw)

When a class's only purpose is to expose the methods of its only
member, it's really a derived class ;-).

Tested on x86-64 Linux.

Committed as obvious.

gcc/ChangeLog:

	* tree-ssa-threadbackward.c (class back_threader_registry):
	Inherit from back_jt_path_registry.
	(back_threader_registry::thread_through_all_blocks): Remove.
	(back_threader_registry::register_path): Remove
	m_lowlevel_registry prefix.
---
 gcc/tree-ssa-threadbackward.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index d9ce056b06c..6c1b15904ce 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -49,13 +49,10 @@ along with GCC; see the file COPYING3.  If not see
 // registered with register_path(), thread_through_all_blocks() is called
 // to modify the CFG.
 
-class back_threader_registry
+class back_threader_registry : public back_jt_path_registry
 {
 public:
   bool register_path (const vec<basic_block> &, edge taken);
-  bool thread_through_all_blocks (bool may_peel_loop_headers);
-private:
-  back_jt_path_registry m_lowlevel_registry;
 };
 
 // Class to abstract the profitability code for the backwards threader.
@@ -541,12 +538,6 @@ back_threader::debug ()
   dump (stderr);
 }
 
-bool
-back_threader_registry::thread_through_all_blocks (bool may_peel_loop_headers)
-{
-  return m_lowlevel_registry.thread_through_all_blocks (may_peel_loop_headers);
-}
-
 /* Examine jump threading path PATH and return TRUE if it is profitable to
    thread it, otherwise return FALSE.
 
@@ -873,8 +864,7 @@ bool
 back_threader_registry::register_path (const vec<basic_block> &m_path,
 				       edge taken_edge)
 {
-  vec<jump_thread_edge *> *jump_thread_path
-    = m_lowlevel_registry.allocate_thread_path ();
+  vec<jump_thread_edge *> *jump_thread_path = allocate_thread_path ();
 
   // The generic copier ignores the edge type.  We can build the
   // thread edges with any type.
@@ -885,12 +875,11 @@ back_threader_registry::register_path (const vec<basic_block> &m_path,
 
       edge e = find_edge (bb1, bb2);
       gcc_assert (e);
-      m_lowlevel_registry.push_edge (jump_thread_path, e, EDGE_COPY_SRC_BLOCK);
+      push_edge (jump_thread_path, e, EDGE_COPY_SRC_BLOCK);
     }
 
-  m_lowlevel_registry.push_edge (jump_thread_path,
-				 taken_edge, EDGE_NO_COPY_SRC_BLOCK);
-  m_lowlevel_registry.register_jump_thread (jump_thread_path);
+  push_edge (jump_thread_path, taken_edge, EDGE_NO_COPY_SRC_BLOCK);
+  register_jump_thread (jump_thread_path);
   return true;
 }
 
-- 
2.31.1


             reply	other threads:[~2021-10-28 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 12:32 Aldy Hernandez [this message]
2021-10-28 12:32 ` [COMMITTED] Improve backward threading with switches Aldy Hernandez

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=20211028123215.498066-1-aldyh@redhat.com \
    --to=aldyh@redhat.com \
    --cc=gcc-patches@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).