public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew MacLeod <amacleod@redhat.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "hernandez, aldy" <aldyh@redhat.com>
Subject: [PATCH] Move class value_relation the header file.
Date: Thu, 29 Sep 2022 18:35:32 -0400	[thread overview]
Message-ID: <b8178ef8-4fc8-f7c3-80fa-1af995c23d3c@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Class value_relation was private within the value-relation.cc file.   
This class simply represents a relation between 2 ssa-names, and can 
perform various operations on them.   The oracle uses it under the 
covers to maintains its tables.

It can be used in other places as well, so lets just expose it in the 
header file.

Bootstrapped on x86_64-pc-linux-gnu with no regressions.  Pushed.

Andrew


[-- Attachment #2: 0003-Move-class-value_relation-the-header-file.patch --]
[-- Type: text/x-patch, Size: 3944 bytes --]

From 929a451108a26f3e7a41d36d3588082603c63919 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Thu, 22 Sep 2022 17:27:36 -0400
Subject: [PATCH 3/6] Move class value_relation the header file.

	* value-relation.cc (class value_relation): Move to .h file.
	(value_relation::set_relation): Ditto.
	(value_relation::value_relation): ditto.
	* value-relation.h (class value_relation): Move from .cc file.
	(value_relation::set_relation): Ditto
	(value_relation::value_relation): Ditto.
---
 gcc/value-relation.cc | 55 -----------------------------------------
 gcc/value-relation.h  | 57 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 55 deletions(-)

diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 7fc22d30126..e6f5ef4d5e1 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -635,61 +635,6 @@ equiv_oracle::dump (FILE *f) const
 
 
 // --------------------------------------------------------------------------
-
-// The value-relation class is used to encapsulate the represention of an
-// individual relation between 2 ssa-names, and to facilitate operating on
-// the relation.
-
-class value_relation
-{
-public:
-  value_relation ();
-  value_relation (relation_kind kind, tree n1, tree n2);
-  void set_relation (relation_kind kind, tree n1, tree n2);
-
-  inline relation_kind kind () const { return related; }
-  inline tree op1 () const { return name1; }
-  inline tree op2 () const { return name2; }
-
-  bool union_ (value_relation &p);
-  bool intersect (value_relation &p);
-  void negate ();
-  bool apply_transitive (const value_relation &rel);
-
-  void dump (FILE *f) const;
-private:
-  relation_kind related;
-  tree name1, name2;
-};
-
-// Set relation R between ssa_name N1 and N2.
-
-inline void
-value_relation::set_relation (relation_kind r, tree n1, tree n2)
-{
-  related = r;
-  name1 = n1;
-  name2 = n2;
-}
-
-// Default constructor.
-
-inline
-value_relation::value_relation ()
-{
-  related = VREL_VARYING;
-  name1 = NULL_TREE;
-  name2 = NULL_TREE;
-}
-
-// Constructor for relation R between SSA version N1 nd N2.
-
-inline
-value_relation::value_relation (relation_kind kind, tree n1, tree n2)
-{
-  set_relation (kind, n1, n2);
-}
-
 // Negate the current relation.
 
 void
diff --git a/gcc/value-relation.h b/gcc/value-relation.h
index 64884a8eea2..f3b18ac62ef 100644
--- a/gcc/value-relation.h
+++ b/gcc/value-relation.h
@@ -256,4 +256,61 @@ private:
   bitmap_obstack m_bitmaps;
   struct obstack m_chain_obstack;
 };
+
+// The value-relation class is used to encapsulate the represention of an
+// individual relation between 2 ssa-names, and to facilitate operating on
+// the relation.
+
+class value_relation
+{
+public:
+  value_relation ();
+  value_relation (relation_kind kind, tree n1, tree n2);
+  void set_relation (relation_kind kind, tree n1, tree n2);
+
+  inline relation_kind kind () const { return related; }
+  inline tree op1 () const { return name1; }
+  inline tree op2 () const { return name2; }
+
+  bool union_ (value_relation &p);
+  bool intersect (value_relation &p);
+  void negate ();
+  bool apply_transitive (const value_relation &rel);
+
+  void dump (FILE *f) const;
+private:
+  relation_kind related;
+  tree name1, name2;
+};
+
+// Set relation R between ssa_name N1 and N2.
+
+inline void
+value_relation::set_relation (relation_kind r, tree n1, tree n2)
+{
+  gcc_checking_assert (TREE_CODE (n1) == SSA_NAME
+		       && TREE_CODE (n2) == SSA_NAME);
+  related = r;
+  name1 = n1;
+  name2 = n2;
+}
+
+// Default constructor.
+
+inline
+value_relation::value_relation ()
+{
+  related = VREL_VARYING;
+  name1 = NULL_TREE;
+  name2 = NULL_TREE;
+}
+
+// Constructor for relation R between SSA version N1 nd N2.
+
+inline
+value_relation::value_relation (relation_kind kind, tree n1, tree n2)
+{
+  set_relation (kind, n1, n2);
+}
+
 #endif  /* GCC_VALUE_RELATION_H */
-- 
2.37.3


                 reply	other threads:[~2022-09-29 22:35 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=b8178ef8-4fc8-f7c3-80fa-1af995c23d3c@redhat.com \
    --to=amacleod@redhat.com \
    --cc=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).