public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-507] Move code_helper to tree.h
Date: Mon, 16 May 2022 11:39:40 +0000 (GMT)	[thread overview]
Message-ID: <20220516113940.2D3D03858C56@sourceware.org> (raw)

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

commit r13-507-gadace78911705f25a06b48a0559612402065530e
Author: Richard Biener <rguenther@suse.de>
Date:   Mon May 16 12:09:29 2022 +0200

    Move code_helper to tree.h
    
    tree.h already contains combined_fn handling at the top and moving
    code_helper away from gimple-match.h makes improving the gimple_build
    API easier.
    
    2022-05-16  Richard Biener  <rguenther@suse.de>
    
            * gimple-match.h (code_helper): Move class ...
            * tree.h (code_helper): ... here.

Diff:
---
 gcc/gimple-match.h | 49 -------------------------------------------------
 gcc/tree.h         | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/gcc/gimple-match.h b/gcc/gimple-match.h
index d7b0b676059..e96c31ed09f 100644
--- a/gcc/gimple-match.h
+++ b/gcc/gimple-match.h
@@ -23,55 +23,6 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_GIMPLE_MATCH_H
 
 
-/* Helper to transparently allow tree codes and builtin function codes
-   exist in one storage entity.  */
-class code_helper
-{
-public:
-  code_helper () {}
-  code_helper (tree_code code) : rep ((int) code) {}
-  code_helper (combined_fn fn) : rep (-(int) fn) {}
-  code_helper (internal_fn fn) : rep (-(int) as_combined_fn (fn)) {}
-  explicit operator tree_code () const { return (tree_code) rep; }
-  explicit operator combined_fn () const { return (combined_fn) -rep; }
-  explicit operator internal_fn () const;
-  explicit operator built_in_function () const;
-  bool is_tree_code () const { return rep > 0; }
-  bool is_fn_code () const { return rep < 0; }
-  bool is_internal_fn () const;
-  bool is_builtin_fn () const;
-  int get_rep () const { return rep; }
-  bool operator== (const code_helper &other) { return rep == other.rep; }
-  bool operator!= (const code_helper &other) { return rep != other.rep; }
-  bool operator== (tree_code c) { return rep == code_helper (c).rep; }
-  bool operator!= (tree_code c) { return rep != code_helper (c).rep; }
-
-private:
-  int rep;
-};
-
-inline code_helper::operator internal_fn () const
-{
-  return as_internal_fn (combined_fn (*this));
-}
-
-inline code_helper::operator built_in_function () const
-{
-  return as_builtin_fn (combined_fn (*this));
-}
-
-inline bool
-code_helper::is_internal_fn () const
-{
-  return is_fn_code () && internal_fn_p (combined_fn (*this));
-}
-
-inline bool
-code_helper::is_builtin_fn () const
-{
-  return is_fn_code () && builtin_fn_p (combined_fn (*this));
-}
-
 /* Represents the condition under which an operation should happen,
    and the value to use otherwise.  The condition applies elementwise
    (as for VEC_COND_EXPR) if the values are vectors.  */
diff --git a/gcc/tree.h b/gcc/tree.h
index 5f4b03dc5df..c92c5bf344b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -75,6 +75,55 @@ as_internal_fn (combined_fn code)
   return internal_fn (int (code) - int (END_BUILTINS));
 }
 
+/* Helper to transparently allow tree codes and builtin function codes
+   exist in one storage entity.  */
+class code_helper
+{
+public:
+  code_helper () {}
+  code_helper (tree_code code) : rep ((int) code) {}
+  code_helper (combined_fn fn) : rep (-(int) fn) {}
+  code_helper (internal_fn fn) : rep (-(int) as_combined_fn (fn)) {}
+  explicit operator tree_code () const { return (tree_code) rep; }
+  explicit operator combined_fn () const { return (combined_fn) -rep; }
+  explicit operator internal_fn () const;
+  explicit operator built_in_function () const;
+  bool is_tree_code () const { return rep > 0; }
+  bool is_fn_code () const { return rep < 0; }
+  bool is_internal_fn () const;
+  bool is_builtin_fn () const;
+  int get_rep () const { return rep; }
+  bool operator== (const code_helper &other) { return rep == other.rep; }
+  bool operator!= (const code_helper &other) { return rep != other.rep; }
+  bool operator== (tree_code c) { return rep == code_helper (c).rep; }
+  bool operator!= (tree_code c) { return rep != code_helper (c).rep; }
+
+private:
+  int rep;
+};
+
+inline code_helper::operator internal_fn () const
+{
+  return as_internal_fn (combined_fn (*this));
+}
+
+inline code_helper::operator built_in_function () const
+{
+  return as_builtin_fn (combined_fn (*this));
+}
+
+inline bool
+code_helper::is_internal_fn () const
+{
+  return is_fn_code () && internal_fn_p (combined_fn (*this));
+}
+
+inline bool
+code_helper::is_builtin_fn () const
+{
+  return is_fn_code () && builtin_fn_p (combined_fn (*this));
+}
+
 /* Macros for initializing `tree_contains_struct'.  */
 #define MARK_TS_BASE(C)					\
   (tree_contains_struct[C][TS_BASE] = true)


                 reply	other threads:[~2022-05-16 11:39 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=20220516113940.2D3D03858C56@sourceware.org \
    --to=rguenth@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).