This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[addrmodes] Remove more useless new_decision calls


Now that the code flow is more clear, it can be seen how the second "finish_sequence" call in make_recog_sequence is no different from the other ones. In both cases, if the tree ends with a DT_accept_op, the DT_c_test need to be hung off tree->success, but the DT_accept_insn need not. This because after a DT_accept_op can only come a DT_accept_insn (see write_action).

So we can remove the "always_add" parameter and force it to false. I had left the behavior as it was previously for bug-compatibility, without really understanding why it was necessary.

Committed to branch, only causes label numbers to change (this time only for PowerPC and not for ARM).

Paolo
2006-08-23  Paolo Bonzini  <bonzini@gnu.org>

	* gendtree.c (finish_sequence): Remove always_add parameter, assume it is
	always false.
	(make_insn_sequence, make_split_sequence, make_peephole2_sequence): Adjust.

Index: gendtree.c
===================================================================
--- gendtree.c	(revision 116346)
+++ gendtree.c	(working copy)
@@ -639,13 +639,15 @@ add_to_sequence (rtx pattern, struct dec
 }
 
 /* Given the returned value from add_to_sequence, TREE, finish the sequence by adding
-   a DT_c_test node (as a separate tree if the last node in TREE is a DT_accept_opa or
-   if ALWAYS_ADD is true) for C_TEST at position SUBPOS, and a DT_accept_insn node with
-   parameters NEXT_INSN_CODE and NUM_CLOBBERS_TO_ADD.  */
+   a DT_c_test node for C_TEST at position SUBPOS, and a DT_accept_insn node with
+   parameters NEXT_INSN_CODE and NUM_CLOBBERS_TO_ADD.  
+
+   A DT_accept_op can only be followed by a DT_accept_insn, so if the DT_c_test is
+   not always true, the DT_c_test is added as a separate tree and linked via
+   tree->success.  */
 
 void
-finish_sequence (struct decision *tree, const char *subpos,
-		 const char *c_test, bool always_add,
+finish_sequence (struct decision *tree, const char *subpos, const char *c_test, 
 		 int next_insn_code, int num_clobbers_to_add)
 {
   struct decision_test *test, **place;
@@ -659,16 +661,16 @@ finish_sequence (struct decision *tree, 
     continue;
   place = &test->next;
 
-  /* Need a new node if we have another test to add.  */
-  if (test->type == DT_accept_op && (truth == -1 || always_add))
-    {
-      tree = new_decision (subpos, &tree->success);
-      place = &tree->tests;
-    }
-
   /* Skip the C test if it's known to be true at compile time.  */
   if (truth == -1)
     {
+      /* Need a new node if we have another test to add.  */
+      if (test->type == DT_accept_op)
+	{
+	  tree = new_decision (subpos, &tree->success);
+	  place = &tree->tests;
+	}
+
       test = new_decision_test (DT_c_test, &place);
       test->u.c_test = c_test;
     }
Index: gendtree.h
===================================================================
--- gendtree.h	(revision 116346)
+++ gendtree.h	(working copy)
@@ -118,6 +118,6 @@ struct decision *new_decision (const cha
 struct decision_test *new_decision_test (enum decision_type,
 					 struct decision_test ***);
 struct decision *add_to_sequence (rtx, struct decision_head *, const char *);
-void finish_sequence (struct decision *, const char *, const char *, bool, int, int);
+void finish_sequence (struct decision *, const char *, const char *, int, int);
 void merge_trees (struct decision_head *, struct decision_head *);
 void process_tree (struct decision_head *, const struct print_dtree_hooks *);
Index: genrecog.c
===================================================================
--- genrecog.c	(revision 116347)
+++ genrecog.c	(working copy)
@@ -658,7 +658,7 @@ make_recog_sequence (rtx insn)
   x = extract_pattern (insn, 1);
   validate_pattern (x, insn, NULL_RTX, 0);
   last = add_to_sequence (x, &head, "");
-  finish_sequence (last, "", c_test, false, next_insn_code, 0);
+  finish_sequence (last, "", c_test, next_insn_code, 0);
 
   /* If X is a PARALLEL, see if it ends with a group of CLOBBERs of (hard)
      registers or MATCH_SCRATCHes.  If so, set up to recognize the pattern
@@ -696,7 +696,7 @@ make_recog_sequence (rtx insn)
 
 	  /* Recognize it.  */
 	  last = add_to_sequence (new, &clobber_head, "");
-	  finish_sequence (last, "", c_test, true, next_insn_code, XVECLEN (x, 0) - i);
+	  finish_sequence (last, "", c_test, next_insn_code, XVECLEN (x, 0) - i);
 
 	  merge_trees (&head, &clobber_head);
 	}
@@ -719,7 +719,7 @@ make_split_sequence (rtx insn)
   x = extract_pattern (insn, 0);
   validate_pattern (x, insn, NULL_RTX, 0);
   last = add_to_sequence (x, &head, "");
-  finish_sequence (last, "", c_test, false, next_insn_code, 0);
+  finish_sequence (last, "", c_test, next_insn_code, 0);
 
   /* Define the subroutine we will call below and emit in genemit.  */
   printf ("extern rtx gen_split_%d (rtx, rtx *);\n", next_insn_code);
@@ -788,7 +788,7 @@ make_peephole2_sequence (rtx insn)
       next = &last->success;
     }
 
-  finish_sequence (last, c_test_pos, c_test, false, next_insn_code, 0);
+  finish_sequence (last, c_test_pos, c_test, next_insn_code, 0);
 
   /* Define the subroutine we will call below and emit in genemit.  */
   printf ("extern rtx gen_peephole2_%d (rtx, rtx *);\n", next_insn_code);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]