diff mbox

Another small cleanup to the const_and_copies stack

Message ID 55F348AB.8030806@redhat.com
State New
Headers show

Commit Message

Jeff Law Sept. 11, 2015, 9:33 p.m. UTC
While working on the next significant hunk of changes towards 47679, I 
saw a few more obvious cleanups that ought to happen.

First, we have a policy for data members that they ought to be prefixed 
with m_ to denote the extra overhead in accessing those members.  The 
data member in the const_and_copies unwinder stack didn't have the 
prefix.  This patch fixes that oversight and the obvious fallout.

It also adds an additional high level comment for the const_and_copies 
stack and updates an out-of-date comment in tree-ssa-dom.c.

This was extracted out of a larger patch that has bootstrapped and 
regression tested on x86_64.  This patch was quick-strapped to ensure it 
didn't break anything.

This is (of course) related to BZ47679.


Installed on the trunk.

Jeff
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 45f3b15..839b53e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@ 
+2015-09-11  Jeff Law  <law@redhat.com>
+
+	PR tree-optimization/47679
+	* tree-ssa-dom.c (struct cond_equivalence): Update comment.
+	* tree-ssa-scopedtables.h (class const_and_copies): Prefix data
+	member with m_.  Update inline member functions as necessary.  Add
+	toplevel comment.
+	* tree-ssa-scopedtables.c: Update const_and_copies's member
+	functions to use m_ prefix to access the stack.
+
 2015-09-11  Aditya Kumar  <aditya.k7@samsung.com>
 
         * graphite-optimize-isl.c (disable_tiling): Remove.
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index f0b19ff..e3eb0db 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -92,8 +92,7 @@  struct cond_equivalence
 };
 
 
-/* Structure for recording edge equivalences as well as any pending
-   edge redirections during the dominator optimizer.
+/* Structure for recording edge equivalences.
 
    Computing and storing the edge equivalences instead of creating
    them on-demand can save significant amounts of time, particularly
@@ -101,10 +100,7 @@  struct cond_equivalence
 
    These structures live for a single iteration of the dominator
    optimizer in the edge's AUX field.  At the end of an iteration we
-   free each of these structures and update the AUX field to point
-   to any requested redirection target (the code for updating the
-   CFG and SSA graph for edge redirection expects redirection edge
-   targets to be in the AUX field for each edge.  */
+   free each of these structures.  */
 
 struct edge_info
 {
diff --git a/gcc/tree-ssa-scopedtables.c b/gcc/tree-ssa-scopedtables.c
index 1fea69a..fedd92a 100644
--- a/gcc/tree-ssa-scopedtables.c
+++ b/gcc/tree-ssa-scopedtables.c
@@ -35,11 +35,11 @@  along with GCC; see the file COPYING3.  If not see
 void
 const_and_copies::pop_to_marker (void)
 {
-  while (stack.length () > 0)
+  while (m_stack.length () > 0)
     {
       tree prev_value, dest;
 
-      dest = stack.pop ();
+      dest = m_stack.pop ();
 
       /* A NULL value indicates we should stop unwinding, otherwise
 	 pop off the next entry as they're recorded in pairs.  */
@@ -55,7 +55,7 @@  const_and_copies::pop_to_marker (void)
 	  fprintf (dump_file, "\n");
 	}
 
-      prev_value = stack.pop ();
+      prev_value = m_stack.pop ();
       set_ssa_name_value (dest, prev_value);
     }
 }
@@ -90,9 +90,9 @@  const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x)
     }
 
   set_ssa_name_value (x, y);
-  stack.reserve (2);
-  stack.quick_push (prev_x);
-  stack.quick_push (x);
+  m_stack.reserve (2);
+  m_stack.quick_push (prev_x);
+  m_stack.quick_push (x);
 }
 
 /* A new value has been assigned to LHS.  If necessary, invalidate any
@@ -114,16 +114,16 @@  const_and_copies::invalidate (tree lhs)
      then it's a "stop unwinding" marker.  Else the current marker is
      the SSA_NAME with an equivalence and the prior entry in the stack
      is what the current element is equivalent to.  */
-  for (int i = stack.length() - 1; i >= 0; i--)
+  for (int i = m_stack.length() - 1; i >= 0; i--)
     {
       /* Ignore the stop unwinding markers.  */
-      if ((stack)[i] == NULL)
+      if ((m_stack)[i] == NULL)
 	continue;
 
       /* We want to check the current value of stack[i] to see if
 	 it matches LHS.  If so, then invalidate.  */
-      if (SSA_NAME_VALUE ((stack)[i]) == lhs)
-	record_const_or_copy ((stack)[i], NULL_TREE);
+      if (SSA_NAME_VALUE ((m_stack)[i]) == lhs)
+	record_const_or_copy ((m_stack)[i], NULL_TREE);
 
       /* Remember, we're dealing with two elements in this case.  */
       i--;
diff --git a/gcc/tree-ssa-scopedtables.h b/gcc/tree-ssa-scopedtables.h
index 13f7ccb..f7d9ca4 100644
--- a/gcc/tree-ssa-scopedtables.h
+++ b/gcc/tree-ssa-scopedtables.h
@@ -20,14 +20,20 @@  along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_TREE_SSA_SCOPED_TABLES_H
 #define GCC_TREE_SSA_SCOPED_TABLES_H
 
+/* This class defines an unwindable const/copy equivalence table
+   layered on top of SSA_NAME_VALUE/set_ssa_name_value.
+
+   Essentially it's just a stack of name,prev value pairs with a
+   special marker (NULL) to indicate unwind points.  */
+
 class const_and_copies
 {
  public:
-  const_and_copies (void) { stack.create (20); };
-  ~const_and_copies (void) { stack.release (); }
+  const_and_copies (void) { m_stack.create (20); };
+  ~const_and_copies (void) { m_stack.release (); }
 
   /* Push the unwinding marker onto the stack.  */
-  void push_marker (void) { stack.safe_push (NULL_TREE); }
+  void push_marker (void) { m_stack.safe_push (NULL_TREE); }
 
   /* Restore the const/copies table to its state when the last marker
      was pushed.  */
@@ -47,7 +53,7 @@  class const_and_copies
   void invalidate (tree);
 
  private:
-  vec<tree> stack;
+  vec<tree> m_stack;
 };
 
 #endif /* GCC_TREE_SSA_SCOPED_TABLES_H */