public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
  2015-04-21 13:25 ` [PATCH 07/12] provide default for MASK_RETURN_ADDR tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:30   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 06/12] provide default for RETURN_ADDR_OFFSET tbsaunde+gcc
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h (INSN_REFERENCES_ARE_DELAYED): New definition.
	* reorg.c (redundant_insn): Remove ifdef
	INSN_REFERENCES_ARE_DELAYED.
	* resource.c (mark_referenced_resources): Likewise.
---
 gcc/defaults.h | 4 ++++
 gcc/reorg.c    | 4 ----
 gcc/resource.c | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 79cb599..cafcb1e 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1205,6 +1205,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define INSN_SETS_ARE_DELAYED(INSN) false
 #endif
 
+#ifndef INSN_REFERENCES_ARE_DELAYED
+#define INSN_REFERENCES_ARE_DELAYED(INSN) false
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index ae77f0a..d8d8ab69 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1558,10 +1558,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
 	  if (INSN_SETS_ARE_DELAYED (seq->insn (0)))
 	    return 0;
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
 	  if (INSN_REFERENCES_ARE_DELAYED (seq->insn (0)))
 	    return 0;
-#endif
 
 	  /* See if any of the insns in the delay slot match, updating
 	     resource requirements as we go.  */
@@ -1658,10 +1656,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
 	  if (INSN_SETS_ARE_DELAYED (control))
 	    return 0;
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
 	  if (INSN_REFERENCES_ARE_DELAYED (control))
 	    return 0;
-#endif
 
 	  if (JUMP_P (control))
 	    annul_p = INSN_ANNULLED_BRANCH_P (control);
diff --git a/gcc/resource.c b/gcc/resource.c
index 5af9376..26d9fca 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -392,11 +392,9 @@ mark_referenced_resources (rtx x, struct resources *res,
 			  include_delayed_effects
 			  ? MARK_SRC_DEST_CALL : MARK_SRC_DEST);
 
-#ifdef INSN_REFERENCES_ARE_DELAYED
       if (! include_delayed_effects
 	  && INSN_REFERENCES_ARE_DELAYED (as_a <rtx_insn *> (x)))
 	return;
-#endif
 
       /* No special processing, just speed up.  */
       mark_referenced_resources (PATTERN (x), res, include_delayed_effects);
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 10/12] remove more ifdefs for HAVE_cc0
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (7 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 05/12] make some HAVE_cc0 code always compiled tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:55   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER tbsaunde+gcc
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* caller-save.c (insert_one_insn): Remove ifdef HAVE_cc0.
	* cfgcleanup.c (flow_find_cross_jump): Likewise.
	(flow_find_head_matching_sequence): Likewise.
	(try_head_merge_bb): Likewise.
	* combine.c (can_combine_p): Likewise.
	(try_combine): Likewise.
	(distribute_notes): Likewise.
	* df-problems.c (can_move_insns_across): Likewise.
	* final.c (final): Likewise.
	* gcse.c (insert_insn_end_basic_block): Likewise.
	* ira.c (find_moveable_pseudos): Likewise.
	* reorg.c (try_merge_delay_insns): Likewise.
	(fill_simple_delay_slots): Likewise.
	(fill_slots_from_thread): Likewise.
	* sched-deps.c (sched_analyze_2): Likewise.
---
 gcc/caller-save.c |  4 +---
 gcc/cfgcleanup.c  | 26 ++++++++------------------
 gcc/combine.c     | 54 +++++++++++++++++++++---------------------------------
 gcc/df-problems.c |  5 +----
 gcc/final.c       | 29 ++++++++++++++---------------
 gcc/gcse.c        | 24 +++++++++++++-----------
 gcc/ira.c         |  5 +----
 gcc/reorg.c       | 26 +++++++-------------------
 gcc/sched-deps.c  |  6 +++---
 9 files changed, 69 insertions(+), 110 deletions(-)

diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index fc575eb..76c3a7e 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1400,18 +1400,16 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
   rtx_insn *insn = chain->insn;
   struct insn_chain *new_chain;
 
-#if HAVE_cc0
   /* If INSN references CC0, put our insns in front of the insn that sets
      CC0.  This is always safe, since the only way we could be passed an
      insn that references CC0 is for a restore, and doing a restore earlier
      isn't a problem.  We do, however, assume here that CALL_INSNs don't
      reference CC0.  Guard against non-INSN's like CODE_LABEL.  */
 
-  if ((NONJUMP_INSN_P (insn) || JUMP_P (insn))
+  if (HAVE_cc0 && (NONJUMP_INSN_P (insn) || JUMP_P (insn))
       && before_p
       && reg_referenced_p (cc0_rtx, PATTERN (insn)))
     chain = chain->prev, insn = chain->insn;
-#endif
 
   new_chain = new_insn_chain ();
   if (before_p)
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 58d235e..e5c4747 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1416,12 +1416,11 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx_insn **f1,
       i2 = PREV_INSN (i2);
     }
 
-#if HAVE_cc0
   /* Don't allow the insn after a compare to be shared by
      cross-jumping unless the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && ! sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+      && ! sets_cc0_p (last1))
     last1 = afterlast1, last2 = afterlast2, last_dir = afterlast_dir, ninsns--;
-#endif
 
   /* Include preceding notes and labels in the cross-jump.  One,
      this may bring us to the head of the blocks as requested above.
@@ -1539,12 +1538,11 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx_insn **f
       i2 = NEXT_INSN (i2);
     }
 
-#if HAVE_cc0
   /* Don't allow a compare to be shared by cross-jumping unless the insn
      after the compare is also shared.  */
-  if (ninsns && reg_mentioned_p (cc0_rtx, last1) && sets_cc0_p (last1))
+  if (HAVE_cc0 && ninsns && reg_mentioned_p (cc0_rtx, last1)
+      && sets_cc0_p (last1))
     last1 = beforelast1, last2 = beforelast2, ninsns--;
-#endif
 
   if (ninsns)
     {
@@ -2330,11 +2328,9 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
     {
-#if HAVE_cc0
-      if (reg_mentioned_p (cc0_rtx, jump))
+      if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
 	move_before = prev_nonnote_nondebug_insn (jump);
       else
-#endif
 	move_before = jump;
     }
 
@@ -2499,11 +2495,9 @@ try_head_merge_bb (basic_block bb)
       cond = get_condition (jump, &move_before, true, false);
       if (cond == NULL_RTX)
 	{
-#if HAVE_cc0
-	  if (reg_mentioned_p (cc0_rtx, jump))
+	  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
 	    move_before = prev_nonnote_nondebug_insn (jump);
 	  else
-#endif
 	    move_before = jump;
 	}
     }
@@ -2522,12 +2516,10 @@ try_head_merge_bb (basic_block bb)
 	  /* Try again, using a different insertion point.  */
 	  move_before = jump;
 
-#if HAVE_cc0
 	  /* Don't try moving before a cc0 user, as that may invalidate
 	     the cc0.  */
-	  if (reg_mentioned_p (cc0_rtx, jump))
+	  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
 	    break;
-#endif
 
 	  continue;
 	}
@@ -2582,12 +2574,10 @@ try_head_merge_bb (basic_block bb)
 	  /* For the unmerged insns, try a different insertion point.  */
 	  move_before = jump;
 
-#if HAVE_cc0
 	  /* Don't try moving before a cc0 user, as that may invalidate
 	     the cc0.  */
-	  if (reg_mentioned_p (cc0_rtx, jump))
+	  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, jump))
 	    break;
-#endif
 
 	  for (ix = 0; ix < nedges; ix++)
 	    currptr[ix] = headptr[ix] = nextptr[ix];
diff --git a/gcc/combine.c b/gcc/combine.c
index d71f863..6f0007a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2066,7 +2066,6 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
       return 0;
 #endif
 
-#if HAVE_cc0
   /* Don't combine an insn that follows a CC0-setting insn.
      An insn that uses CC0 must not be separated from the one that sets it.
      We do, however, allow I2 to follow a CC0-setting insn if that insn
@@ -2076,11 +2075,13 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
      It would be more logical to test whether CC0 occurs inside I1 or I2,
      but that would be much slower, and this ought to be equivalent.  */
 
-  p = prev_nonnote_insn (insn);
-  if (p && p != pred && NONJUMP_INSN_P (p) && sets_cc0_p (PATTERN (p))
-      && ! all_adjacent)
-    return 0;
-#endif
+  if (HAVE_cc0)
+    {
+      p = prev_nonnote_insn (insn);
+      if (p && p != pred && NONJUMP_INSN_P (p) && sets_cc0_p (PATTERN (p))
+	  && ! all_adjacent)
+	return 0;
+    }
 
   /* If we get here, we have passed all the tests and the combination is
      to be allowed.  */
@@ -3114,7 +3115,6 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 
   subst_insn = i3;
 
-#if !HAVE_cc0
   /* Many machines that don't use CC0 have insns that can both perform an
      arithmetic operation and set the condition code.  These operations will
      be represented as a PARALLEL with the first element of the vector
@@ -3126,7 +3126,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
      needed, and make the PARALLEL by just replacing I2DEST in I3SRC with
      I2SRC.  Later we will make the PARALLEL that contains I2.  */
 
-  if (i1 == 0 && added_sets_2 && GET_CODE (PATTERN (i3)) == SET
+  if (!HAVE_cc0 && i1 == 0 && added_sets_2 && GET_CODE (PATTERN (i3)) == SET
       && GET_CODE (SET_SRC (PATTERN (i3))) == COMPARE
       && CONST_INT_P (XEXP (SET_SRC (PATTERN (i3)), 1))
       && rtx_equal_p (XEXP (SET_SRC (PATTERN (i3)), 0), i2dest))
@@ -3216,7 +3216,6 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	  i2_is_used = 1;
 	}
     }
-#endif
 
   if (i2_is_used == 0)
     {
@@ -3644,9 +3643,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	 are set between I2 and I3.  */
       if (insn_code_number < 0
           && (split = find_split_point (&newpat, i3, false)) != 0
-#if HAVE_cc0
-	  && REG_P (i2dest)
-#endif
+	  && (!HAVE_cc0 || REG_P (i2dest))
 	  /* We need I2DEST in the proper mode.  If it is a hard register
 	     or the only use of a pseudo, we can change its mode.
 	     Make sure we don't change a hard register to have a mode that
@@ -3916,9 +3913,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	  && !(GET_CODE (SET_DEST (set1)) == SUBREG
 	       && find_reg_note (i2, REG_DEAD,
 				 SUBREG_REG (SET_DEST (set1))))
-#if HAVE_cc0
-	  && !reg_referenced_p (cc0_rtx, set0)
-#endif
+	  && (!HAVE_cc0 || !reg_referenced_p (cc0_rtx, set0))
 	  /* If I3 is a jump, ensure that set0 is a jump so that
 	     we do not create invalid RTL.  */
 	  && (!JUMP_P (i3) || SET_DEST (set0) == pc_rtx)
@@ -3933,9 +3928,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	       && !(GET_CODE (SET_DEST (set0)) == SUBREG
 		    && find_reg_note (i2, REG_DEAD,
 				      SUBREG_REG (SET_DEST (set0))))
-#if HAVE_cc0
-	       && !reg_referenced_p (cc0_rtx, set1)
-#endif
+	       && (!HAVE_cc0 || !reg_referenced_p (cc0_rtx, set1))
 	       /* If I3 is a jump, ensure that set1 is a jump so that
 		  we do not create invalid RTL.  */
 	       && (!JUMP_P (i3) || SET_DEST (set1) == pc_rtx)
@@ -4000,19 +3993,18 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	}
     }
 
-#if HAVE_cc0
   /* If I2 is the CC0 setter and I3 is the CC0 user then check whether
      they are adjacent to each other or not.  */
-  {
-    rtx_insn *p = prev_nonnote_insn (i3);
-    if (p && p != i2 && NONJUMP_INSN_P (p) && newi2pat
-	&& sets_cc0_p (newi2pat))
-      {
-	undo_all ();
-	return 0;
-      }
-  }
-#endif
+  if (HAVE_cc0)
+    {
+      rtx_insn *p = prev_nonnote_insn (i3);
+      if (p && p != i2 && NONJUMP_INSN_P (p) && newi2pat
+	  && sets_cc0_p (newi2pat))
+	{
+	  undo_all ();
+	  return 0;
+	}
+    }
 
   /* Only allow this combination if insn_rtx_costs reports that the
      replacement instructions are cheaper than the originals.  */
@@ -13796,9 +13788,7 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 		    {
 		      rtx set = single_set (tem_insn);
 		      rtx inner_dest = 0;
-#if HAVE_cc0
 		      rtx_insn *cc0_setter = NULL;
-#endif
 
 		      if (set != 0)
 			for (inner_dest = SET_DEST (set);
@@ -13842,7 +13832,6 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 			  if (tem_insn == i2)
 			    i2 = NULL;
 
-#if HAVE_cc0
 			  /* Delete the setter too.  */
 			  if (cc0_setter)
 			    {
@@ -13859,7 +13848,6 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 			      if (cc0_setter == i2)
 				i2 = NULL;
 			    }
-#endif
 			}
 		      else
 			{
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 22fcfa6..d3d06ee 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3859,10 +3859,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
       if (NONDEBUG_INSN_P (insn))
 	{
 	  if (!bitmap_intersect_p (test_set, local_merge_live)
-#if HAVE_cc0
-	      && !sets_cc0_p (insn)
-#endif
-	      )
+	      && (!HAVE_cc0 || !sets_cc0_p (insn)))
 	    {
 	      max_to = insn;
 	      break;
diff --git a/gcc/final.c b/gcc/final.c
index dc7126e..231cfe5 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2029,21 +2029,20 @@ final (rtx_insn *first, FILE *file, int optimize_p)
 
   last_ignored_compare = 0;
 
-#if HAVE_cc0
-  for (insn = first; insn; insn = NEXT_INSN (insn))
-    {
-      /* If CC tracking across branches is enabled, record the insn which
-	 jumps to each branch only reached from one place.  */
-      if (optimize_p && JUMP_P (insn))
-	{
-	  rtx lab = JUMP_LABEL (insn);
-	  if (lab && LABEL_P (lab) && LABEL_NUSES (lab) == 1)
-	    {
-	      LABEL_REFS (lab) = insn;
-	    }
-	}
-    }
-#endif
+  if (HAVE_cc0)
+    for (insn = first; insn; insn = NEXT_INSN (insn))
+      {
+	/* If CC tracking across branches is enabled, record the insn which
+	   jumps to each branch only reached from one place.  */
+	if (optimize_p && JUMP_P (insn))
+	  {
+	    rtx lab = JUMP_LABEL (insn);
+	    if (lab && LABEL_P (lab) && LABEL_NUSES (lab) == 1)
+	      {
+		LABEL_REFS (lab) = insn;
+	      }
+	  }
+      }
 
   init_recog ();
 
diff --git a/gcc/gcse.c b/gcc/gcse.c
index b3015b1..0670f19 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2048,21 +2048,23 @@ insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb)
 	  && (!single_succ_p (bb)
 	      || single_succ_edge (bb)->flags & EDGE_ABNORMAL)))
     {
-#if HAVE_cc0
       /* FIXME: 'twould be nice to call prev_cc0_setter here but it aborts
 	 if cc0 isn't set.  */
-      rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
-      if (note)
-	insn = safe_as_a <rtx_insn *> (XEXP (note, 0));
-      else
+      if (HAVE_cc0)
 	{
-	  rtx_insn *maybe_cc0_setter = prev_nonnote_insn (insn);
-	  if (maybe_cc0_setter
-	      && INSN_P (maybe_cc0_setter)
-	      && sets_cc0_p (PATTERN (maybe_cc0_setter)))
-	    insn = maybe_cc0_setter;
+	  rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
+	  if (note)
+	    insn = safe_as_a <rtx_insn *> (XEXP (note, 0));
+	  else
+	    {
+	      rtx_insn *maybe_cc0_setter = prev_nonnote_insn (insn);
+	      if (maybe_cc0_setter
+		  && INSN_P (maybe_cc0_setter)
+		  && sets_cc0_p (PATTERN (maybe_cc0_setter)))
+		insn = maybe_cc0_setter;
+	    }
 	}
-#endif
+
       /* FIXME: What if something in cc0/jump uses value set in new insn?  */
       new_insn = emit_insn_before_noloc (pat, insn, bb);
     }
diff --git a/gcc/ira.c b/gcc/ira.c
index 9dcbc62..25baa90 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4724,10 +4724,7 @@ find_moveable_pseudos (void)
 	    {
 	      if (bitmap_bit_p (def_bb_moveable, regno)
 		  && !control_flow_insn_p (use_insn)
-#if HAVE_cc0
-		  && !sets_cc0_p (use_insn)
-#endif
-		  )
+		  && (!HAVE_cc0 || !sets_cc0_p (use_insn)))
 		{
 		  if (modified_between_p (DF_REF_REG (use), def_insn, use_insn))
 		    {
diff --git a/gcc/reorg.c b/gcc/reorg.c
index fedefcc..b7228f2 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1364,10 +1364,8 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 	continue;
 
       if (GET_CODE (next_to_match) == GET_CODE (trial)
-#if HAVE_cc0
 	  /* We can't share an insn that sets cc0.  */
-	  && ! sets_cc0_p (pat)
-#endif
+	  && (!HAVE_cc0 || ! sets_cc0_p (pat))
 	  && ! insn_references_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &needed, true)
@@ -1426,9 +1424,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 	  if (! insn_references_resource_p (dtrial, &set, true)
 	      && ! insn_sets_resource_p (dtrial, &set, true)
 	      && ! insn_sets_resource_p (dtrial, &needed, true)
-#if HAVE_cc0
-	      && ! sets_cc0_p (PATTERN (dtrial))
-#endif
+	      && (!HAVE_cc0 || ! sets_cc0_p (PATTERN (dtrial)))
 	      && rtx_equal_p (PATTERN (next_to_match), PATTERN (dtrial))
 	      && eligible_for_delay (delay_insn, slot_number - 1, dtrial, flags))
 	    {
@@ -2098,10 +2094,8 @@ fill_simple_delay_slots (int non_jumps_p)
 					     filter_flags ? &fset : &set,
 					     true)
 		  && ! insn_sets_resource_p (trial, &needed, true)
-#if HAVE_cc0
 		  /* Can't separate set of cc0 from its use.  */
-		  && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
-#endif
+		  && (!HAVE_cc0 || ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat)))
 		  && ! can_throw_internal (trial))
 		{
 		  trial = try_split (pat, trial, 1);
@@ -2233,9 +2227,7 @@ fill_simple_delay_slots (int non_jumps_p)
 		  && ! insn_references_resource_p (trial, &set, true)
 		  && ! insn_sets_resource_p (trial, &set, true)
 		  && ! insn_sets_resource_p (trial, &needed, true)
-#if HAVE_cc0
-		  && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
-#endif
+		  && (!HAVE_cc0 && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat)))
 		  && ! (maybe_never && may_trap_or_fault_p (pat))
 		  && (trial = try_split (pat, trial, 0))
 		  && eligible_for_delay (insn, slots_filled, trial, flags)
@@ -2281,9 +2273,7 @@ fill_simple_delay_slots (int non_jumps_p)
 	      && ! insn_references_resource_p (next_trial, &set, true)
 	      && ! insn_sets_resource_p (next_trial, &set, true)
 	      && ! insn_sets_resource_p (next_trial, &needed, true)
-#if HAVE_cc0
-	      && ! reg_mentioned_p (cc0_rtx, PATTERN (next_trial))
-#endif
+	      && (!HAVE_cc0 || ! reg_mentioned_p (cc0_rtx, PATTERN (next_trial)))
 	      && ! (maybe_never && may_trap_or_fault_p (PATTERN (next_trial)))
 	      && (next_trial = try_split (PATTERN (next_trial), next_trial, 0))
 	      && eligible_for_delay (insn, slots_filled, next_trial, flags)
@@ -2494,10 +2484,8 @@ fill_slots_from_thread (rtx_insn *insn, rtx condition, rtx thread_or_return,
       if (! insn_references_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &needed, true)
-#if HAVE_cc0
-	  && ! (reg_mentioned_p (cc0_rtx, pat)
-		&& (! own_thread || ! sets_cc0_p (pat)))
-#endif
+	  && (!HAVE_cc0 || (! (reg_mentioned_p (cc0_rtx, pat)
+			      && (! own_thread || ! sets_cc0_p (pat)))))
 	  && ! can_throw_internal (trial))
 	{
 	  rtx prior_insn;
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 9efa64c..e624563 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2609,9 +2609,9 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
       return;
 
     case CC0:
-#if HAVE_cc0
-      gcc_unreachable ();
-#endif
+      if (!HAVE_cc0)
+	gcc_unreachable ();
+
       /* User of CC0 depends on immediately preceding insn.  */
       SCHED_GROUP_P (insn) = 1;
        /* Don't move CC0 setter to another block (it can set up the
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (8 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 10/12] remove more ifdefs for HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:37   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM tbsaunde+gcc
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* alias.c (init_alias_target): Remove ifdef
	* HARD_FRAME_POINTER_IS_FRAME_POINTER.
	* df-scan.c (df_insn_refs_collect): Likewise.
	(df_get_regular_block_artificial_uses): Likewise.
	(df_get_eh_block_artificial_uses): Likewise.
	(df_get_entry_block_def_set): Likewise.
	(df_get_exit_block_use_set): Likewise.
	* emit-rtl.c (gen_rtx_REG): Likewise.
	* ira.c (ira_setup_eliminable_regset): Likewise.
	* reginfo.c (init_reg_sets_1): Likewise.
	* regrename.c (rename_chains): Likewise.
	* reload1.c (reload): Likewise.
	(eliminate_regs_in_insn): Likewise.
	* resource.c (mark_referenced_resources): Likewise.
	(init_resource_info): Likewise.
---
 gcc/alias.c     |  7 +++----
 gcc/df-scan.c   | 35 +++++++++++++++++------------------
 gcc/emit-rtl.c  |  6 +++---
 gcc/ira.c       | 23 ++++++++++++-----------
 gcc/reginfo.c   |  5 ++---
 gcc/regrename.c |  5 ++---
 gcc/reload1.c   | 10 ++++------
 gcc/resource.c  | 11 +++++------
 8 files changed, 48 insertions(+), 54 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index a7160f3..8f48660 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2765,10 +2765,9 @@ init_alias_target (void)
     = unique_base_value (UNIQUE_BASE_VALUE_ARGP);
   static_reg_base_value[FRAME_POINTER_REGNUM]
     = unique_base_value (UNIQUE_BASE_VALUE_FP);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  static_reg_base_value[HARD_FRAME_POINTER_REGNUM]
-    = unique_base_value (UNIQUE_BASE_VALUE_HFP);
-#endif
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+    static_reg_base_value[HARD_FRAME_POINTER_REGNUM]
+      = unique_base_value (UNIQUE_BASE_VALUE_HFP);
 }
 
 /* Set MEMORY_MODIFIED when X modifies DATA (that is assumed
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index b2e2e5d..69332a8 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3247,12 +3247,11 @@ df_insn_refs_collect (struct df_collection_rec *collection_rec,
                          regno_reg_rtx[FRAME_POINTER_REGNUM],
                          NULL, bb, insn_info,
                          DF_REF_REG_USE, 0);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-          df_ref_record (DF_REF_BASE, collection_rec,
-                         regno_reg_rtx[HARD_FRAME_POINTER_REGNUM],
-                         NULL, bb, insn_info,
-                         DF_REF_REG_USE, 0);
-#endif
+	  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+	    df_ref_record (DF_REF_BASE, collection_rec,
+			   regno_reg_rtx[HARD_FRAME_POINTER_REGNUM],
+			   NULL, bb, insn_info,
+			   DF_REF_REG_USE, 0);
           break;
         default:
           break;
@@ -3442,9 +3441,9 @@ df_get_regular_block_artificial_uses (bitmap regular_block_artificial_uses)
 	 reference of the frame pointer.  */
       bitmap_set_bit (regular_block_artificial_uses, FRAME_POINTER_REGNUM);
 
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      bitmap_set_bit (regular_block_artificial_uses, HARD_FRAME_POINTER_REGNUM);
-#endif
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+	bitmap_set_bit (regular_block_artificial_uses,
+			HARD_FRAME_POINTER_REGNUM);
 
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
       /* Pseudos with argument area equivalences may require
@@ -3494,9 +3493,9 @@ df_get_eh_block_artificial_uses (bitmap eh_block_artificial_uses)
       if (frame_pointer_needed)
 	{
 	  bitmap_set_bit (eh_block_artificial_uses, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-	  bitmap_set_bit (eh_block_artificial_uses, HARD_FRAME_POINTER_REGNUM);
-#endif
+	  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+	    bitmap_set_bit (eh_block_artificial_uses,
+			    HARD_FRAME_POINTER_REGNUM);
 	}
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
       if (fixed_regs[ARG_POINTER_REGNUM])
@@ -3580,11 +3579,11 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
       /* Any reference to any pseudo before reload is a potential
 	 reference of the frame pointer.  */
       bitmap_set_bit (entry_block_defs, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
+
       /* If they are different, also mark the hard frame pointer as live.  */
-      if (!LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+	  && !LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
 	bitmap_set_bit (entry_block_defs, HARD_FRAME_POINTER_REGNUM);
-#endif
     }
 
   /* These registers are live everywhere.  */
@@ -3718,11 +3717,11 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
   if ((!reload_completed) || frame_pointer_needed)
     {
       bitmap_set_bit (exit_block_uses, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
+
       /* If they are different, also mark the hard frame pointer as live.  */
-      if (!LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+	  && !LOCAL_REGNO (HARD_FRAME_POINTER_REGNUM))
 	bitmap_set_bit (exit_block_uses, HARD_FRAME_POINTER_REGNUM);
-#endif
     }
 
   /* Many architectures have a GP register even without flag_pic.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index c1974bb..9b2c4ec 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -715,11 +715,11 @@ gen_rtx_REG (machine_mode mode, unsigned int regno)
       if (regno == FRAME_POINTER_REGNUM
 	  && (!reload_completed || frame_pointer_needed))
 	return frame_pointer_rtx;
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      if (regno == HARD_FRAME_POINTER_REGNUM
+
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+	  && regno == HARD_FRAME_POINTER_REGNUM
 	  && (!reload_completed || frame_pointer_needed))
 	return hard_frame_pointer_rtx;
-#endif
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM && !HARD_FRAME_POINTER_IS_ARG_POINTER
       if (regno == ARG_POINTER_REGNUM)
 	return arg_pointer_rtx;
diff --git a/gcc/ira.c b/gcc/ira.c
index 0750d11..9dcbc62 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2341,19 +2341,20 @@ ira_setup_eliminable_regset (void)
       else
 	df_set_regs_ever_live (eliminables[i].from, true);
     }
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
     {
-      SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
-      if (frame_pointer_needed)
-	SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM);
+      if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
+	{
+	  SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM);
+	  if (frame_pointer_needed)
+	    SET_HARD_REG_BIT (ira_no_alloc_regs, HARD_FRAME_POINTER_REGNUM);
+	}
+      else if (frame_pointer_needed)
+	error ("%s cannot be used in asm here",
+	       reg_names[HARD_FRAME_POINTER_REGNUM]);
+      else
+	df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true);
     }
-  else if (frame_pointer_needed)
-    error ("%s cannot be used in asm here",
-	   reg_names[HARD_FRAME_POINTER_REGNUM]);
-  else
-    df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM, true);
-#endif
 
 #else
   if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM))
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 9015eeb..bc528e9 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -470,10 +470,9 @@ init_reg_sets_1 (void)
 	}
       else if (i == FRAME_POINTER_REGNUM)
 	;
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      else if (i == HARD_FRAME_POINTER_REGNUM)
+      else if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+	       && i == HARD_FRAME_POINTER_REGNUM)
 	;
-#endif
 #if ARG_POINTER_REGNUM != FRAME_POINTER_REGNUM
       else if (i == ARG_POINTER_REGNUM && fixed_regs[i])
 	;
diff --git a/gcc/regrename.c b/gcc/regrename.c
index f995ffa..147aaa8 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -438,9 +438,8 @@ rename_chains (void)
   if (frame_pointer_needed)
     {
       add_to_hard_reg_set (&unavailable, Pmode, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM);
-#endif
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+	add_to_hard_reg_set (&unavailable, Pmode, HARD_FRAME_POINTER_REGNUM);
     }
 
   FOR_EACH_VEC_ELT (id_to_chain, i, this_head)
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 5a01045..82b106e 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -914,10 +914,9 @@ reload (rtx_insn *first, int global)
 	spill_hard_reg (from, 1);
     }
 
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-  if (frame_pointer_needed)
+  if (!HARD_FRAME_POINTER_IS_FRAME_POINTER && frame_pointer_needed)
     spill_hard_reg (HARD_FRAME_POINTER_REGNUM, 1);
-#endif
+
   finish_spills (global);
 
   /* From now on, we may need to generate moves differently.  We may also
@@ -3281,13 +3280,13 @@ eliminate_regs_in_insn (rtx_insn *insn, int replace)
       for (ep = reg_eliminate; ep < &reg_eliminate[NUM_ELIMINABLE_REGS]; ep++)
 	if (ep->from_rtx == SET_DEST (old_set) && ep->can_eliminate)
 	  {
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
 	    /* If this is setting the frame pointer register to the
 	       hardware frame pointer register and this is an elimination
 	       that will be done (tested above), this insn is really
 	       adjusting the frame pointer downward to compensate for
 	       the adjustment done before a nonlocal goto.  */
-	    if (ep->from == FRAME_POINTER_REGNUM
+	    if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
+		&& ep->from == FRAME_POINTER_REGNUM
 		&& ep->to == HARD_FRAME_POINTER_REGNUM)
 	      {
 		rtx base = SET_SRC (old_set);
@@ -3347,7 +3346,6 @@ eliminate_regs_in_insn (rtx_insn *insn, int replace)
 		    goto done;
 		  }
 	      }
-#endif
 
 	    /* In this case this insn isn't serving a useful purpose.  We
 	       will delete it in reload_as_needed once we know that this
diff --git a/gcc/resource.c b/gcc/resource.c
index 4f71aac..9a013b3 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -335,9 +335,8 @@ mark_referenced_resources (rtx x, struct resources *res,
 	  if (frame_pointer_needed)
 	    {
 	      SET_HARD_REG_BIT (res->regs, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-	      SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM);
-#endif
+	      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+		SET_HARD_REG_BIT (res->regs, HARD_FRAME_POINTER_REGNUM);
 	    }
 
 	  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
@@ -1190,9 +1189,9 @@ init_resource_info (rtx_insn *epilogue_insn)
   if (frame_pointer_needed)
     {
       SET_HARD_REG_BIT (end_of_function_needs.regs, FRAME_POINTER_REGNUM);
-#if !HARD_FRAME_POINTER_IS_FRAME_POINTER
-      SET_HARD_REG_BIT (end_of_function_needs.regs, HARD_FRAME_POINTER_REGNUM);
-#endif
+      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
+	SET_HARD_REG_BIT (end_of_function_needs.regs,
+			  HARD_FRAME_POINTER_REGNUM);
     }
   if (!(frame_pointer_needed
 	&& EXIT_IGNORE_STACK
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (10 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:48   ` Jeff Law
  2015-04-21 14:14   ` Richard Biener
  2015-04-21 13:43 ` [PATCH 00/12] Reduce conditional compilation Jeff Law
  2015-04-21 13:57 ` Jeff Law
  13 siblings, 2 replies; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* conditions.h: Define macros even if HAVE_cc0 is undefined.
	* emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
	* final.c: Likewise.
	* jump.c: Likewise.
	* recog.c: Likewise.
	* recog.h: Declare functions even when HAVE_cc0 is undefined.
	* sched-deps.c (sched_analyze_2): Always compile case for cc0.
---
 gcc/conditions.h | 6 ------
 gcc/emit-rtl.c   | 2 --
 gcc/final.c      | 2 --
 gcc/jump.c       | 3 ---
 gcc/recog.c      | 2 --
 gcc/recog.h      | 2 --
 gcc/sched-deps.c | 5 +++--
 7 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/gcc/conditions.h b/gcc/conditions.h
index 2308bfc..7cd1e1c 100644
--- a/gcc/conditions.h
+++ b/gcc/conditions.h
@@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
 #ifndef GCC_CONDITIONS_H
 #define GCC_CONDITIONS_H
 
-/* None of the things in the files exist if we don't use CC0.  */
-
-#ifdef HAVE_cc0
-
 /* The variable cc_status says how to interpret the condition code.
    It is set by output routines for an instruction that sets the cc's
    and examined by output routines for jump instructions.
@@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
  (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
   CC_STATUS_MDEP_INIT)
 
-#endif
-
 #endif /* GCC_CONDITIONS_H */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 483eacb..c1974bb 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
   return insn;
 }
 \f
-#ifdef HAVE_cc0
 /* Return the next insn that uses CC0 after INSN, which is assumed to
    set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
    applied to the result of this function should yield INSN).
@@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
 
   return insn;
 }
-#endif
 
 #ifdef AUTO_INC_DEC
 /* Find a RTX_AUTOINC class rtx which matches DATA.  */
diff --git a/gcc/final.c b/gcc/final.c
index 1fa93d9..41f6bd9 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
 
 static int insn_counter = 0;
 
-#ifdef HAVE_cc0
 /* This variable contains machine-dependent flags (defined in tm.h)
    set and examined by output routines
    that describe how to interpret the condition codes properly.  */
@@ -202,7 +201,6 @@ CC_STATUS cc_status;
    from before the insn.  */
 
 CC_STATUS cc_prev_status;
-#endif
 
 /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
 
diff --git a/gcc/jump.c b/gcc/jump.c
index 34b3b7b..bc91550 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
 	  && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
 }
 
-#ifdef HAVE_cc0
-
 /* Return nonzero if X is an RTX that only sets the condition codes
    and has no side effects.  */
 
@@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
     }
   return 0;
 }
-#endif
 \f
 /* Find all CODE_LABELs referred to in X, and increment their use
    counts.  If INSN is a JUMP_INSN and there is at least one
diff --git a/gcc/recog.c b/gcc/recog.c
index a9d3b1f..c3ad86f 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
   return ((num_changes_pending () > 0) && (apply_change_group () > 0));
 }
 \f
-#ifdef HAVE_cc0
 /* Return 1 if the insn using CC0 set by INSN does not contain
    any ordered tests applied to the condition codes.
    EQ and NE tests do not count.  */
@@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
   return (INSN_P (next)
 	  && ! inequality_comparisons_p (PATTERN (next)));
 }
-#endif
 \f
 /* Return 1 if OP is a valid general operand for machine mode MODE.
    This is either a register reference, a memory reference,
diff --git a/gcc/recog.h b/gcc/recog.h
index 45ea671..8a38b26 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
 extern void validate_replace_src_group (rtx, rtx, rtx);
 extern bool validate_simplify_insn (rtx insn);
 extern int num_changes_pending (void);
-#ifdef HAVE_cc0
 extern int next_insn_tests_no_inequality (rtx);
-#endif
 extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
 
 extern int offsettable_memref_p (rtx);
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 5434831..31de6be 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
 
       return;
 
-#ifdef HAVE_cc0
     case CC0:
+#ifdef HAVE_cc0
+      gcc_unreachable ();
+#endif
       /* User of CC0 depends on immediately preceding insn.  */
       SCHED_GROUP_P (insn) = 1;
        /* Don't move CC0 setter to another block (it can set up the
@@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
 	sched_deps_info->finish_rhs ();
 
       return;
-#endif
 
     case REG:
       {
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 04/12] always define HAVE_cc0
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (4 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 03/12] more removal of ifdef HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:53   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED tbsaunde+gcc
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* genconfig.c (main): Always define HAVE_cc0.
	* caller-save.c (insert_one_insn): Change ifdef HAVE_cc0 to #if
	HAVE_cc0.
	* cfgcleanup.c (flow_find_cross_jump): Likewise.
	(flow_find_head_matching_sequence): Likewise.
	(try_head_merge_bb): Likewise.
	* cfgrtl.c (rtl_merge_blocks): Likewise.
	(try_redirect_by_replacing_jump): Likewise.
	(rtl_tidy_fallthru_edge): Likewise.
	* combine.c (do_SUBST_MODE): Likewise.
	(insn_a_feeds_b): Likewise.
	(combine_instructions): Likewise.
	(can_combine_p): Likewise.
	(try_combine): Likewise.
	(find_split_point): Likewise.
	(subst): Likewise.
	(simplify_set): Likewise.
	(distribute_notes): Likewise.
	* cprop.c (cprop_jump): Likewise.
	* cse.c (cse_extended_basic_block): Likewise.
	* df-problems.c (can_move_insns_across): Likewise.
	* final.c (final): Likewise.
	(final_scan_insn): Likewise.
	* function.c (emit_use_return_register_into_block): Likewise.
	* gcse.c (insert_insn_end_basic_block): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ira.c (find_moveable_pseudos): Likewise.
	* loop-invariant.c (find_invariant_insn): Likewise.
	* lra-constraints.c (curr_insn_transform): Likewise.
	* optabs.c (prepare_cmp_insn): Likewise.
	* postreload.c (reload_combine_recognize_const_pattern):
	* Likewise.
	* reload.c (find_reloads): Likewise.
	(find_reloads_address_1): Likewise.
	* reorg.c (delete_scheduled_jump): Likewise.
	(steal_delay_list_from_target): Likewise.
	(steal_delay_list_from_fallthrough): Likewise.
	(try_merge_delay_insns): Likewise.
	(redundant_insn): Likewise.
	(fill_simple_delay_slots): Likewise.
	(fill_slots_from_thread): Likewise.
	(delete_computation): Likewise.
	(relax_delay_slots): Likewise.
	* sched-deps.c (sched_analyze_2): Likewise.
	* sched-rgn.c (add_branch_dependences): Likewise.
---
 gcc/caller-save.c     |  2 +-
 gcc/cfgcleanup.c      | 12 ++++++------
 gcc/cfgrtl.c          |  6 +++---
 gcc/combine.c         | 36 ++++++++++++++++++------------------
 gcc/cprop.c           |  2 +-
 gcc/cse.c             |  2 +-
 gcc/df-problems.c     |  4 ++--
 gcc/final.c           | 14 +++++++-------
 gcc/function.c        |  2 +-
 gcc/gcse.c            |  2 +-
 gcc/genconfig.c       |  1 +
 gcc/haifa-sched.c     |  2 +-
 gcc/ira.c             |  4 ++--
 gcc/loop-invariant.c  |  2 +-
 gcc/lra-constraints.c |  2 +-
 gcc/optabs.c          |  2 +-
 gcc/postreload.c      |  2 +-
 gcc/reload.c          |  6 +++---
 gcc/reorg.c           | 30 +++++++++++++++---------------
 gcc/sched-deps.c      |  2 +-
 gcc/sched-rgn.c       |  2 +-
 21 files changed, 69 insertions(+), 68 deletions(-)

diff --git a/gcc/caller-save.c b/gcc/caller-save.c
index 3b01941..fc575eb 100644
--- a/gcc/caller-save.c
+++ b/gcc/caller-save.c
@@ -1400,7 +1400,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
   rtx_insn *insn = chain->insn;
   struct insn_chain *new_chain;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* If INSN references CC0, put our insns in front of the insn that sets
      CC0.  This is always safe, since the only way we could be passed an
      insn that references CC0 is for a restore, and doing a restore earlier
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index cee152e..58d235e 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1416,7 +1416,7 @@ flow_find_cross_jump (basic_block bb1, basic_block bb2, rtx_insn **f1,
       i2 = PREV_INSN (i2);
     }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Don't allow the insn after a compare to be shared by
      cross-jumping unless the compare is also shared.  */
   if (ninsns && reg_mentioned_p (cc0_rtx, last1) && ! sets_cc0_p (last1))
@@ -1539,7 +1539,7 @@ flow_find_head_matching_sequence (basic_block bb1, basic_block bb2, rtx_insn **f
       i2 = NEXT_INSN (i2);
     }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Don't allow a compare to be shared by cross-jumping unless the insn
      after the compare is also shared.  */
   if (ninsns && reg_mentioned_p (cc0_rtx, last1) && sets_cc0_p (last1))
@@ -2330,7 +2330,7 @@ try_head_merge_bb (basic_block bb)
   cond = get_condition (jump, &move_before, true, false);
   if (cond == NULL_RTX)
     {
-#ifdef HAVE_cc0
+#if HAVE_cc0
       if (reg_mentioned_p (cc0_rtx, jump))
 	move_before = prev_nonnote_nondebug_insn (jump);
       else
@@ -2499,7 +2499,7 @@ try_head_merge_bb (basic_block bb)
       cond = get_condition (jump, &move_before, true, false);
       if (cond == NULL_RTX)
 	{
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  if (reg_mentioned_p (cc0_rtx, jump))
 	    move_before = prev_nonnote_nondebug_insn (jump);
 	  else
@@ -2522,7 +2522,7 @@ try_head_merge_bb (basic_block bb)
 	  /* Try again, using a different insertion point.  */
 	  move_before = jump;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* Don't try moving before a cc0 user, as that may invalidate
 	     the cc0.  */
 	  if (reg_mentioned_p (cc0_rtx, jump))
@@ -2582,7 +2582,7 @@ try_head_merge_bb (basic_block bb)
 	  /* For the unmerged insns, try a different insertion point.  */
 	  move_before = jump;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* Don't try moving before a cc0 user, as that may invalidate
 	     the cc0.  */
 	  if (reg_mentioned_p (cc0_rtx, jump))
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 0e27edd..4c1708f 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -893,7 +893,7 @@ rtl_merge_blocks (basic_block a, basic_block b)
 
       del_first = a_end;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
       /* If this was a conditional jump, we need to also delete
 	 the insn that set cc0.  */
       if (only_sets_cc0_p (prev))
@@ -1064,7 +1064,7 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
   /* In case we zap a conditional jump, we'll need to kill
      the cc0 setter too.  */
   kill_from = insn;
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_mentioned_p (cc0_rtx, PATTERN (insn))
       && only_sets_cc0_p (PREV_INSN (insn)))
     kill_from = PREV_INSN (insn);
@@ -1825,7 +1825,7 @@ rtl_tidy_fallthru_edge (edge e)
 	  delete_insn (table);
 	}
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
       /* If this was a conditional jump, we need to also delete
 	 the insn that set cc0.  */
       if (any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
diff --git a/gcc/combine.c b/gcc/combine.c
index 0a35b8f..430084e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -836,7 +836,7 @@ do_SUBST_MODE (rtx *into, machine_mode newval)
 
 #define SUBST_MODE(INTO, NEWVAL)  do_SUBST_MODE (&(INTO), (NEWVAL))
 
-#ifndef HAVE_cc0
+#if !HAVE_cc0
 /* Similar to SUBST, but NEWVAL is a LOG_LINKS expression.  */
 
 static void
@@ -1141,7 +1141,7 @@ insn_a_feeds_b (rtx_insn *a, rtx_insn *b)
   FOR_EACH_LOG_LINK (links, b)
     if (links->insn == a)
       return true;
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (sets_cc0_p (a))
     return true;
 #endif
@@ -1157,7 +1157,7 @@ static int
 combine_instructions (rtx_insn *f, unsigned int nregs)
 {
   rtx_insn *insn, *next;
-#ifdef HAVE_cc0
+#if HAVE_cc0
   rtx_insn *prev;
 #endif
   struct insn_link *links, *nextlinks;
@@ -1334,7 +1334,7 @@ combine_instructions (rtx_insn *f, unsigned int nregs)
 		    }
 	      }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* Try to combine a jump insn that uses CC0
 	     with a preceding insn that sets CC0, and maybe with its
 	     logical predecessor as well.
@@ -2068,7 +2068,7 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
       return 0;
 #endif
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Don't combine an insn that follows a CC0-setting insn.
      An insn that uses CC0 must not be separated from the one that sets it.
      We do, however, allow I2 to follow a CC0-setting insn if that insn
@@ -2514,7 +2514,7 @@ is_parallel_of_n_reg_sets (rtx pat, int n)
   return true;
 }
 
-#ifndef HAVE_cc0
+#if !HAVE_cc0
 /* Return whether INSN, a PARALLEL of N register SETs (and maybe some
    CLOBBERs), can be split into individual SETs in that order, without
    changing semantics.  */
@@ -2888,7 +2888,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	}
     }
 
-#ifndef HAVE_cc0
+#if !HAVE_cc0
   /* If we have no I1 and I2 looks like:
 	(parallel [(set (reg:CC X) (compare:CC OP (const_int 0)))
 		   (set Y OP)])
@@ -3116,7 +3116,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 
   subst_insn = i3;
 
-#ifndef HAVE_cc0
+#if !HAVE_cc0
   /* Many machines that don't use CC0 have insns that can both perform an
      arithmetic operation and set the condition code.  These operations will
      be represented as a PARALLEL with the first element of the vector
@@ -3646,7 +3646,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	 are set between I2 and I3.  */
       if (insn_code_number < 0
           && (split = find_split_point (&newpat, i3, false)) != 0
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  && REG_P (i2dest)
 #endif
 	  /* We need I2DEST in the proper mode.  If it is a hard register
@@ -3918,7 +3918,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	  && !(GET_CODE (SET_DEST (set1)) == SUBREG
 	       && find_reg_note (i2, REG_DEAD,
 				 SUBREG_REG (SET_DEST (set1))))
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  && !reg_referenced_p (cc0_rtx, set0)
 #endif
 	  /* If I3 is a jump, ensure that set0 is a jump so that
@@ -3935,7 +3935,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	       && !(GET_CODE (SET_DEST (set0)) == SUBREG
 		    && find_reg_note (i2, REG_DEAD,
 				      SUBREG_REG (SET_DEST (set0))))
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	       && !reg_referenced_p (cc0_rtx, set1)
 #endif
 	       /* If I3 is a jump, ensure that set1 is a jump so that
@@ -4002,7 +4002,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	}
     }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* If I2 is the CC0 setter and I3 is the CC0 user then check whether
      they are adjacent to each other or not.  */
   {
@@ -4816,7 +4816,7 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
       break;
 
     case SET:
-#ifdef HAVE_cc0
+#if HAVE_cc0
       /* If SET_DEST is CC0 and SET_SRC is not an operand, a COMPARE, or a
 	 ZERO_EXTRACT, the most likely reason why this doesn't match is that
 	 we need to put the operand into a register.  So split at that
@@ -5331,7 +5331,7 @@ subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy)
 		      && ! (code == SUBREG
 			    && MODES_TIEABLE_P (GET_MODE (x),
 						GET_MODE (SUBREG_REG (to))))
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		      && ! (code == SET && i == 1 && XEXP (x, 0) == cc0_rtx)
 #endif
 		      )
@@ -6582,7 +6582,7 @@ simplify_set (rtx x)
       else
 	compare_mode = SELECT_CC_MODE (new_code, op0, op1);
 
-#ifndef HAVE_cc0
+#if !HAVE_cc0
       /* If the mode changed, we have to change SET_DEST, the mode in the
 	 compare, and the mode in the place SET_DEST is used.  If SET_DEST is
 	 a hard register, just build new versions with the proper mode.  If it
@@ -13802,7 +13802,7 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 		    {
 		      rtx set = single_set (tem_insn);
 		      rtx inner_dest = 0;
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		      rtx_insn *cc0_setter = NULL;
 #endif
 
@@ -13824,7 +13824,7 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 
 		      if (set != 0 && ! side_effects_p (SET_SRC (set))
 			  && rtx_equal_p (XEXP (note, 0), inner_dest)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 			  && (! reg_mentioned_p (cc0_rtx, SET_SRC (set))
 			      || ((cc0_setter = prev_cc0_setter (tem_insn)) != NULL
 				  && sets_cc0_p (PATTERN (cc0_setter)) > 0))
@@ -13848,7 +13848,7 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 			  if (tem_insn == i2)
 			    i2 = NULL;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 			  /* Delete the setter too.  */
 			  if (cc0_setter)
 			    {
diff --git a/gcc/cprop.c b/gcc/cprop.c
index c9fb2fc..b1caabb 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -965,7 +965,7 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Delete the cc0 setter.  */
   if (setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
     delete_insn (setcc);
diff --git a/gcc/cse.c b/gcc/cse.c
index d184d27..52f5a16 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6515,7 +6515,7 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 		  && check_for_label_ref (insn))
 		recorded_label_ref = true;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	      if (NONDEBUG_INSN_P (insn))
 		{
 		  /* If the previous insn sets CC0 and this insn no
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 3f4aacd..d213455 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3820,7 +3820,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
 	  if (bitmap_intersect_p (merge_set, test_use)
 	      || bitmap_intersect_p (merge_use, test_set))
 	    break;
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  if (!sets_cc0_p (insn))
 #endif
 	    max_to = insn;
@@ -3861,7 +3861,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
       if (NONDEBUG_INSN_P (insn))
 	{
 	  if (!bitmap_intersect_p (test_set, local_merge_live)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	      && !sets_cc0_p (insn)
 #endif
 	      )
diff --git a/gcc/final.c b/gcc/final.c
index 41f6bd9..dc7126e 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -242,7 +242,7 @@ static void output_asm_operand_names (rtx *, int *, int);
 #ifdef LEAF_REGISTERS
 static void leaf_renumber_regs (rtx_insn *);
 #endif
-#ifdef HAVE_cc0
+#if HAVE_cc0
 static int alter_cond (rtx);
 #endif
 #ifndef ADDR_VEC_ALIGN
@@ -2029,7 +2029,7 @@ final (rtx_insn *first, FILE *file, int optimize_p)
 
   last_ignored_compare = 0;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   for (insn = first; insn; insn = NEXT_INSN (insn))
     {
       /* If CC tracking across branches is enabled, record the insn which
@@ -2198,7 +2198,7 @@ rtx_insn *
 final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
 		 int nopeepholes ATTRIBUTE_UNUSED, int *seen)
 {
-#ifdef HAVE_cc0
+#if HAVE_cc0
   rtx set;
 #endif
   rtx_insn *next;
@@ -2505,7 +2505,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
 	    || GET_CODE (body) == CLOBBER)
 	  break;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	{
 	  /* If there is a REG_CC_SETTER note on this insn, it means that
 	     the setting of the condition code was done in the delay slot
@@ -2722,7 +2722,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
 
 	body = PATTERN (insn);
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	set = single_set (insn);
 
 	/* Check for redundant test and compare instructions
@@ -2967,7 +2967,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
 	    && GET_CODE (PATTERN (insn)) == COND_EXEC)
 	  current_insn_predicate = COND_EXEC_TEST (PATTERN (insn));
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	cc_prev_status = cc_status;
 
 	/* Update `cc_status' for this instruction.
@@ -3256,7 +3256,7 @@ walk_alter_subreg (rtx *xp, bool *changed)
   return *xp;
 }
 \f
-#ifdef HAVE_cc0
+#if HAVE_cc0
 
 /* Given BODY, the body of a jump instruction, alter the jump condition
    as required by the bits that are set in cc_status.flags.
diff --git a/gcc/function.c b/gcc/function.c
index 2c3d142..70d20ef 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5634,7 +5634,7 @@ emit_use_return_register_into_block (basic_block bb)
   seq = get_insns ();
   end_sequence ();
   insn = BB_END (bb);
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_mentioned_p (cc0_rtx, PATTERN (insn)))
     insn = prev_cc0_setter (insn);
 #endif
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 37aac6a..b3015b1 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -2048,7 +2048,7 @@ insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb)
 	  && (!single_succ_p (bb)
 	      || single_succ_edge (bb)->flags & EDGE_ABNORMAL)))
     {
-#ifdef HAVE_cc0
+#if HAVE_cc0
       /* FIXME: 'twould be nice to call prev_cc0_setter here but it aborts
 	 if cc0 isn't set.  */
       rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index da3922d..2247eef 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -346,6 +346,7 @@ main (int argc, char **argv)
     {
       /* We output CC0_P this way to make sure that X is declared
 	 somewhere.  */
+      printf ("#define HAVE_cc0 0\n");
       printf ("#define CC0_P(X) ((X) ? 0 : 0)\n");
     }
 
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index d47cb8c..286bd1b 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -7184,7 +7184,7 @@ void
 sched_init (void)
 {
   /* Disable speculative loads in their presence if cc0 defined.  */
-#ifdef HAVE_cc0
+#if HAVE_cc0
   flag_schedule_speculative_load = 0;
 #endif
 
diff --git a/gcc/ira.c b/gcc/ira.c
index ea2b69f..819d702 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4641,7 +4641,7 @@ find_moveable_pseudos (void)
 			   ? " (no unique first use)" : "");
 		continue;
 	      }
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	    if (reg_referenced_p (cc0_rtx, PATTERN (closest_use)))
 	      {
 		if (dump_file)
@@ -4724,7 +4724,7 @@ find_moveable_pseudos (void)
 	    {
 	      if (bitmap_bit_p (def_bb_moveable, regno)
 		  && !control_flow_insn_p (use_insn)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  && !sets_cc0_p (use_insn)
 #endif
 		  )
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index f79b497..ef956a4 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -922,7 +922,7 @@ find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed)
   bool simple = true;
   struct invariant *inv;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* We can't move a CC0 setter without the user.  */
   if (sets_cc0_p (insn))
     return;
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 57d731a..39cb036 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3354,7 +3354,7 @@ curr_insn_transform (bool check_only_p)
   if (JUMP_P (curr_insn) || CALL_P (curr_insn))
     no_output_reloads_p = true;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_referenced_p (cc0_rtx, PATTERN (curr_insn)))
     no_input_reloads_p = true;
   if (reg_set_p (cc0_rtx, PATTERN (curr_insn)))
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e9dc798..983c8d9 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4088,7 +4088,7 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
           > COSTS_N_INSNS (1)))
     y = force_reg (mode, y);
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* Make sure if we have a canonical comparison.  The RTL
      documentation states that canonical comparisons are required only
      for targets which have cc0.  */
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 30fa449..68443ab 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1032,7 +1032,7 @@ reload_combine_recognize_const_pattern (rtx_insn *insn)
 	      && reg_state[clobbered_regno].real_store_ruid >= use_ruid)
 	    break;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* Do not separate cc0 setter and cc0 user on HAVE_cc0 targets.  */
 	  if (must_move_add && sets_cc0_p (PATTERN (use_insn)))
 	    break;
diff --git a/gcc/reload.c b/gcc/reload.c
index 70b86a9..8b253b8 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2706,7 +2706,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
   if (JUMP_P (insn) || CALL_P (insn))
     no_output_reloads = 1;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
     no_input_reloads = 1;
   if (reg_set_p (cc0_rtx, PATTERN (insn)))
@@ -4579,7 +4579,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
 	    rld[j].in = 0;
 	  }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   /* If we made any reloads for addresses, see if they violate a
      "no input reloads" requirement for this insn.  But loads that we
      do after the insn (such as for output addresses) are fine.  */
@@ -5873,7 +5873,7 @@ find_reloads_address_1 (machine_mode mode, addr_space_t as,
 	      enum insn_code icode = optab_handler (add_optab, GET_MODE (x));
 	      if (insn && NONJUMP_INSN_P (insn) && equiv
 		  && memory_operand (equiv, GET_MODE (equiv))
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  && ! sets_cc0_p (PATTERN (insn))
 #endif
 		  && ! (icode != CODE_FOR_nothing
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 2387910..f059504 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -182,7 +182,7 @@ skip_consecutive_labels (rtx label_or_return)
   return label;
 }
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 /* INSN uses CC0 and is being moved into a delay slot.  Set up REG_CC_SETTER
    and REG_CC_USER notes so we can find it.  */
 
@@ -699,7 +699,7 @@ delete_scheduled_jump (rtx_insn *insn)
      be other insns that became dead anyway, which we wouldn't know to
      delete.  */
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_mentioned_p (cc0_rtx, insn))
     {
       rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
@@ -1171,7 +1171,7 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
       if (insn_references_resource_p (trial, sets, false)
 	  || insn_sets_resource_p (trial, needed, false)
 	  || insn_sets_resource_p (trial, sets, false)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* If TRIAL sets CC0, we can't copy it, so we can't steal this
 	     delay list.  */
 	  || find_reg_note (trial, REG_CC_USER, NULL_RTX)
@@ -1279,7 +1279,7 @@ steal_delay_list_from_fallthrough (rtx_insn *insn, rtx condition,
       if (insn_references_resource_p (trial, sets, false)
 	  || insn_sets_resource_p (trial, needed, false)
 	  || insn_sets_resource_p (trial, sets, false)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  || sets_cc0_p (PATTERN (trial))
 #endif
 	  )
@@ -1373,7 +1373,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 	continue;
 
       if (GET_CODE (next_to_match) == GET_CODE (trial)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* We can't share an insn that sets cc0.  */
 	  && ! sets_cc0_p (pat)
 #endif
@@ -1435,7 +1435,7 @@ try_merge_delay_insns (rtx insn, rtx_insn *thread)
 	  if (! insn_references_resource_p (dtrial, &set, true)
 	      && ! insn_sets_resource_p (dtrial, &set, true)
 	      && ! insn_sets_resource_p (dtrial, &needed, true)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	      && ! sets_cc0_p (PATTERN (dtrial))
 #endif
 	      && rtx_equal_p (PATTERN (next_to_match), PATTERN (dtrial))
@@ -1613,7 +1613,7 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
     target_main = XVECEXP (PATTERN (target), 0, 0);
 
   if (resource_conflicts_p (&needed, &set)
-#ifdef HAVE_cc0
+#if HAVE_cc0
       || reg_mentioned_p (cc0_rtx, ipat)
 #endif
       /* The insn requiring the delay may not set anything needed or set by
@@ -2109,7 +2109,7 @@ fill_simple_delay_slots (int non_jumps_p)
 					     filter_flags ? &fset : &set,
 					     true)
 		  && ! insn_sets_resource_p (trial, &needed, true)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  /* Can't separate set of cc0 from its use.  */
 		  && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
 #endif
@@ -2244,7 +2244,7 @@ fill_simple_delay_slots (int non_jumps_p)
 		  && ! insn_references_resource_p (trial, &set, true)
 		  && ! insn_sets_resource_p (trial, &set, true)
 		  && ! insn_sets_resource_p (trial, &needed, true)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  && ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
 #endif
 		  && ! (maybe_never && may_trap_or_fault_p (pat))
@@ -2254,7 +2254,7 @@ fill_simple_delay_slots (int non_jumps_p)
 		{
 		  next_trial = next_nonnote_insn (trial);
 		  delay_list = add_to_delay_list (trial, delay_list);
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  if (reg_mentioned_p (cc0_rtx, pat))
 		    link_cc0_insns (trial);
 #endif
@@ -2293,7 +2293,7 @@ fill_simple_delay_slots (int non_jumps_p)
 	      && ! insn_references_resource_p (next_trial, &set, true)
 	      && ! insn_sets_resource_p (next_trial, &set, true)
 	      && ! insn_sets_resource_p (next_trial, &needed, true)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	      && ! reg_mentioned_p (cc0_rtx, PATTERN (next_trial))
 #endif
 	      && ! (maybe_never && may_trap_or_fault_p (PATTERN (next_trial)))
@@ -2506,7 +2506,7 @@ fill_slots_from_thread (rtx_insn *insn, rtx condition, rtx thread_or_return,
       if (! insn_references_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &set, true)
 	  && ! insn_sets_resource_p (trial, &needed, true)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  && ! (reg_mentioned_p (cc0_rtx, pat)
 		&& (! own_thread || ! sets_cc0_p (pat)))
 #endif
@@ -2589,7 +2589,7 @@ fill_slots_from_thread (rtx_insn *insn, rtx condition, rtx thread_or_return,
 		  must_annul = 1;
 		winner:
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		  if (reg_mentioned_p (cc0_rtx, pat))
 		    link_cc0_insns (trial);
 #endif
@@ -3145,7 +3145,7 @@ delete_computation (rtx insn)
 {
   rtx note, next;
 
-#ifdef HAVE_cc0
+#if HAVE_cc0
   if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
     {
       rtx prev = prev_nonnote_insn (insn);
@@ -3482,7 +3482,7 @@ relax_delay_slots (rtx_insn *first)
 	  && ! condjump_in_parallel_p (delay_insn)
 	  && prev_active_insn (target_label) == insn
 	  && ! BARRIER_P (prev_nonnote_insn (target_label))
-#ifdef HAVE_cc0
+#if HAVE_cc0
 	  /* If the last insn in the delay slot sets CC0 for some insn,
 	     various code assumes that it is in a delay slot.  We could
 	     put it back where it belonged and delete the register notes,
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index 31de6be..9efa64c 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -2609,7 +2609,7 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
       return;
 
     case CC0:
-#ifdef HAVE_cc0
+#if HAVE_cc0
       gcc_unreachable ();
 #endif
       /* User of CC0 depends on immediately preceding insn.  */
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 76f78df..33261fc 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -2487,7 +2487,7 @@ add_branch_dependences (rtx_insn *head, rtx_insn *tail)
 	     && (GET_CODE (PATTERN (insn)) == USE
 		 || GET_CODE (PATTERN (insn)) == CLOBBER
 		 || can_throw_internal (insn)
-#ifdef HAVE_cc0
+#if HAVE_cc0
 		 || sets_cc0_p (PATTERN (insn))
 #endif
 		 || (!reload_completed
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 05/12] make some HAVE_cc0 code always compiled
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (6 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:54   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 10/12] remove more ifdefs for HAVE_cc0 tbsaunde+gcc
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* cfgrtl.c (rtl_merge_blocks): Change #if HAVE_cc0 to if (HAVE_cc0)
	(try_redirect_by_replacing_jump): Likewise.
	(rtl_tidy_fallthru_edge): Likewise.
	* combine.c (insn_a_feeds_b): Likewise.
	(find_split_point): Likewise.
	(simplify_set): Likewise.
	* cprop.c (cprop_jump): Likewise.
	* cse.c (cse_extended_basic_block): Likewise.
	* df-problems.c (can_move_insns_across): Likewise.
	* function.c (emit_use_return_register_into_block): Likewise.
	* haifa-sched.c (sched_init): Likewise.
	* ira.c (find_moveable_pseudos): Likewise.
	* loop-invariant.c (find_invariant_insn): Likewise.
	* lra-constraints.c (curr_insn_transform): Likewise.
	* postreload.c (reload_combine_recognize_const_pattern):
	* Likewise.
	* reload.c (find_reloads): Likewise.
	* reorg.c (delete_scheduled_jump): Likewise.
	(steal_delay_list_from_target): Likewise.
	(steal_delay_list_from_fallthrough): Likewise.
	(redundant_insn): Likewise.
	(fill_simple_delay_slots): Likewise.
	(fill_slots_from_thread): Likewise.
	(delete_computation): Likewise.
	* sched-rgn.c (add_branch_dependences): Likewise.
---
 gcc/cfgrtl.c          | 12 +++---------
 gcc/combine.c         | 10 ++--------
 gcc/cprop.c           |  4 +---
 gcc/cse.c             |  4 +---
 gcc/df-problems.c     |  4 +---
 gcc/function.c        |  5 ++---
 gcc/haifa-sched.c     |  3 +--
 gcc/ira.c             |  5 ++---
 gcc/loop-invariant.c  |  4 +---
 gcc/lra-constraints.c |  6 ++----
 gcc/postreload.c      |  4 +---
 gcc/reload.c          | 10 +++-------
 gcc/reorg.c           | 32 ++++++++------------------------
 gcc/sched-rgn.c       |  4 +---
 14 files changed, 29 insertions(+), 78 deletions(-)

diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 4c1708f..d93a49e 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -893,10 +893,9 @@ rtl_merge_blocks (basic_block a, basic_block b)
 
       del_first = a_end;
 
-#if HAVE_cc0
       /* If this was a conditional jump, we need to also delete
 	 the insn that set cc0.  */
-      if (only_sets_cc0_p (prev))
+      if (HAVE_cc0 && only_sets_cc0_p (prev))
 	{
 	  rtx_insn *tmp = prev;
 
@@ -905,7 +904,6 @@ rtl_merge_blocks (basic_block a, basic_block b)
 	    prev = BB_HEAD (a);
 	  del_first = tmp;
 	}
-#endif
 
       a_end = PREV_INSN (del_first);
     }
@@ -1064,11 +1062,9 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout)
   /* In case we zap a conditional jump, we'll need to kill
      the cc0 setter too.  */
   kill_from = insn;
-#if HAVE_cc0
-  if (reg_mentioned_p (cc0_rtx, PATTERN (insn))
+  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, PATTERN (insn))
       && only_sets_cc0_p (PREV_INSN (insn)))
     kill_from = PREV_INSN (insn);
-#endif
 
   /* See if we can create the fallthru edge.  */
   if (in_cfglayout || can_fallthru (src, target))
@@ -1825,12 +1821,10 @@ rtl_tidy_fallthru_edge (edge e)
 	  delete_insn (table);
 	}
 
-#if HAVE_cc0
       /* If this was a conditional jump, we need to also delete
 	 the insn that set cc0.  */
-      if (any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
+      if (HAVE_cc0 && any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
 	q = PREV_INSN (q);
-#endif
 
       q = PREV_INSN (q);
     }
diff --git a/gcc/combine.c b/gcc/combine.c
index 430084e..d71f863 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1141,10 +1141,8 @@ insn_a_feeds_b (rtx_insn *a, rtx_insn *b)
   FOR_EACH_LOG_LINK (links, b)
     if (links->insn == a)
       return true;
-#if HAVE_cc0
-  if (sets_cc0_p (a))
+  if (HAVE_cc0 && sets_cc0_p (a))
     return true;
-#endif
   return false;
 }
 \f
@@ -4816,7 +4814,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
       break;
 
     case SET:
-#if HAVE_cc0
       /* If SET_DEST is CC0 and SET_SRC is not an operand, a COMPARE, or a
 	 ZERO_EXTRACT, the most likely reason why this doesn't match is that
 	 we need to put the operand into a register.  So split at that
@@ -4829,7 +4826,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
 	  && ! (GET_CODE (SET_SRC (x)) == SUBREG
 		&& OBJECT_P (SUBREG_REG (SET_SRC (x)))))
 	return &SET_SRC (x);
-#endif
 
       /* See if we can split SET_SRC as it stands.  */
       split = find_split_point (&SET_SRC (x), insn, true);
@@ -6582,13 +6578,12 @@ simplify_set (rtx x)
       else
 	compare_mode = SELECT_CC_MODE (new_code, op0, op1);
 
-#if !HAVE_cc0
       /* If the mode changed, we have to change SET_DEST, the mode in the
 	 compare, and the mode in the place SET_DEST is used.  If SET_DEST is
 	 a hard register, just build new versions with the proper mode.  If it
 	 is a pseudo, we lose unless it is only time we set the pseudo, in
 	 which case we can safely change its mode.  */
-      if (compare_mode != GET_MODE (dest))
+      if (!HAVE_cc0 && compare_mode != GET_MODE (dest))
 	{
 	  if (can_change_dest_mode (dest, 0, compare_mode))
 	    {
@@ -6610,7 +6605,6 @@ simplify_set (rtx x)
 	      dest = new_dest;
 	    }
 	}
-#endif  /* cc0 */
 #endif  /* SELECT_CC_MODE */
 
       /* If the code changed, we have to build a new comparison in
diff --git a/gcc/cprop.c b/gcc/cprop.c
index b1caabb..0103686 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -965,11 +965,9 @@ cprop_jump (basic_block bb, rtx_insn *setcc, rtx_insn *jump, rtx from, rtx src)
 	remove_note (jump, note);
      }
 
-#if HAVE_cc0
   /* Delete the cc0 setter.  */
-  if (setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
+  if (HAVE_cc0 && setcc != NULL && CC0_P (SET_DEST (single_set (setcc))))
     delete_insn (setcc);
-#endif
 
   global_const_prop_count++;
   if (dump_file != NULL)
diff --git a/gcc/cse.c b/gcc/cse.c
index 52f5a16..ee407ad 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6515,8 +6515,7 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 		  && check_for_label_ref (insn))
 		recorded_label_ref = true;
 
-#if HAVE_cc0
-	      if (NONDEBUG_INSN_P (insn))
+	      if (HAVE_cc0 && NONDEBUG_INSN_P (insn))
 		{
 		  /* If the previous insn sets CC0 and this insn no
 		     longer references CC0, delete the previous insn.
@@ -6543,7 +6542,6 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 		      prev_insn_cc0_mode = this_insn_cc0_mode;
 		    }
 		}
-#endif
 	    }
 	}
 
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index d213455..22fcfa6 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -3820,9 +3820,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
 	  if (bitmap_intersect_p (merge_set, test_use)
 	      || bitmap_intersect_p (merge_use, test_set))
 	    break;
-#if HAVE_cc0
-	  if (!sets_cc0_p (insn))
-#endif
+	  if (!HAVE_cc0 || !sets_cc0_p (insn))
 	    max_to = insn;
 	}
       next = NEXT_INSN (insn);
diff --git a/gcc/function.c b/gcc/function.c
index 70d20ef..dd146aa 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -5634,10 +5634,9 @@ emit_use_return_register_into_block (basic_block bb)
   seq = get_insns ();
   end_sequence ();
   insn = BB_END (bb);
-#if HAVE_cc0
-  if (reg_mentioned_p (cc0_rtx, PATTERN (insn)))
+  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, PATTERN (insn)))
     insn = prev_cc0_setter (insn);
-#endif
+
   emit_insn_before (seq, insn);
 }
 
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 286bd1b..64c89e8 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -7184,9 +7184,8 @@ void
 sched_init (void)
 {
   /* Disable speculative loads in their presence if cc0 defined.  */
-#if HAVE_cc0
+  if (HAVE_cc0)
   flag_schedule_speculative_load = 0;
-#endif
 
   if (targetm.sched.dispatch (NULL, IS_DISPATCH_ON))
     targetm.sched.dispatch_do (NULL, DISPATCH_INIT);
diff --git a/gcc/ira.c b/gcc/ira.c
index 819d702..0750d11 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -4641,15 +4641,14 @@ find_moveable_pseudos (void)
 			   ? " (no unique first use)" : "");
 		continue;
 	      }
-#if HAVE_cc0
-	    if (reg_referenced_p (cc0_rtx, PATTERN (closest_use)))
+	    if (HAVE_cc0 && reg_referenced_p (cc0_rtx, PATTERN (closest_use)))
 	      {
 		if (dump_file)
 		  fprintf (dump_file, "Reg %d: closest user uses cc0\n",
 			   regno);
 		continue;
 	      }
-#endif
+
 	    bitmap_set_bit (&interesting, regno);
 	    /* If we get here, we know closest_use is a non-NULL insn
 	       (as opposed to const_0_rtx).  */
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index ef956a4..7a433bc 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -922,11 +922,9 @@ find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed)
   bool simple = true;
   struct invariant *inv;
 
-#if HAVE_cc0
   /* We can't move a CC0 setter without the user.  */
-  if (sets_cc0_p (insn))
+  if (HAVE_cc0 && sets_cc0_p (insn))
     return;
-#endif
 
   set = single_set (insn);
   if (!set)
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 39cb036..fcd0621 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3354,12 +3354,10 @@ curr_insn_transform (bool check_only_p)
   if (JUMP_P (curr_insn) || CALL_P (curr_insn))
     no_output_reloads_p = true;
 
-#if HAVE_cc0
-  if (reg_referenced_p (cc0_rtx, PATTERN (curr_insn)))
+  if (HAVE_cc0 && reg_referenced_p (cc0_rtx, PATTERN (curr_insn)))
     no_input_reloads_p = true;
-  if (reg_set_p (cc0_rtx, PATTERN (curr_insn)))
+  if (HAVE_cc0 && reg_set_p (cc0_rtx, PATTERN (curr_insn)))
     no_output_reloads_p = true;
-#endif
 
   n_operands = curr_static_id->n_operands;
   n_alternatives = curr_static_id->n_alternatives;
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 68443ab..948fcbd 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -1032,11 +1032,9 @@ reload_combine_recognize_const_pattern (rtx_insn *insn)
 	      && reg_state[clobbered_regno].real_store_ruid >= use_ruid)
 	    break;
 
-#if HAVE_cc0
 	  /* Do not separate cc0 setter and cc0 user on HAVE_cc0 targets.  */
-	  if (must_move_add && sets_cc0_p (PATTERN (use_insn)))
+	  if (HAVE_cc0 && must_move_add && sets_cc0_p (PATTERN (use_insn)))
 	    break;
-#endif
 
 	  gcc_assert (reg_state[regno].store_ruid <= use_ruid);
 	  /* Avoid moving a use of ADDREG past a point where it is stored.  */
diff --git a/gcc/reload.c b/gcc/reload.c
index 8b253b8..bb5dae7 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2706,12 +2706,10 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
   if (JUMP_P (insn) || CALL_P (insn))
     no_output_reloads = 1;
 
-#if HAVE_cc0
-  if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
+  if (HAVE_cc0 && reg_referenced_p (cc0_rtx, PATTERN (insn)))
     no_input_reloads = 1;
-  if (reg_set_p (cc0_rtx, PATTERN (insn)))
+  if (HAVE_cc0 && reg_set_p (cc0_rtx, PATTERN (insn)))
     no_output_reloads = 1;
-#endif
 
 #ifdef SECONDARY_MEMORY_NEEDED
   /* The eliminated forms of any secondary memory locations are per-insn, so
@@ -4579,16 +4577,14 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
 	    rld[j].in = 0;
 	  }
 
-#if HAVE_cc0
   /* If we made any reloads for addresses, see if they violate a
      "no input reloads" requirement for this insn.  But loads that we
      do after the insn (such as for output addresses) are fine.  */
-  if (no_input_reloads)
+  if (HAVE_cc0 && no_input_reloads)
     for (i = 0; i < n_reloads; i++)
       gcc_assert (rld[i].in == 0
 		  || rld[i].when_needed == RELOAD_FOR_OUTADDR_ADDRESS
 		  || rld[i].when_needed == RELOAD_FOR_OUTPUT_ADDRESS);
-#endif
 
   /* Compute reload_mode and reload_nregs.  */
   for (i = 0; i < n_reloads; i++)
diff --git a/gcc/reorg.c b/gcc/reorg.c
index f059504..fedefcc 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -182,7 +182,6 @@ skip_consecutive_labels (rtx label_or_return)
   return label;
 }
 
-#if HAVE_cc0
 /* INSN uses CC0 and is being moved into a delay slot.  Set up REG_CC_SETTER
    and REG_CC_USER notes so we can find it.  */
 
@@ -197,7 +196,6 @@ link_cc0_insns (rtx insn)
   add_reg_note (user, REG_CC_SETTER, insn);
   add_reg_note (insn, REG_CC_USER, user);
 }
-#endif
 \f
 /* Insns which have delay slots that have not yet been filled.  */
 
@@ -699,8 +697,7 @@ delete_scheduled_jump (rtx_insn *insn)
      be other insns that became dead anyway, which we wouldn't know to
      delete.  */
 
-#if HAVE_cc0
-  if (reg_mentioned_p (cc0_rtx, insn))
+  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, insn))
     {
       rtx note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
 
@@ -730,7 +727,6 @@ delete_scheduled_jump (rtx_insn *insn)
 	    delete_from_delay_slot (trial);
 	}
     }
-#endif
 
   delete_related_insns (insn);
 }
@@ -1171,11 +1167,9 @@ steal_delay_list_from_target (rtx_insn *insn, rtx condition, rtx_sequence *seq,
       if (insn_references_resource_p (trial, sets, false)
 	  || insn_sets_resource_p (trial, needed, false)
 	  || insn_sets_resource_p (trial, sets, false)
-#if HAVE_cc0
 	  /* If TRIAL sets CC0, we can't copy it, so we can't steal this
 	     delay list.  */
-	  || find_reg_note (trial, REG_CC_USER, NULL_RTX)
-#endif
+	  || (HAVE_cc0 && find_reg_note (trial, REG_CC_USER, NULL_RTX))
 	  /* If TRIAL is from the fallthrough code of an annulled branch insn
 	     in SEQ, we cannot use it.  */
 	  || (INSN_ANNULLED_BRANCH_P (seq->insn (0))
@@ -1279,10 +1273,7 @@ steal_delay_list_from_fallthrough (rtx_insn *insn, rtx condition,
       if (insn_references_resource_p (trial, sets, false)
 	  || insn_sets_resource_p (trial, needed, false)
 	  || insn_sets_resource_p (trial, sets, false)
-#if HAVE_cc0
-	  || sets_cc0_p (PATTERN (trial))
-#endif
-	  )
+	  || (HAVE_cc0 && sets_cc0_p (PATTERN (trial))))
 
 	break;
 
@@ -1613,9 +1604,7 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
     target_main = XVECEXP (PATTERN (target), 0, 0);
 
   if (resource_conflicts_p (&needed, &set)
-#if HAVE_cc0
-      || reg_mentioned_p (cc0_rtx, ipat)
-#endif
+      || (HAVE_cc0 && reg_mentioned_p (cc0_rtx, ipat))
       /* The insn requiring the delay may not set anything needed or set by
 	 INSN.  */
       || insn_sets_resource_p (target_main, &needed, true)
@@ -2254,10 +2243,9 @@ fill_simple_delay_slots (int non_jumps_p)
 		{
 		  next_trial = next_nonnote_insn (trial);
 		  delay_list = add_to_delay_list (trial, delay_list);
-#if HAVE_cc0
-		  if (reg_mentioned_p (cc0_rtx, pat))
+		  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, pat))
 		    link_cc0_insns (trial);
-#endif
+
 		  delete_related_insns (trial);
 		  if (slots_to_fill == ++slots_filled)
 		    break;
@@ -2589,10 +2577,8 @@ fill_slots_from_thread (rtx_insn *insn, rtx condition, rtx thread_or_return,
 		  must_annul = 1;
 		winner:
 
-#if HAVE_cc0
-		  if (reg_mentioned_p (cc0_rtx, pat))
+		  if (HAVE_cc0 && reg_mentioned_p (cc0_rtx, pat))
 		    link_cc0_insns (trial);
-#endif
 
 		  /* If we own this thread, delete the insn.  If this is the
 		     destination of a branch, show that a basic block status
@@ -3145,8 +3131,7 @@ delete_computation (rtx insn)
 {
   rtx note, next;
 
-#if HAVE_cc0
-  if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
+  if (HAVE_cc0 && reg_referenced_p (cc0_rtx, PATTERN (insn)))
     {
       rtx prev = prev_nonnote_insn (insn);
       /* We assume that at this stage
@@ -3166,7 +3151,6 @@ delete_computation (rtx insn)
 	    add_reg_note (prev, REG_UNUSED, cc0_rtx);
 	}
     }
-#endif
 
   for (note = REG_NOTES (insn); note; note = next)
     {
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index 33261fc..7efd4ad 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -2487,9 +2487,7 @@ add_branch_dependences (rtx_insn *head, rtx_insn *tail)
 	     && (GET_CODE (PATTERN (insn)) == USE
 		 || GET_CODE (PATTERN (insn)) == CLOBBER
 		 || can_throw_internal (insn)
-#if HAVE_cc0
-		 || sets_cc0_p (PATTERN (insn))
-#endif
+		 || (HAVE_cc0 && sets_cc0_p (PATTERN (insn)))
 		 || (!reload_completed
 		     && sets_likely_spilled (PATTERN (insn)))))
 	 || NOTE_P (insn)
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (5 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 04/12] always define HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:31   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 05/12] make some HAVE_cc0 code always compiled tbsaunde+gcc
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h (INSN_SETS_ARE_DELAYED): New definition.
	* reorg.c (redundant_insn): Remove ifdef INSN_SETS_ARE_DELAYED.
	* resource.c (mark_set_resources): Likewise.
---
 gcc/defaults.h | 4 ++++
 gcc/reorg.c    | 4 ----
 gcc/resource.c | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 843d7e2..79cb599 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1201,6 +1201,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define DEFAULT_PCC_STRUCT_RETURN 1
 #endif
 
+#ifndef INSN_SETS_ARE_DELAYED
+#define INSN_SETS_ARE_DELAYED(INSN) false
+#endif
+
 #ifdef GCC_INSN_FLAGS_H
 /* Dependent default target macro definitions
 
diff --git a/gcc/reorg.c b/gcc/reorg.c
index b7228f2..ae77f0a 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -1555,10 +1555,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
 	     slots because it is difficult to track its resource needs
 	     correctly.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
 	  if (INSN_SETS_ARE_DELAYED (seq->insn (0)))
 	    return 0;
-#endif
 
 #ifdef INSN_REFERENCES_ARE_DELAYED
 	  if (INSN_REFERENCES_ARE_DELAYED (seq->insn (0)))
@@ -1657,10 +1655,8 @@ redundant_insn (rtx insn, rtx_insn *target, rtx delay_list)
 	  /* If this is an INSN or JUMP_INSN with delayed effects, it
 	     is hard to track the resource needs properly, so give up.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
 	  if (INSN_SETS_ARE_DELAYED (control))
 	    return 0;
-#endif
 
 #ifdef INSN_REFERENCES_ARE_DELAYED
 	  if (INSN_REFERENCES_ARE_DELAYED (control))
diff --git a/gcc/resource.c b/gcc/resource.c
index 9a013b3..5af9376 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -696,11 +696,9 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
 	/* An insn consisting of just a CLOBBER (or USE) is just for flow
 	   and doesn't actually do anything, so we ignore it.  */
 
-#ifdef INSN_SETS_ARE_DELAYED
       if (mark_type != MARK_SRC_DEST_CALL
 	  && INSN_SETS_ARE_DELAYED (as_a <rtx_insn *> (x)))
 	return;
-#endif
 
       x = PATTERN (x);
       if (GET_CODE (x) != USE && GET_CODE (x) != CLOBBER)
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 07/12] provide default for MASK_RETURN_ADDR
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:32   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED tbsaunde+gcc
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h (MASK_RETURN_ADDR): New definition.
	* except.c (expand_builtin_extract_return_addr): Remove ifdef
	MASK_RETURN_ADDR.
---
 gcc/defaults.h | 4 ++++
 gcc/except.c   | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 767901a..843d7e2 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -388,6 +388,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define RETURN_ADDR_OFFSET 0
 #endif
 
+#ifndef MASK_RETURN_ADDR
+#define MASK_RETURN_ADDR NULL_RTX
+#endif
+
 /* If we have named section and we support weak symbols, then use the
    .jcr section for recording java classes which need to be registered
    at program start-up time.  */
diff --git a/gcc/except.c b/gcc/except.c
index c98163d..5b24006 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2184,9 +2184,9 @@ expand_builtin_extract_return_addr (tree addr_tree)
     }
 
   /* First mask out any unwanted bits.  */
-#ifdef MASK_RETURN_ADDR
-  expand_and (Pmode, addr, MASK_RETURN_ADDR, addr);
-#endif
+  rtx mask = MASK_RETURN_ADDR;
+  if (mask)
+    expand_and (Pmode, addr, mask, addr);
 
   /* Then adjust to find the real return address.  */
   if (RETURN_ADDR_OFFSET)
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (9 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:34   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 02/12] remove some ifdef HAVE_cc0 tbsaunde+gcc
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* df-scan.c (df_get_entry_block_def_set): Remove #ifdef
	PIC_OFFSET_TABLE_REGNUM.
---
 gcc/df-scan.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 69332a8..4232ec8 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3589,10 +3589,6 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
   /* These registers are live everywhere.  */
   if (!reload_completed)
     {
-#ifdef PIC_OFFSET_TABLE_REGNUM
-      unsigned int picreg = PIC_OFFSET_TABLE_REGNUM;
-#endif
-
 #if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
       /* Pseudos with argument area equivalences may require
 	 reloading via the argument pointer.  */
@@ -3600,13 +3596,12 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
 	bitmap_set_bit (entry_block_defs, ARG_POINTER_REGNUM);
 #endif
 
-#ifdef PIC_OFFSET_TABLE_REGNUM
       /* Any constant, or pseudo with constant equivalences, may
 	 require reloading from memory using the pic register.  */
+      unsigned int picreg = PIC_OFFSET_TABLE_REGNUM;
       if (picreg != INVALID_REGNUM
 	  && fixed_regs[picreg])
 	bitmap_set_bit (entry_block_defs, picreg);
-#endif
     }
 
 #ifdef INCOMING_RETURN_ADDR_RTX
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 06/12] provide default for RETURN_ADDR_OFFSET
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
  2015-04-21 13:25 ` [PATCH 07/12] provide default for MASK_RETURN_ADDR tbsaunde+gcc
  2015-04-21 13:25 ` [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:32   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO tbsaunde+gcc
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h (RETURN_ADDR_OFFSET): New definition.
	* except.c (expand_builtin_extract_return_addr): Remove ifdef
	RETURN_ADDR_OFFSET.
	(expand_builtin_frob_return_addr): Likewise.
---
 gcc/defaults.h |  5 +++++
 gcc/except.c   | 14 +++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gcc/defaults.h b/gcc/defaults.h
index 911c2f8..767901a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -383,6 +383,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
 #endif
 
+/* Offset between the eh handler address and entry in eh tables.  */
+#ifndef RETURN_ADDR_OFFSET
+#define RETURN_ADDR_OFFSET 0
+#endif
+
 /* If we have named section and we support weak symbols, then use the
    .jcr section for recording java classes which need to be registered
    at program start-up time.  */
diff --git a/gcc/except.c b/gcc/except.c
index 7573c88..c98163d 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2189,9 +2189,8 @@ expand_builtin_extract_return_addr (tree addr_tree)
 #endif
 
   /* Then adjust to find the real return address.  */
-#if defined (RETURN_ADDR_OFFSET)
-  addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+    addr = plus_constant (Pmode, addr, RETURN_ADDR_OFFSET);
 
   return addr;
 }
@@ -2207,10 +2206,11 @@ expand_builtin_frob_return_addr (tree addr_tree)
 
   addr = convert_memory_address (Pmode, addr);
 
-#ifdef RETURN_ADDR_OFFSET
-  addr = force_reg (Pmode, addr);
-  addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
-#endif
+  if (RETURN_ADDR_OFFSET)
+    {
+      addr = force_reg (Pmode, addr);
+      addr = plus_constant (Pmode, addr, -RETURN_ADDR_OFFSET);
+    }
 
   return addr;
 }
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (2 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 06/12] provide default for RETURN_ADDR_OFFSET tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:40   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 03/12] more removal of ifdef HAVE_cc0 tbsaunde+gcc
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* defaults.h: New definition of EH_RETURN_DATA_REGNO.
	* except.c: Remove definition of EH_RETURN_DATA_REGNO.
	* builtins.c (expand_builtin): Remove check if
	EH_RETURN_DATA_REGNO is defined.
	* df-scan.c (df_bb_refs_collect): Likewise.
	(df_get_exit_block_use_set): Likewise.
	* haifa-sched.c (initiate_bb_reg_pressure_info): Likewise.
	* ira-lives.c (process_bb_node_lives): Likewise.
	* lra-lives.c (process_bb_lives): Likewise.
---
 gcc/builtins.c    | 2 --
 gcc/defaults.h    | 6 ++++++
 gcc/df-scan.c     | 4 ----
 gcc/except.c      | 6 ------
 gcc/haifa-sched.c | 2 --
 gcc/ira-lives.c   | 2 --
 gcc/lra-lives.c   | 2 --
 7 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 9263777..028d793 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -6510,10 +6510,8 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
       expand_builtin_eh_return (CALL_EXPR_ARG (exp, 0),
 				CALL_EXPR_ARG (exp, 1));
       return const0_rtx;
-#ifdef EH_RETURN_DATA_REGNO
     case BUILT_IN_EH_RETURN_DATA_REGNO:
       return expand_builtin_eh_return_data_regno (exp);
-#endif
     case BUILT_IN_EXTEND_POINTER:
       return expand_builtin_extend_pointer (CALL_EXPR_ARG (exp, 0));
     case BUILT_IN_EH_POINTER:
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 1d54798..911c2f8 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -377,6 +377,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 #endif
 
+/* Provide defaults for stuff that may not be defined when using
+   sjlj exceptions.  */
+#ifndef EH_RETURN_DATA_REGNO
+#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
+#endif
+
 /* If we have named section and we support weak symbols, then use the
    .jcr section for recording java classes which need to be registered
    at program start-up time.  */
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 1700be9..b2e2e5d 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3332,7 +3332,6 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb)
       return;
     }
 
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
     {
       unsigned int i;
@@ -3346,7 +3345,6 @@ df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb)
 			 bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP);
 	}
     }
-#endif
 
   /* Add the hard_frame_pointer if this block is the target of a
      non-local goto.  */
@@ -3751,7 +3749,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
 	  bitmap_set_bit (exit_block_uses, i);
     }
 
-#ifdef EH_RETURN_DATA_REGNO
   /* Mark the registers that will contain data for the handler.  */
   if (reload_completed && crtl->calls_eh_return)
     for (i = 0; ; ++i)
@@ -3761,7 +3758,6 @@ df_get_exit_block_use_set (bitmap exit_block_uses)
 	  break;
 	bitmap_set_bit (exit_block_uses, regno);
       }
-#endif
 
 #ifdef EH_RETURN_STACKADJ_RTX
   if ((!HAVE_epilogue || ! epilogue_completed)
diff --git a/gcc/except.c b/gcc/except.c
index 833ec21..7573c88 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -174,12 +174,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "builtins.h"
 
-/* Provide defaults for stuff that may not be defined when using
-   sjlj exceptions.  */
-#ifndef EH_RETURN_DATA_REGNO
-#define EH_RETURN_DATA_REGNO(N) INVALID_REGNUM
-#endif
-
 static GTY(()) int call_site_base;
 
 struct tree_hash_traits : default_hashmap_traits
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index ad2450b..d47cb8c 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1070,7 +1070,6 @@ initiate_bb_reg_pressure_info (basic_block bb)
       if (NONDEBUG_INSN_P (insn))
 	setup_ref_regs (PATTERN (insn));
   initiate_reg_pressure_info (df_get_live_in (bb));
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
     for (i = 0; ; ++i)
       {
@@ -1082,7 +1081,6 @@ initiate_bb_reg_pressure_info (basic_block bb)
 	  mark_regno_birth_or_death (curr_reg_live, curr_reg_pressure,
 				     regno, true);
       }
-#endif
 }
 
 /* Save current register pressure related info.  */
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index b29f572..2837349 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -1319,7 +1319,6 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
 	  curr_point++;
 	}
 
-#ifdef EH_RETURN_DATA_REGNO
       if (bb_has_eh_pred (bb))
 	for (j = 0; ; ++j)
 	  {
@@ -1328,7 +1327,6 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node)
 	      break;
 	    make_hard_regno_born (regno);
 	  }
-#endif
 
       /* Allocnos can't go in stack regs at the start of a basic block
 	 that is reached by an abnormal edge. Likewise for call
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 9dfffb6..47a9ba2 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -954,7 +954,6 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
 	add_reg_note (curr_insn, REG_UNUSED, regno_reg_rtx[j]);
     }
 
-#ifdef EH_RETURN_DATA_REGNO
   if (bb_has_eh_pred (bb))
     for (j = 0; ; ++j)
       {
@@ -964,7 +963,6 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
 	  break;
 	make_hard_regno_born (regno, false);
       }
-#endif
 
   /* Pseudos can't go in stack regs at the start of a basic block that
      is reached by an abnormal edge. Likewise for call clobbered regs,
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 03/12] more removal of ifdef HAVE_cc0
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (3 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO tbsaunde+gcc
@ 2015-04-21 13:25 ` tbsaunde+gcc
  2015-04-21 13:51   ` Jeff Law
  2015-04-21 13:25 ` [PATCH 04/12] always define HAVE_cc0 tbsaunde+gcc
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
	that is trivially ded on non cc0 targets.
	(simplify_set): Likewise.
	(mark_used_regs_combine): Likewise.
	* cse.c (new_basic_block): Likewise.
	(fold_rtx): Likewise.
	(cse_insn): Likewise.
	(cse_extended_basic_block): Likewise.
	(set_live_p): Likewise.
	* rtlanal.c (canonicalize_condition): Likewise.
	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
---
 gcc/combine.c      |  6 ------
 gcc/cse.c          | 18 ------------------
 gcc/rtlanal.c      |  2 --
 gcc/simplify-rtx.c |  5 ++---
 4 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 46cd6db..0a35b8f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -686,7 +686,6 @@ find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
   rtx *result;
   struct insn_link *link;
 
-#ifdef HAVE_cc0
   if (dest == cc0_rtx)
     {
       next = NEXT_INSN (insn);
@@ -699,7 +698,6 @@ find_single_use (rtx dest, rtx_insn *insn, rtx_insn **ploc)
 	*ploc = next;
       return result;
     }
-#endif
 
   if (!REG_P (dest))
     return 0;
@@ -6724,7 +6722,6 @@ simplify_set (rtx x)
       src = SET_SRC (x), dest = SET_DEST (x);
     }
 
-#ifdef HAVE_cc0
   /* If we have (set (cc0) (subreg ...)), we try to remove the subreg
      in SRC.  */
   if (dest == cc0_rtx
@@ -6744,7 +6741,6 @@ simplify_set (rtx x)
 	  src = SET_SRC (x);
 	}
     }
-#endif
 
 #ifdef LOAD_EXTEND_OP
   /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this
@@ -13193,11 +13189,9 @@ mark_used_regs_combine (rtx x)
     case ADDR_VEC:
     case ADDR_DIFF_VEC:
     case ASM_INPUT:
-#ifdef HAVE_cc0
     /* CC0 must die in the insn after it is set, so we don't need to take
        special note of it here.  */
     case CC0:
-#endif
       return;
 
     case CLOBBER:
diff --git a/gcc/cse.c b/gcc/cse.c
index 2a33827..d184d27 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -281,7 +281,6 @@ struct qty_table_elem
 /* The table of all qtys, indexed by qty number.  */
 static struct qty_table_elem *qty_table;
 
-#ifdef HAVE_cc0
 /* For machines that have a CC0, we do not record its value in the hash
    table since its use is guaranteed to be the insn immediately following
    its definition and any other insn is presumed to invalidate it.
@@ -293,7 +292,6 @@ static struct qty_table_elem *qty_table;
 
 static rtx this_insn_cc0, prev_insn_cc0;
 static machine_mode this_insn_cc0_mode, prev_insn_cc0_mode;
-#endif
 
 /* Insn being scanned.  */
 
@@ -884,9 +882,7 @@ new_basic_block (void)
 	}
     }
 
-#ifdef HAVE_cc0
   prev_insn_cc0 = 0;
-#endif
 }
 
 /* Say that register REG contains a quantity in mode MODE not in any
@@ -3166,10 +3162,8 @@ fold_rtx (rtx x, rtx_insn *insn)
     case EXPR_LIST:
       return x;
 
-#ifdef HAVE_cc0
     case CC0:
       return prev_insn_cc0;
-#endif
 
     case ASM_OPERANDS:
       if (insn)
@@ -3223,7 +3217,6 @@ fold_rtx (rtx x, rtx_insn *insn)
 	    const_arg = folded_arg;
 	    break;
 
-#ifdef HAVE_cc0
 	  case CC0:
 	    /* The cc0-user and cc0-setter may be in different blocks if
 	       the cc0-setter potentially traps.  In that case PREV_INSN_CC0
@@ -3247,7 +3240,6 @@ fold_rtx (rtx x, rtx_insn *insn)
 		const_arg = equiv_constant (folded_arg);
 	      }
 	    break;
-#endif
 
 	  default:
 	    folded_arg = fold_rtx (folded_arg, insn);
@@ -4522,11 +4514,9 @@ cse_insn (rtx_insn *insn)
     sets = XALLOCAVEC (struct set, XVECLEN (x, 0));
 
   this_insn = insn;
-#ifdef HAVE_cc0
   /* Records what this insn does to set CC0.  */
   this_insn_cc0 = 0;
   this_insn_cc0_mode = VOIDmode;
-#endif
 
   /* Find all regs explicitly clobbered in this insn,
      to ensure they are not replaced with any other regs
@@ -5541,7 +5531,6 @@ cse_insn (rtx_insn *insn)
 	    }
 	}
 
-#ifdef HAVE_cc0
       /* If setting CC0, record what it was set to, or a constant, if it
 	 is equivalent to a constant.  If it is being set to a floating-point
 	 value, make a COMPARE with the appropriate constant of 0.  If we
@@ -5556,7 +5545,6 @@ cse_insn (rtx_insn *insn)
 	    this_insn_cc0 = gen_rtx_COMPARE (VOIDmode, this_insn_cc0,
 					     CONST0_RTX (mode));
 	}
-#endif
     }
 
   /* Now enter all non-volatile source expressions in the hash table
@@ -6604,11 +6592,9 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 	  record_jump_equiv (insn, taken);
 	}
 
-#ifdef HAVE_cc0
       /* Clear the CC0-tracking related insns, they can't provide
 	 useful information across basic block boundaries.  */
       prev_insn_cc0 = 0;
-#endif
     }
 
   gcc_assert (next_qty <= max_qty);
@@ -6859,21 +6845,17 @@ static bool
 set_live_p (rtx set, rtx_insn *insn ATTRIBUTE_UNUSED, /* Only used with HAVE_cc0.  */
 	    int *counts)
 {
-#ifdef HAVE_cc0
   rtx tem;
-#endif
 
   if (set_noop_p (set))
     ;
 
-#ifdef HAVE_cc0
   else if (GET_CODE (SET_DEST (set)) == CC0
 	   && !side_effects_p (SET_SRC (set))
 	   && ((tem = next_nonnote_nondebug_insn (insn)) == NULL_RTX
 	       || !INSN_P (tem)
 	       || !reg_referenced_p (cc0_rtx, PATTERN (tem))))
     return false;
-#endif
   else if (!is_dead_reg (SET_DEST (set), counts)
 	   || side_effects_p (SET_SRC (set)))
     return true;
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 743aad6..2377f25a 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5035,7 +5035,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
       /* Set nonzero when we find something of interest.  */
       rtx x = 0;
 
-#ifdef HAVE_cc0
       /* If comparison with cc0, import actual comparison from compare
 	 insn.  */
       if (op0 == cc0_rtx)
@@ -5051,7 +5050,6 @@ canonicalize_condition (rtx_insn *insn, rtx cond, int reverse,
 	  if (earliest)
 	    *earliest = prev;
 	}
-#endif
 
       /* If this is a COMPARE, pick up the two things being compared.  */
       if (GET_CODE (op0) == COMPARE)
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 5d17498..61e440f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2180,15 +2180,14 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
 	  rtx xop00 = XEXP (op0, 0);
 	  rtx xop10 = XEXP (op1, 0);
 
-#ifdef HAVE_cc0
 	  if (GET_CODE (xop00) == CC0 && GET_CODE (xop10) == CC0)
-#else
+	      return xop00;
+
 	    if (REG_P (xop00) && REG_P (xop10)
 		&& GET_MODE (xop00) == GET_MODE (xop10)
 		&& REGNO (xop00) == REGNO (xop10)
 		&& GET_MODE_CLASS (GET_MODE (xop00)) == MODE_CC
 		&& GET_MODE_CLASS (GET_MODE (xop10)) == MODE_CC)
-#endif
 	      return xop00;
 	}
       break;
-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [PATCH 00/12] Reduce conditional compilation
@ 2015-04-21 13:25 tbsaunde+gcc
  2015-04-21 13:25 ` [PATCH 07/12] provide default for MASK_RETURN_ADDR tbsaunde+gcc
                   ` (13 more replies)
  0 siblings, 14 replies; 46+ messages in thread
From: tbsaunde+gcc @ 2015-04-21 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Trevor Saunders

From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

Hi,

This is a first round of patches to reduce the amount of code with in #if /
#ifdef.  This makes it incrementally easier to not break configs other than the
one being built, and moves things slightly closer to using target hooks for
everything.

each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
and whole patch set run through config-list.mk without issue, ok?

Trevor Saunders (12):
  add default definition of EH_RETURN_DATA_REGNO
  remove some ifdef HAVE_cc0
  more HAVE_cc0
  always define HAVE_cc0
  make some HAVE_cc0 code always compiled
  provide default for RETURN_ADDR_OFFSET
  provide default for MASK_RETURN_ADDR
  reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER
  remove #if for PIC_OFFSET_TABLE_REGNUM
  remove more ifdefs for HAVE_cc0
  provide default for INSN_SETS_ARE_DELAYED
  add default for INSN_REFERENCES_ARE_DELAYED

 gcc/alias.c           |  7 ++---
 gcc/builtins.c        |  2 --
 gcc/caller-save.c     |  4 +--
 gcc/cfgcleanup.c      | 26 +++++-----------
 gcc/cfgrtl.c          | 12 ++------
 gcc/combine.c         | 84 ++++++++++++++++++---------------------------------
 gcc/conditions.h      |  6 ----
 gcc/cprop.c           |  4 +--
 gcc/cse.c             | 22 +-------------
 gcc/defaults.h        | 23 ++++++++++++++
 gcc/df-problems.c     |  9 ++----
 gcc/df-scan.c         | 46 +++++++++++-----------------
 gcc/emit-rtl.c        |  8 ++---
 gcc/except.c          | 26 ++++++----------
 gcc/final.c           | 43 ++++++++++++--------------
 gcc/function.c        |  5 ++-
 gcc/gcse.c            | 24 ++++++++-------
 gcc/genconfig.c       |  1 +
 gcc/haifa-sched.c     |  5 +--
 gcc/ira-lives.c       |  2 --
 gcc/ira.c             | 33 +++++++++-----------
 gcc/jump.c            |  3 --
 gcc/loop-invariant.c  |  4 +--
 gcc/lra-constraints.c |  6 ++--
 gcc/lra-lives.c       |  2 --
 gcc/optabs.c          |  2 +-
 gcc/postreload.c      |  4 +--
 gcc/recog.c           |  2 --
 gcc/recog.h           |  2 --
 gcc/reginfo.c         |  5 ++-
 gcc/regrename.c       |  5 ++-
 gcc/reload.c          | 12 +++-----
 gcc/reload1.c         | 10 +++---
 gcc/reorg.c           | 68 ++++++++++-------------------------------
 gcc/resource.c        | 15 +++------
 gcc/rtlanal.c         |  2 --
 gcc/sched-deps.c      |  5 +--
 gcc/sched-rgn.c       |  4 +--
 gcc/simplify-rtx.c    |  5 ++-
 39 files changed, 199 insertions(+), 349 deletions(-)

-- 
2.3.0.80.g18d0fec.dirty

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED
  2015-04-21 13:25 ` [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED tbsaunde+gcc
@ 2015-04-21 13:30   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:30 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h (INSN_REFERENCES_ARE_DELAYED): New definition.
> 	* reorg.c (redundant_insn): Remove ifdef
> 	INSN_REFERENCES_ARE_DELAYED.
> 	* resource.c (mark_referenced_resources): Likewise.
OK.
Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED
  2015-04-21 13:25 ` [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED tbsaunde+gcc
@ 2015-04-21 13:31   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:31 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h (INSN_SETS_ARE_DELAYED): New definition.
> 	* reorg.c (redundant_insn): Remove ifdef INSN_SETS_ARE_DELAYED.
> 	* resource.c (mark_set_resources): Likewise.
OK.
Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 07/12] provide default for MASK_RETURN_ADDR
  2015-04-21 13:25 ` [PATCH 07/12] provide default for MASK_RETURN_ADDR tbsaunde+gcc
@ 2015-04-21 13:32   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:32 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h (MASK_RETURN_ADDR): New definition.
> 	* except.c (expand_builtin_extract_return_addr): Remove ifdef
> 	MASK_RETURN_ADDR.
OK.
jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 06/12] provide default for RETURN_ADDR_OFFSET
  2015-04-21 13:25 ` [PATCH 06/12] provide default for RETURN_ADDR_OFFSET tbsaunde+gcc
@ 2015-04-21 13:32   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:32 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h (RETURN_ADDR_OFFSET): New definition.
> 	* except.c (expand_builtin_extract_return_addr): Remove ifdef
> 	RETURN_ADDR_OFFSET.
> 	(expand_builtin_frob_return_addr): Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM
  2015-04-21 13:25 ` [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM tbsaunde+gcc
@ 2015-04-21 13:34   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:34 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* df-scan.c (df_get_entry_block_def_set): Remove #ifdef
> 	PIC_OFFSET_TABLE_REGNUM.
OK.
jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER
  2015-04-21 13:25 ` [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER tbsaunde+gcc
@ 2015-04-21 13:37   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:37 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* alias.c (init_alias_target): Remove ifdef
> 	* HARD_FRAME_POINTER_IS_FRAME_POINTER.
> 	* df-scan.c (df_insn_refs_collect): Likewise.
> 	(df_get_regular_block_artificial_uses): Likewise.
> 	(df_get_eh_block_artificial_uses): Likewise.
> 	(df_get_entry_block_def_set): Likewise.
> 	(df_get_exit_block_use_set): Likewise.
> 	* emit-rtl.c (gen_rtx_REG): Likewise.
> 	* ira.c (ira_setup_eliminable_regset): Likewise.
> 	* reginfo.c (init_reg_sets_1): Likewise.
> 	* regrename.c (rename_chains): Likewise.
> 	* reload1.c (reload): Likewise.
> 	(eliminate_regs_in_insn): Likewise.
> 	* resource.c (mark_referenced_resources): Likewise.
> 	(init_resource_info): Likewise.
OK.
jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO
  2015-04-21 13:25 ` [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO tbsaunde+gcc
@ 2015-04-21 13:40   ` Jeff Law
  2015-04-21 14:00     ` Jakub Jelinek
  0 siblings, 1 reply; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:40 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* defaults.h: New definition of EH_RETURN_DATA_REGNO.
> 	* except.c: Remove definition of EH_RETURN_DATA_REGNO.
> 	* builtins.c (expand_builtin): Remove check if
> 	EH_RETURN_DATA_REGNO is defined.
> 	* df-scan.c (df_bb_refs_collect): Likewise.
> 	(df_get_exit_block_use_set): Likewise.
> 	* haifa-sched.c (initiate_bb_reg_pressure_info): Likewise.
> 	* ira-lives.c (process_bb_node_lives): Likewise.
> 	* lra-lives.c (process_bb_lives): Likewise.
This one wasn't as obvious as the others, but is clearly OK once the 
full loops being guarded by EH_RETURN_DATA_REGNO are examined.

Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (11 preceding siblings ...)
  2015-04-21 13:25 ` [PATCH 02/12] remove some ifdef HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:43 ` Jeff Law
  2015-04-21 13:57 ` Jeff Law
  13 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:43 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> Hi,
>
> This is a first round of patches to reduce the amount of code with in #if /
> #ifdef.  This makes it incrementally easier to not break configs other than the
> one being built, and moves things slightly closer to using target hooks for
> everything.
>
> each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
> and whole patch set run through config-list.mk without issue, ok?
Thanks for tackling this.  It's not particular deep work, but I do think 
it'll help reduce the long term maintenance costs and make developers' 
lives easier.

Onward to the HAVE_cc0 patches :-)

Jeff

ps.  You hit a good window, my daughter was update late last night and 
is sleeping in a bit, so I've got unexpected time this morning before my 
meetings.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-21 13:25 ` [PATCH 02/12] remove some ifdef HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:48   ` Jeff Law
  2015-04-21 14:14   ` Richard Biener
  1 sibling, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:48 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* conditions.h: Define macros even if HAVE_cc0 is undefined.
> 	* emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> 	* final.c: Likewise.
> 	* jump.c: Likewise.
> 	* recog.c: Likewise.
> 	* recog.h: Declare functions even when HAVE_cc0 is undefined.
> 	* sched-deps.c (sched_analyze_2): Always compile case for cc0.
OK.  Note for anyone else reading at home, some of the functions being 
unconditionally compiled now already had unconditional prototypes in the 
header files. So not everything needed a .h file change.

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/12] more removal of ifdef HAVE_cc0
  2015-04-21 13:25 ` [PATCH 03/12] more removal of ifdef HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:51   ` Jeff Law
  2015-04-21 15:24     ` Trevor Saunders
  0 siblings, 1 reply; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:51 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
> 	that is trivially ded on non cc0 targets.
> 	(simplify_set): Likewise.
> 	(mark_used_regs_combine): Likewise.
> 	* cse.c (new_basic_block): Likewise.
> 	(fold_rtx): Likewise.
> 	(cse_insn): Likewise.
> 	(cse_extended_basic_block): Likewise.
> 	(set_live_p): Likewise.
> 	* rtlanal.c (canonicalize_condition): Likewise.
> 	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
OK.  I find myself wondering if the conditionals should look like
if (HAVE_cc0
     && (whatever))

But I doubt it makes any measurable difference.  It's something we can 
always add in the future if we feel the need to avoid the runtime checks 
for things that aren't ever going to happen on most modern targets.

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/12] always define HAVE_cc0
  2015-04-21 13:25 ` [PATCH 04/12] always define HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:53   ` Jeff Law
  2015-04-21 15:18     ` Trevor Saunders
  0 siblings, 1 reply; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:53 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* genconfig.c (main): Always define HAVE_cc0.
> 	* caller-save.c (insert_one_insn): Change ifdef HAVE_cc0 to #if
> 	HAVE_cc0.
> 	* cfgcleanup.c (flow_find_cross_jump): Likewise.
> 	(flow_find_head_matching_sequence): Likewise.
> 	(try_head_merge_bb): Likewise.
> 	* cfgrtl.c (rtl_merge_blocks): Likewise.
> 	(try_redirect_by_replacing_jump): Likewise.
> 	(rtl_tidy_fallthru_edge): Likewise.
> 	* combine.c (do_SUBST_MODE): Likewise.
> 	(insn_a_feeds_b): Likewise.
> 	(combine_instructions): Likewise.
> 	(can_combine_p): Likewise.
> 	(try_combine): Likewise.
> 	(find_split_point): Likewise.
> 	(subst): Likewise.
> 	(simplify_set): Likewise.
> 	(distribute_notes): Likewise.
> 	* cprop.c (cprop_jump): Likewise.
> 	* cse.c (cse_extended_basic_block): Likewise.
> 	* df-problems.c (can_move_insns_across): Likewise.
> 	* final.c (final): Likewise.
> 	(final_scan_insn): Likewise.
> 	* function.c (emit_use_return_register_into_block): Likewise.
> 	* gcse.c (insert_insn_end_basic_block): Likewise.
> 	* haifa-sched.c (sched_init): Likewise.
> 	* ira.c (find_moveable_pseudos): Likewise.
> 	* loop-invariant.c (find_invariant_insn): Likewise.
> 	* lra-constraints.c (curr_insn_transform): Likewise.
> 	* optabs.c (prepare_cmp_insn): Likewise.
> 	* postreload.c (reload_combine_recognize_const_pattern):
> 	* Likewise.
> 	* reload.c (find_reloads): Likewise.
> 	(find_reloads_address_1): Likewise.
> 	* reorg.c (delete_scheduled_jump): Likewise.
> 	(steal_delay_list_from_target): Likewise.
> 	(steal_delay_list_from_fallthrough): Likewise.
> 	(try_merge_delay_insns): Likewise.
> 	(redundant_insn): Likewise.
> 	(fill_simple_delay_slots): Likewise.
> 	(fill_slots_from_thread): Likewise.
> 	(delete_computation): Likewise.
> 	(relax_delay_slots): Likewise.
> 	* sched-deps.c (sched_analyze_2): Likewise.
> 	* sched-rgn.c (add_branch_dependences): Likewise.
Doesn't go as far as I'd like, but it's still an improvement.

OK.

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 05/12] make some HAVE_cc0 code always compiled
  2015-04-21 13:25 ` [PATCH 05/12] make some HAVE_cc0 code always compiled tbsaunde+gcc
@ 2015-04-21 13:54   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:54 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* cfgrtl.c (rtl_merge_blocks): Change #if HAVE_cc0 to if (HAVE_cc0)
> 	(try_redirect_by_replacing_jump): Likewise.
> 	(rtl_tidy_fallthru_edge): Likewise.
> 	* combine.c (insn_a_feeds_b): Likewise.
> 	(find_split_point): Likewise.
> 	(simplify_set): Likewise.
> 	* cprop.c (cprop_jump): Likewise.
> 	* cse.c (cse_extended_basic_block): Likewise.
> 	* df-problems.c (can_move_insns_across): Likewise.
> 	* function.c (emit_use_return_register_into_block): Likewise.
> 	* haifa-sched.c (sched_init): Likewise.
> 	* ira.c (find_moveable_pseudos): Likewise.
> 	* loop-invariant.c (find_invariant_insn): Likewise.
> 	* lra-constraints.c (curr_insn_transform): Likewise.
> 	* postreload.c (reload_combine_recognize_const_pattern):
> 	* Likewise.
> 	* reload.c (find_reloads): Likewise.
> 	* reorg.c (delete_scheduled_jump): Likewise.
> 	(steal_delay_list_from_target): Likewise.
> 	(steal_delay_list_from_fallthrough): Likewise.
> 	(redundant_insn): Likewise.
> 	(fill_simple_delay_slots): Likewise.
> 	(fill_slots_from_thread): Likewise.
> 	(delete_computation): Likewise.
> 	* sched-rgn.c (add_branch_dependences): Likewise.
OK.  This is what I expected to see a lot of :-0

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 10/12] remove more ifdefs for HAVE_cc0
  2015-04-21 13:25 ` [PATCH 10/12] remove more ifdefs for HAVE_cc0 tbsaunde+gcc
@ 2015-04-21 13:55   ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:55 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
> 	* caller-save.c (insert_one_insn): Remove ifdef HAVE_cc0.
> 	* cfgcleanup.c (flow_find_cross_jump): Likewise.
> 	(flow_find_head_matching_sequence): Likewise.
> 	(try_head_merge_bb): Likewise.
> 	* combine.c (can_combine_p): Likewise.
> 	(try_combine): Likewise.
> 	(distribute_notes): Likewise.
> 	* df-problems.c (can_move_insns_across): Likewise.
> 	* final.c (final): Likewise.
> 	* gcse.c (insert_insn_end_basic_block): Likewise.
> 	* ira.c (find_moveable_pseudos): Likewise.
> 	* reorg.c (try_merge_delay_insns): Likewise.
> 	(fill_simple_delay_slots): Likewise.
> 	(fill_slots_from_thread): Likewise.
> 	* sched-deps.c (sched_analyze_2): Likewise.
OK.

Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
                   ` (12 preceding siblings ...)
  2015-04-21 13:43 ` [PATCH 00/12] Reduce conditional compilation Jeff Law
@ 2015-04-21 13:57 ` Jeff Law
  2015-04-21 15:29   ` Trevor Saunders
  13 siblings, 1 reply; 46+ messages in thread
From: Jeff Law @ 2015-04-21 13:57 UTC (permalink / raw)
  To: tbsaunde+gcc, gcc-patches

On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> Hi,
>
> This is a first round of patches to reduce the amount of code with in #if /
> #ifdef.  This makes it incrementally easier to not break configs other than the
> one being built, and moves things slightly closer to using target hooks for
> everything.
>
> each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
> and whole patch set run through config-list.mk without issue, ok?
So I think after looking at this patchset, any changes of a similar 
nature you want to make should be considered pre-approved.  Just post 
them for archival purposes, but no need for you to wait for review as 
long as they have the same purpose and overall structure as was seen in 
these patches.

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO
  2015-04-21 13:40   ` Jeff Law
@ 2015-04-21 14:00     ` Jakub Jelinek
  2015-04-21 14:04       ` Jeff Law
  0 siblings, 1 reply; 46+ messages in thread
From: Jakub Jelinek @ 2015-04-21 14:00 UTC (permalink / raw)
  To: Jeff Law; +Cc: tbsaunde+gcc, gcc-patches

On Tue, Apr 21, 2015 at 07:40:37AM -0600, Jeff Law wrote:
> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> >gcc/ChangeLog:
> >
> >2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >	* defaults.h: New definition of EH_RETURN_DATA_REGNO.
> >	* except.c: Remove definition of EH_RETURN_DATA_REGNO.
> >	* builtins.c (expand_builtin): Remove check if
> >	EH_RETURN_DATA_REGNO is defined.
> >	* df-scan.c (df_bb_refs_collect): Likewise.
> >	(df_get_exit_block_use_set): Likewise.
> >	* haifa-sched.c (initiate_bb_reg_pressure_info): Likewise.
> >	* ira-lives.c (process_bb_node_lives): Likewise.
> >	* lra-lives.c (process_bb_lives): Likewise.
> This one wasn't as obvious as the others, but is clearly OK once the full
> loops being guarded by EH_RETURN_DATA_REGNO are examined.

Except that the bb_has_eh_pred predicate might burn CPU time for basic
blocks with many predecessors.  Though, the question is if there are any
important targets that don't define EH_RETURN_DATA_REGNO already.

	Jakub

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO
  2015-04-21 14:00     ` Jakub Jelinek
@ 2015-04-21 14:04       ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-21 14:04 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: tbsaunde+gcc, gcc-patches

On 04/21/2015 08:00 AM, Jakub Jelinek wrote:
> On Tue, Apr 21, 2015 at 07:40:37AM -0600, Jeff Law wrote:
>> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>
>>> gcc/ChangeLog:
>>>
>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>
>>> 	* defaults.h: New definition of EH_RETURN_DATA_REGNO.
>>> 	* except.c: Remove definition of EH_RETURN_DATA_REGNO.
>>> 	* builtins.c (expand_builtin): Remove check if
>>> 	EH_RETURN_DATA_REGNO is defined.
>>> 	* df-scan.c (df_bb_refs_collect): Likewise.
>>> 	(df_get_exit_block_use_set): Likewise.
>>> 	* haifa-sched.c (initiate_bb_reg_pressure_info): Likewise.
>>> 	* ira-lives.c (process_bb_node_lives): Likewise.
>>> 	* lra-lives.c (process_bb_lives): Likewise.
>> This one wasn't as obvious as the others, but is clearly OK once the full
>> loops being guarded by EH_RETURN_DATA_REGNO are examined.
>
> Except that the bb_has_eh_pred predicate might burn CPU time for basic
> blocks with many predecessors.  Though, the question is if there are any
> important targets that don't define EH_RETURN_DATA_REGNO already.
Probably not since they'll blow up elsewhere (I was recently helping 
someone with a private port that didn't define EH_RETURN_DATA_REGNO) :-)
jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-21 13:25 ` [PATCH 02/12] remove some ifdef HAVE_cc0 tbsaunde+gcc
  2015-04-21 13:48   ` Jeff Law
@ 2015-04-21 14:14   ` Richard Biener
  2015-04-21 15:24     ` Trevor Saunders
  1 sibling, 1 reply; 46+ messages in thread
From: Richard Biener @ 2015-04-21 14:14 UTC (permalink / raw)
  To: tbsaunde+gcc; +Cc: GCC Patches

On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>
> gcc/ChangeLog:
>
> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>
>         * conditions.h: Define macros even if HAVE_cc0 is undefined.
>         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>         * final.c: Likewise.
>         * jump.c: Likewise.
>         * recog.c: Likewise.
>         * recog.h: Declare functions even when HAVE_cc0 is undefined.
>         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> ---
>  gcc/conditions.h | 6 ------
>  gcc/emit-rtl.c   | 2 --
>  gcc/final.c      | 2 --
>  gcc/jump.c       | 3 ---
>  gcc/recog.c      | 2 --
>  gcc/recog.h      | 2 --
>  gcc/sched-deps.c | 5 +++--
>  7 files changed, 3 insertions(+), 19 deletions(-)
>
> diff --git a/gcc/conditions.h b/gcc/conditions.h
> index 2308bfc..7cd1e1c 100644
> --- a/gcc/conditions.h
> +++ b/gcc/conditions.h
> @@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
>  #ifndef GCC_CONDITIONS_H
>  #define GCC_CONDITIONS_H
>
> -/* None of the things in the files exist if we don't use CC0.  */
> -
> -#ifdef HAVE_cc0
> -
>  /* The variable cc_status says how to interpret the condition code.
>     It is set by output routines for an instruction that sets the cc's
>     and examined by output routines for jump instructions.
> @@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
>   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
>    CC_STATUS_MDEP_INIT)
>
> -#endif
> -
>  #endif /* GCC_CONDITIONS_H */
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index 483eacb..c1974bb 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
>    return insn;
>  }
>
> -#ifdef HAVE_cc0
>  /* Return the next insn that uses CC0 after INSN, which is assumed to
>     set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
>     applied to the result of this function should yield INSN).
> @@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
>
>    return insn;
>  }
> -#endif
>
>  #ifdef AUTO_INC_DEC
>  /* Find a RTX_AUTOINC class rtx which matches DATA.  */
> diff --git a/gcc/final.c b/gcc/final.c
> index 1fa93d9..41f6bd9 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
>
>  static int insn_counter = 0;
>
> -#ifdef HAVE_cc0
>  /* This variable contains machine-dependent flags (defined in tm.h)
>     set and examined by output routines
>     that describe how to interpret the condition codes properly.  */
> @@ -202,7 +201,6 @@ CC_STATUS cc_status;
>     from before the insn.  */
>
>  CC_STATUS cc_prev_status;
> -#endif
>
>  /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
>
> diff --git a/gcc/jump.c b/gcc/jump.c
> index 34b3b7b..bc91550 100644
> --- a/gcc/jump.c
> +++ b/gcc/jump.c
> @@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
>           && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
>  }
>
> -#ifdef HAVE_cc0
> -
>  /* Return nonzero if X is an RTX that only sets the condition codes
>     and has no side effects.  */
>
> @@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
>      }
>    return 0;
>  }
> -#endif
>
>  /* Find all CODE_LABELs referred to in X, and increment their use
>     counts.  If INSN is a JUMP_INSN and there is at least one
> diff --git a/gcc/recog.c b/gcc/recog.c
> index a9d3b1f..c3ad86f 100644
> --- a/gcc/recog.c
> +++ b/gcc/recog.c
> @@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
>    return ((num_changes_pending () > 0) && (apply_change_group () > 0));
>  }
>
> -#ifdef HAVE_cc0
>  /* Return 1 if the insn using CC0 set by INSN does not contain
>     any ordered tests applied to the condition codes.
>     EQ and NE tests do not count.  */
> @@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
>    return (INSN_P (next)
>           && ! inequality_comparisons_p (PATTERN (next)));
>  }
> -#endif
>
>  /* Return 1 if OP is a valid general operand for machine mode MODE.
>     This is either a register reference, a memory reference,
> diff --git a/gcc/recog.h b/gcc/recog.h
> index 45ea671..8a38b26 100644
> --- a/gcc/recog.h
> +++ b/gcc/recog.h
> @@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
>  extern void validate_replace_src_group (rtx, rtx, rtx);
>  extern bool validate_simplify_insn (rtx insn);
>  extern int num_changes_pending (void);
> -#ifdef HAVE_cc0
>  extern int next_insn_tests_no_inequality (rtx);
> -#endif
>  extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
>
>  extern int offsettable_memref_p (rtx);
> diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
> index 5434831..31de6be 100644
> --- a/gcc/sched-deps.c
> +++ b/gcc/sched-deps.c
> @@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
>
>        return;
>
> -#ifdef HAVE_cc0
>      case CC0:
> +#ifdef HAVE_cc0

#ifndef ?

> +      gcc_unreachable ();
> +#endif
>        /* User of CC0 depends on immediately preceding insn.  */
>        SCHED_GROUP_P (insn) = 1;
>         /* Don't move CC0 setter to another block (it can set up the
> @@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
>         sched_deps_info->finish_rhs ();
>
>        return;
> -#endif
>
>      case REG:
>        {
> --
> 2.3.0.80.g18d0fec.dirty
>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 04/12] always define HAVE_cc0
  2015-04-21 13:53   ` Jeff Law
@ 2015-04-21 15:18     ` Trevor Saunders
  0 siblings, 0 replies; 46+ messages in thread
From: Trevor Saunders @ 2015-04-21 15:18 UTC (permalink / raw)
  To: Jeff Law; +Cc: tbsaunde+gcc, gcc-patches

On Tue, Apr 21, 2015 at 07:53:05AM -0600, Jeff Law wrote:
> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> >gcc/ChangeLog:
> >
> >2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >	* genconfig.c (main): Always define HAVE_cc0.
> >	* caller-save.c (insert_one_insn): Change ifdef HAVE_cc0 to #if
> >	HAVE_cc0.
> >	* cfgcleanup.c (flow_find_cross_jump): Likewise.
> >	(flow_find_head_matching_sequence): Likewise.
> >	(try_head_merge_bb): Likewise.
> >	* cfgrtl.c (rtl_merge_blocks): Likewise.
> >	(try_redirect_by_replacing_jump): Likewise.
> >	(rtl_tidy_fallthru_edge): Likewise.
> >	* combine.c (do_SUBST_MODE): Likewise.
> >	(insn_a_feeds_b): Likewise.
> >	(combine_instructions): Likewise.
> >	(can_combine_p): Likewise.
> >	(try_combine): Likewise.
> >	(find_split_point): Likewise.
> >	(subst): Likewise.
> >	(simplify_set): Likewise.
> >	(distribute_notes): Likewise.
> >	* cprop.c (cprop_jump): Likewise.
> >	* cse.c (cse_extended_basic_block): Likewise.
> >	* df-problems.c (can_move_insns_across): Likewise.
> >	* final.c (final): Likewise.
> >	(final_scan_insn): Likewise.
> >	* function.c (emit_use_return_register_into_block): Likewise.
> >	* gcse.c (insert_insn_end_basic_block): Likewise.
> >	* haifa-sched.c (sched_init): Likewise.
> >	* ira.c (find_moveable_pseudos): Likewise.
> >	* loop-invariant.c (find_invariant_insn): Likewise.
> >	* lra-constraints.c (curr_insn_transform): Likewise.
> >	* optabs.c (prepare_cmp_insn): Likewise.
> >	* postreload.c (reload_combine_recognize_const_pattern):
> >	* Likewise.
> >	* reload.c (find_reloads): Likewise.
> >	(find_reloads_address_1): Likewise.
> >	* reorg.c (delete_scheduled_jump): Likewise.
> >	(steal_delay_list_from_target): Likewise.
> >	(steal_delay_list_from_fallthrough): Likewise.
> >	(try_merge_delay_insns): Likewise.
> >	(redundant_insn): Likewise.
> >	(fill_simple_delay_slots): Likewise.
> >	(fill_slots_from_thread): Likewise.
> >	(delete_computation): Likewise.
> >	(relax_delay_slots): Likewise.
> >	* sched-deps.c (sched_analyze_2): Likewise.
> >	* sched-rgn.c (add_branch_dependences): Likewise.
> Doesn't go as far as I'd like, but it's still an improvement.

Yeah, this one really just enables other nice things.  I really dislike
big patches since there's invariably something wrong somewhere and if
you don't really know the code in question it can be next to impossible
to figure out where the problem is.

Trev

> 
> OK.
> 
> jeff
> 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-21 14:14   ` Richard Biener
@ 2015-04-21 15:24     ` Trevor Saunders
  2015-04-23  3:28       ` James Greenhalgh
  0 siblings, 1 reply; 46+ messages in thread
From: Trevor Saunders @ 2015-04-21 15:24 UTC (permalink / raw)
  To: Richard Biener; +Cc: tbsaunde+gcc, GCC Patches

On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> > gcc/ChangeLog:
> >
> > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> >         * final.c: Likewise.
> >         * jump.c: Likewise.
> >         * recog.c: Likewise.
> >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> > ---
> >  gcc/conditions.h | 6 ------
> >  gcc/emit-rtl.c   | 2 --
> >  gcc/final.c      | 2 --
> >  gcc/jump.c       | 3 ---
> >  gcc/recog.c      | 2 --
> >  gcc/recog.h      | 2 --
> >  gcc/sched-deps.c | 5 +++--
> >  7 files changed, 3 insertions(+), 19 deletions(-)
> >
> > diff --git a/gcc/conditions.h b/gcc/conditions.h
> > index 2308bfc..7cd1e1c 100644
> > --- a/gcc/conditions.h
> > +++ b/gcc/conditions.h
> > @@ -20,10 +20,6 @@ along with GCC; see the file COPYING3.  If not see
> >  #ifndef GCC_CONDITIONS_H
> >  #define GCC_CONDITIONS_H
> >
> > -/* None of the things in the files exist if we don't use CC0.  */
> > -
> > -#ifdef HAVE_cc0
> > -
> >  /* The variable cc_status says how to interpret the condition code.
> >     It is set by output routines for an instruction that sets the cc's
> >     and examined by output routines for jump instructions.
> > @@ -117,6 +113,4 @@ extern CC_STATUS cc_status;
> >   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
> >    CC_STATUS_MDEP_INIT)
> >
> > -#endif
> > -
> >  #endif /* GCC_CONDITIONS_H */
> > diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> > index 483eacb..c1974bb 100644
> > --- a/gcc/emit-rtl.c
> > +++ b/gcc/emit-rtl.c
> > @@ -3541,7 +3541,6 @@ prev_active_insn (rtx uncast_insn)
> >    return insn;
> >  }
> >
> > -#ifdef HAVE_cc0
> >  /* Return the next insn that uses CC0 after INSN, which is assumed to
> >     set it.  This is the inverse of prev_cc0_setter (i.e., prev_cc0_setter
> >     applied to the result of this function should yield INSN).
> > @@ -3589,7 +3588,6 @@ prev_cc0_setter (rtx uncast_insn)
> >
> >    return insn;
> >  }
> > -#endif
> >
> >  #ifdef AUTO_INC_DEC
> >  /* Find a RTX_AUTOINC class rtx which matches DATA.  */
> > diff --git a/gcc/final.c b/gcc/final.c
> > index 1fa93d9..41f6bd9 100644
> > --- a/gcc/final.c
> > +++ b/gcc/final.c
> > @@ -191,7 +191,6 @@ static rtx last_ignored_compare = 0;
> >
> >  static int insn_counter = 0;
> >
> > -#ifdef HAVE_cc0
> >  /* This variable contains machine-dependent flags (defined in tm.h)
> >     set and examined by output routines
> >     that describe how to interpret the condition codes properly.  */
> > @@ -202,7 +201,6 @@ CC_STATUS cc_status;
> >     from before the insn.  */
> >
> >  CC_STATUS cc_prev_status;
> > -#endif
> >
> >  /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
> >
> > diff --git a/gcc/jump.c b/gcc/jump.c
> > index 34b3b7b..bc91550 100644
> > --- a/gcc/jump.c
> > +++ b/gcc/jump.c
> > @@ -1044,8 +1044,6 @@ jump_to_label_p (const rtx_insn *insn)
> >           && JUMP_LABEL (insn) != NULL && !ANY_RETURN_P (JUMP_LABEL (insn)));
> >  }
> >
> > -#ifdef HAVE_cc0
> > -
> >  /* Return nonzero if X is an RTX that only sets the condition codes
> >     and has no side effects.  */
> >
> > @@ -1094,7 +1092,6 @@ sets_cc0_p (const_rtx x)
> >      }
> >    return 0;
> >  }
> > -#endif
> >
> >  /* Find all CODE_LABELs referred to in X, and increment their use
> >     counts.  If INSN is a JUMP_INSN and there is at least one
> > diff --git a/gcc/recog.c b/gcc/recog.c
> > index a9d3b1f..c3ad86f 100644
> > --- a/gcc/recog.c
> > +++ b/gcc/recog.c
> > @@ -971,7 +971,6 @@ validate_simplify_insn (rtx insn)
> >    return ((num_changes_pending () > 0) && (apply_change_group () > 0));
> >  }
> >
> > -#ifdef HAVE_cc0
> >  /* Return 1 if the insn using CC0 set by INSN does not contain
> >     any ordered tests applied to the condition codes.
> >     EQ and NE tests do not count.  */
> > @@ -988,7 +987,6 @@ next_insn_tests_no_inequality (rtx insn)
> >    return (INSN_P (next)
> >           && ! inequality_comparisons_p (PATTERN (next)));
> >  }
> > -#endif
> >
> >  /* Return 1 if OP is a valid general operand for machine mode MODE.
> >     This is either a register reference, a memory reference,
> > diff --git a/gcc/recog.h b/gcc/recog.h
> > index 45ea671..8a38b26 100644
> > --- a/gcc/recog.h
> > +++ b/gcc/recog.h
> > @@ -112,9 +112,7 @@ extern void validate_replace_rtx_group (rtx, rtx, rtx);
> >  extern void validate_replace_src_group (rtx, rtx, rtx);
> >  extern bool validate_simplify_insn (rtx insn);
> >  extern int num_changes_pending (void);
> > -#ifdef HAVE_cc0
> >  extern int next_insn_tests_no_inequality (rtx);
> > -#endif
> >  extern bool reg_fits_class_p (const_rtx, reg_class_t, int, machine_mode);
> >
> >  extern int offsettable_memref_p (rtx);
> > diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
> > index 5434831..31de6be 100644
> > --- a/gcc/sched-deps.c
> > +++ b/gcc/sched-deps.c
> > @@ -2608,8 +2608,10 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
> >
> >        return;
> >
> > -#ifdef HAVE_cc0
> >      case CC0:
> > +#ifdef HAVE_cc0
> 
> #ifndef ?

yeah, good catch thanks!

Trev

> 
> > +      gcc_unreachable ();
> > +#endif
> >        /* User of CC0 depends on immediately preceding insn.  */
> >        SCHED_GROUP_P (insn) = 1;
> >         /* Don't move CC0 setter to another block (it can set up the
> > @@ -2620,7 +2622,6 @@ sched_analyze_2 (struct deps_desc *deps, rtx x, rtx_insn *insn)
> >         sched_deps_info->finish_rhs ();
> >
> >        return;
> > -#endif
> >
> >      case REG:
> >        {
> > --
> > 2.3.0.80.g18d0fec.dirty
> >

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 03/12] more removal of ifdef HAVE_cc0
  2015-04-21 13:51   ` Jeff Law
@ 2015-04-21 15:24     ` Trevor Saunders
  0 siblings, 0 replies; 46+ messages in thread
From: Trevor Saunders @ 2015-04-21 15:24 UTC (permalink / raw)
  To: Jeff Law; +Cc: tbsaunde+gcc, gcc-patches

On Tue, Apr 21, 2015 at 07:51:14AM -0600, Jeff Law wrote:
> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> >gcc/ChangeLog:
> >
> >2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >
> >	* combine.c (find_single_use): Remove HAVE_cc0 ifdef for code
> >	that is trivially ded on non cc0 targets.
> >	(simplify_set): Likewise.
> >	(mark_used_regs_combine): Likewise.
> >	* cse.c (new_basic_block): Likewise.
> >	(fold_rtx): Likewise.
> >	(cse_insn): Likewise.
> >	(cse_extended_basic_block): Likewise.
> >	(set_live_p): Likewise.
> >	* rtlanal.c (canonicalize_condition): Likewise.
> >	* simplify-rtx.c (simplify_binary_operation_1): Likewise.
> OK.  I find myself wondering if the conditionals should look like
> if (HAVE_cc0
>     && (whatever))
> 
> But I doubt it makes any measurable difference.  It's something we can
> always add in the future if we feel the need to avoid the runtime checks for
> things that aren't ever going to happen on most modern targets.

 yeah, it seems reasonably likely the branch predictor can deal with
 this for us (I tried to ensure things handled this way didn't do much
 other than a compare).  If not well that's what profiling is for :-)

 Trev

> 
> jeff
> 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-21 13:57 ` Jeff Law
@ 2015-04-21 15:29   ` Trevor Saunders
  2015-04-22 18:19     ` David Malcolm
  0 siblings, 1 reply; 46+ messages in thread
From: Trevor Saunders @ 2015-04-21 15:29 UTC (permalink / raw)
  To: Jeff Law; +Cc: tbsaunde+gcc, gcc-patches

On Tue, Apr 21, 2015 at 07:57:19AM -0600, Jeff Law wrote:
> On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >
> >Hi,
> >
> >This is a first round of patches to reduce the amount of code with in #if /
> >#ifdef.  This makes it incrementally easier to not break configs other than the
> >one being built, and moves things slightly closer to using target hooks for
> >everything.
> >
> >each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
> >and whole patch set run through config-list.mk without issue, ok?
> So I think after looking at this patchset, any changes of a similar nature
> you want to make should be considered pre-approved.  Just post them for
> archival purposes, but no need for you to wait for review as long as they
> have the same purpose and overall structure as was seen in these patches.

thanks!  Its also always nice to have someone double check your logic
:-)

Trev

> 
> jeff
> 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-21 15:29   ` Trevor Saunders
@ 2015-04-22 18:19     ` David Malcolm
  2015-04-22 18:37       ` Jeff Law
  0 siblings, 1 reply; 46+ messages in thread
From: David Malcolm @ 2015-04-22 18:19 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: Jeff Law, tbsaunde+gcc, gcc-patches

On Tue, 2015-04-21 at 11:29 -0400, Trevor Saunders wrote:
> On Tue, Apr 21, 2015 at 07:57:19AM -0600, Jeff Law wrote:
> > On 04/21/2015 07:24 AM, tbsaunde+gcc@tbsaunde.org wrote:
> > >From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > >
> > >Hi,
> > >
> > >This is a first round of patches to reduce the amount of code with in #if /
> > >#ifdef.  This makes it incrementally easier to not break configs other than the
> > >one being built, and moves things slightly closer to using target hooks for
> > >everything.
> > >
> > >each commit bootstrapped and regtested on x86_64-linux-gnu without regression,
> > >and whole patch set run through config-list.mk without issue, ok?
> > So I think after looking at this patchset, any changes of a similar nature
> > you want to make should be considered pre-approved.  Just post them for
> > archival purposes, but no need for you to wait for review as long as they
> > have the same purpose and overall structure as was seen in these patches.
> 
> thanks!  Its also always nice to have someone double check your logic
> :-)

Thanks for working on this!

Conditional compilation was a major PITA when doing the rtx->rtx_insn *
work last year, so I'm very pleased to see these cleanups go in.

Dave

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-22 18:19     ` David Malcolm
@ 2015-04-22 18:37       ` Jeff Law
  2015-04-22 20:46         ` Trevor Saunders
  0 siblings, 1 reply; 46+ messages in thread
From: Jeff Law @ 2015-04-22 18:37 UTC (permalink / raw)
  To: David Malcolm, Trevor Saunders; +Cc: tbsaunde+gcc, gcc-patches

On 04/22/2015 12:13 PM, David Malcolm wrote:

>
> Conditional compilation was a major PITA when doing the rtx->rtx_insn *
> work last year, so I'm very pleased to see these cleanups go in.
Yup.  It also got in Andrew's way last year and we regularly see cases 
where small patches which work fine on the mainstream architectures fail 
to build in the lesser used architectures (particularly cc0 targets). 
It's a whole class of problems I want to see slowly disappear.

glibc went through this process in their codebase for similar reasons, 
but they had more to lose when they got it wrong -- IIRC they had a case 
where exported ABI would differ as a result of conditionally compiled 
code.  Not good.

Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-22 18:37       ` Jeff Law
@ 2015-04-22 20:46         ` Trevor Saunders
  2015-04-22 20:47           ` Jeff Law
  0 siblings, 1 reply; 46+ messages in thread
From: Trevor Saunders @ 2015-04-22 20:46 UTC (permalink / raw)
  To: Jeff Law; +Cc: David Malcolm, tbsaunde+gcc, gcc-patches

On Wed, Apr 22, 2015 at 12:36:58PM -0600, Jeff Law wrote:
> On 04/22/2015 12:13 PM, David Malcolm wrote:
> 
> >
> >Conditional compilation was a major PITA when doing the rtx->rtx_insn *
> >work last year, so I'm very pleased to see these cleanups go in.
> Yup.  It also got in Andrew's way last year and we regularly see cases where
> small patches which work fine on the mainstream architectures fail to build
> in the lesser used architectures (particularly cc0 targets). It's a whole
> class of problems I want to see slowly disappear.

yeah, its irritated me on a number of occasions too.  I'd really like it
if building config-list.mk could be faster, but that's a much bigger
project, but at least if everything is target hooks maybe ccache can
kick in some.

Trev

> 
> glibc went through this process in their codebase for similar reasons, but
> they had more to lose when they got it wrong -- IIRC they had a case where
> exported ABI would differ as a result of conditionally compiled code.  Not
> good.
> 
> Jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 00/12] Reduce conditional compilation
  2015-04-22 20:46         ` Trevor Saunders
@ 2015-04-22 20:47           ` Jeff Law
  0 siblings, 0 replies; 46+ messages in thread
From: Jeff Law @ 2015-04-22 20:47 UTC (permalink / raw)
  To: Trevor Saunders; +Cc: David Malcolm, tbsaunde+gcc, gcc-patches

On 04/22/2015 02:46 PM, Trevor Saunders wrote:
> yeah, its irritated me on a number of occasions too.  I'd really like it
> if building config-list.mk could be faster, but that's a much bigger
> project, but at least if everything is target hooks maybe ccache can
> kick in some.
I don't see ccache kicking in here because the target .h files get 
included most of the time.

Maybe one day that won't be the case :-)

jeff

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-21 15:24     ` Trevor Saunders
@ 2015-04-23  3:28       ` James Greenhalgh
  2015-04-23  4:55         ` Trevor Saunders
  0 siblings, 1 reply; 46+ messages in thread
From: James Greenhalgh @ 2015-04-23  3:28 UTC (permalink / raw)
  To: Trevor Saunders
  Cc: Richard Biener, tbsaunde+gcc, GCC Patches, Richard Earnshaw,
	Ramana Radhakrishnan, Kyrylo Tkachov, nickc, Bin Cheng

On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > >
> > > gcc/ChangeLog:
> > >
> > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > >
> > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> > >         * final.c: Likewise.
> > >         * jump.c: Likewise.
> > >         * recog.c: Likewise.
> > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.

If I've counted right after the git bisect, this patch seems to break
the ARM buildi (arm-none-linux-gnueabihf):

  In file included from insn-output.c:40:0:
  ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
   #define CC_STATUS_INIT  \
   ^
  In file included from tm.h:35:0,
                   from insn-output.c:7:
  ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
   #define CC_STATUS_INIT \
   ^

I guess the conditions.h definition wants wrapping in #ifndef - though a
quick grep suggests that ARM is the only target defining CC_STATUS_INIT
so lets CC the ARM maintainers and see what their preference is...

Thanks,
James

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  3:28       ` James Greenhalgh
@ 2015-04-23  4:55         ` Trevor Saunders
  2015-04-23  8:35           ` Richard Biener
  0 siblings, 1 reply; 46+ messages in thread
From: Trevor Saunders @ 2015-04-23  4:55 UTC (permalink / raw)
  To: James Greenhalgh
  Cc: Richard Biener, tbsaunde+gcc, GCC Patches, Richard Earnshaw,
	Ramana Radhakrishnan, Kyrylo Tkachov, nickc, Bin Cheng, bernds

On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
> > On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> > > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> > > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> > > >
> > > > gcc/ChangeLog:
> > > >
> > > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> > > >
> > > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
> > > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> > > >         * final.c: Likewise.
> > > >         * jump.c: Likewise.
> > > >         * recog.c: Likewise.
> > > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
> > > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> 
> If I've counted right after the git bisect, this patch seems to break
> the ARM buildi (arm-none-linux-gnueabihf):
> 
>   In file included from insn-output.c:40:0:
>   ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>    #define CC_STATUS_INIT  \
>    ^
>   In file included from tm.h:35:0,
>                    from insn-output.c:7:
>   ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>    #define CC_STATUS_INIT \
>    ^
> 
> I guess the conditions.h definition wants wrapping in #ifndef - though a
> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
> so lets CC the ARM maintainers and see what their preference is...

Well, that seems pretty weird, but it looks intentional arm does this
see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html

Of course I now see final.c also defines a fall back, so maybe the right
thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
maybe the final.c definition can go away? Right now I'm to tired to make
a good decision about that.

sorry about the bustage!

Trev

 
> 
> Thanks,
> James

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  4:55         ` Trevor Saunders
@ 2015-04-23  8:35           ` Richard Biener
  2015-04-23  8:41             ` Kyrill Tkachov
  0 siblings, 1 reply; 46+ messages in thread
From: Richard Biener @ 2015-04-23  8:35 UTC (permalink / raw)
  To: Trevor Saunders
  Cc: James Greenhalgh, tbsaunde+gcc, GCC Patches, Richard Earnshaw,
	Ramana Radhakrishnan, Kyrylo Tkachov, Nick Clifton, Bin Cheng,
	Bernd Schmidt

On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>> > On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>> > > On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>> > > > From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>> > > >
>> > > > gcc/ChangeLog:
>> > > >
>> > > > 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>> > > >
>> > > >         * conditions.h: Define macros even if HAVE_cc0 is undefined.
>> > > >         * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>> > > >         * final.c: Likewise.
>> > > >         * jump.c: Likewise.
>> > > >         * recog.c: Likewise.
>> > > >         * recog.h: Declare functions even when HAVE_cc0 is undefined.
>> > > >         * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>
>> If I've counted right after the git bisect, this patch seems to break
>> the ARM buildi (arm-none-linux-gnueabihf):
>>
>>   In file included from insn-output.c:40:0:
>>   ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>    #define CC_STATUS_INIT  \
>>    ^
>>   In file included from tm.h:35:0,
>>                    from insn-output.c:7:
>>   ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>    #define CC_STATUS_INIT \
>>    ^
>>
>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>> so lets CC the ARM maintainers and see what their preference is...
>
> Well, that seems pretty weird, but it looks intentional arm does this
> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>
> Of course I now see final.c also defines a fall back, so maybe the right
> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
> maybe the final.c definition can go away? Right now I'm to tired to make
> a good decision about that.
>
> sorry about the bustage!

Looks like the best thing is to turn this into a target hook then?  Or move the
fallback/default to defaults.h

Richard.

> Trev
>
>
>>
>> Thanks,
>> James

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  8:35           ` Richard Biener
@ 2015-04-23  8:41             ` Kyrill Tkachov
  2015-04-23  9:08               ` Richard Earnshaw
  0 siblings, 1 reply; 46+ messages in thread
From: Kyrill Tkachov @ 2015-04-23  8:41 UTC (permalink / raw)
  To: Richard Biener, Trevor Saunders
  Cc: James Greenhalgh, tbsaunde+gcc, GCC Patches, Richard Earnshaw,
	Ramana Radhakrishnan, nickc, Bin Cheng, Bernd Schmidt


On 23/04/15 09:35, Richard Biener wrote:
> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>
>>>>>> gcc/ChangeLog:
>>>>>>
>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>
>>>>>>          * conditions.h: Define macros even if HAVE_cc0 is undefined.
>>>>>>          * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>>>>>>          * final.c: Likewise.
>>>>>>          * jump.c: Likewise.
>>>>>>          * recog.c: Likewise.
>>>>>>          * recog.h: Declare functions even when HAVE_cc0 is undefined.
>>>>>>          * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>> If I've counted right after the git bisect, this patch seems to break
>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>
>>>    In file included from insn-output.c:40:0:
>>>    ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>>     #define CC_STATUS_INIT  \

This is a warning-to-error from -Werror, so this came out during bootstrap
rather than a cross-build, right?


>>>     ^
>>>    In file included from tm.h:35:0,
>>>                     from insn-output.c:7:
>>>    ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>>     #define CC_STATUS_INIT \
>>>     ^
>>>
>>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>>> so lets CC the ARM maintainers and see what their preference is...
>> Well, that seems pretty weird, but it looks intentional arm does this
>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>
>> Of course I now see final.c also defines a fall back, so maybe the right
>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>> maybe the final.c definition can go away? Right now I'm to tired to make
>> a good decision about that.
>>
>> sorry about the bustage!
> Looks like the best thing is to turn this into a target hook then?  Or move the
> fallback/default to defaults.h

Shall we revert this patch for now then to restore bootstrap?

Kyrill

>
> Richard.
>
>> Trev
>>
>>
>>> Thanks,
>>> James

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  8:41             ` Kyrill Tkachov
@ 2015-04-23  9:08               ` Richard Earnshaw
  2015-04-23  9:58                 ` Kyrill Tkachov
  0 siblings, 1 reply; 46+ messages in thread
From: Richard Earnshaw @ 2015-04-23  9:08 UTC (permalink / raw)
  To: Kyrill Tkachov, Richard Biener, Trevor Saunders
  Cc: James Greenhalgh, tbsaunde+gcc, GCC Patches,
	Ramana Radhakrishnan, nickc, Bin Cheng, Bernd Schmidt

On 23/04/15 09:41, Kyrill Tkachov wrote:
> 
> On 23/04/15 09:35, Richard Biener wrote:
>> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>>
>>>>>>> gcc/ChangeLog:
>>>>>>>
>>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>>
>>>>>>>          * conditions.h: Define macros even if HAVE_cc0 is undefined.
>>>>>>>          * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>>>>>>>          * final.c: Likewise.
>>>>>>>          * jump.c: Likewise.
>>>>>>>          * recog.c: Likewise.
>>>>>>>          * recog.h: Declare functions even when HAVE_cc0 is undefined.
>>>>>>>          * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>>> If I've counted right after the git bisect, this patch seems to break
>>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>>
>>>>    In file included from insn-output.c:40:0:
>>>>    ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>>>     #define CC_STATUS_INIT  \
> 
> This is a warning-to-error from -Werror, so this came out during bootstrap
> rather than a cross-build, right?
> 
> 
>>>>     ^
>>>>    In file included from tm.h:35:0,
>>>>                     from insn-output.c:7:
>>>>    ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>>>     #define CC_STATUS_INIT \
>>>>     ^
>>>>
>>>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>>>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>>>> so lets CC the ARM maintainers and see what their preference is...
>>> Well, that seems pretty weird, but it looks intentional arm does this
>>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>>
>>> Of course I now see final.c also defines a fall back, so maybe the right
>>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>>> maybe the final.c definition can go away? Right now I'm to tired to make
>>> a good decision about that.
>>>
>>> sorry about the bustage!
>> Looks like the best thing is to turn this into a target hook then?  Or move the
>> fallback/default to defaults.h
> 
> Shall we revert this patch for now then to restore bootstrap?
> 

Isn't the most constructive temporary fix to just wrap the definition in
conditions.h with #ifndef CC_STATUS_INIT?

R.

> Kyrill
> 
>>
>> Richard.
>>
>>> Trev
>>>
>>>
>>>> Thanks,
>>>> James
> 

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  9:08               ` Richard Earnshaw
@ 2015-04-23  9:58                 ` Kyrill Tkachov
  2015-04-23 10:30                   ` Richard Biener
  2015-04-23 12:01                   ` Trevor Saunders
  0 siblings, 2 replies; 46+ messages in thread
From: Kyrill Tkachov @ 2015-04-23  9:58 UTC (permalink / raw)
  To: Richard Earnshaw, Richard Biener, Trevor Saunders
  Cc: James Greenhalgh, tbsaunde+gcc, GCC Patches,
	Ramana Radhakrishnan, nickc, Bin Cheng, Bernd Schmidt

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


On 23/04/15 10:08, Richard Earnshaw wrote:
> On 23/04/15 09:41, Kyrill Tkachov wrote:
>> On 23/04/15 09:35, Richard Biener wrote:
>>> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
>>>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>>>
>>>>>>>> gcc/ChangeLog:
>>>>>>>>
>>>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>>>
>>>>>>>>           * conditions.h: Define macros even if HAVE_cc0 is undefined.
>>>>>>>>           * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
>>>>>>>>           * final.c: Likewise.
>>>>>>>>           * jump.c: Likewise.
>>>>>>>>           * recog.c: Likewise.
>>>>>>>>           * recog.h: Declare functions even when HAVE_cc0 is undefined.
>>>>>>>>           * sched-deps.c (sched_analyze_2): Always compile case for cc0.
>>>>> If I've counted right after the git bisect, this patch seems to break
>>>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>>>
>>>>>     In file included from insn-output.c:40:0:
>>>>>     ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
>>>>>      #define CC_STATUS_INIT  \
>> This is a warning-to-error from -Werror, so this came out during bootstrap
>> rather than a cross-build, right?
>>
>>
>>>>>      ^
>>>>>     In file included from tm.h:35:0,
>>>>>                      from insn-output.c:7:
>>>>>     ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
>>>>>      #define CC_STATUS_INIT \
>>>>>      ^
>>>>>
>>>>> I guess the conditions.h definition wants wrapping in #ifndef - though a
>>>>> quick grep suggests that ARM is the only target defining CC_STATUS_INIT
>>>>> so lets CC the ARM maintainers and see what their preference is...
>>>> Well, that seems pretty weird, but it looks intentional arm does this
>>>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>>>
>>>> Of course I now see final.c also defines a fall back, so maybe the right
>>>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>>>> maybe the final.c definition can go away? Right now I'm to tired to make
>>>> a good decision about that.
>>>>
>>>> sorry about the bustage!
>>> Looks like the best thing is to turn this into a target hook then?  Or move the
>>> fallback/default to defaults.h
>> Shall we revert this patch for now then to restore bootstrap?
>>
> Isn't the most constructive temporary fix to just wrap the definition in
> conditions.h with #ifndef CC_STATUS_INIT?

Like this?
Ok for trunk as a temporary fix?

Thanks,
Kyrill

2015-04-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * conditions.h (CC_STATUS_INIT): Gate on #ifndef CC_STATUS_INIT.
> R.
>
>> Kyrill
>>
>>> Richard.
>>>
>>>> Trev
>>>>
>>>>
>>>>> Thanks,
>>>>> James


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: conditions-cc-status-init.patch --]
[-- Type: text/x-patch; name=conditions-cc-status-init.patch, Size: 533 bytes --]

diff --git a/gcc/conditions.h b/gcc/conditions.h
index 7cd1e1c..0bda9a4 100644
--- a/gcc/conditions.h
+++ b/gcc/conditions.h
@@ -109,8 +109,10 @@ extern CC_STATUS cc_status;
 /* This is how to initialize the variable cc_status.
    final does this at appropriate moments.  */
 
+/* FIXME: We want to get rid of these ifndefs.  */
+#ifndef CC_STATUS_INIT
 #define CC_STATUS_INIT  \
  (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
   CC_STATUS_MDEP_INIT)
-
+#endif
 #endif /* GCC_CONDITIONS_H */

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  9:58                 ` Kyrill Tkachov
@ 2015-04-23 10:30                   ` Richard Biener
  2015-04-23 12:01                   ` Trevor Saunders
  1 sibling, 0 replies; 46+ messages in thread
From: Richard Biener @ 2015-04-23 10:30 UTC (permalink / raw)
  To: Kyrill Tkachov
  Cc: Richard Earnshaw, Trevor Saunders, James Greenhalgh,
	tbsaunde+gcc, GCC Patches, Ramana Radhakrishnan, nickc,
	Bin Cheng, Bernd Schmidt

On Thu, Apr 23, 2015 at 11:58 AM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
>
> On 23/04/15 10:08, Richard Earnshaw wrote:
>>
>> On 23/04/15 09:41, Kyrill Tkachov wrote:
>>>
>>> On 23/04/15 09:35, Richard Biener wrote:
>>>>
>>>> On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org>
>>>> wrote:
>>>>>
>>>>> On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
>>>>>>
>>>>>> On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
>>>>>>>
>>>>>>> On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
>>>>>>>>
>>>>>>>> On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
>>>>>>>>>
>>>>>>>>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>>>>>>>>
>>>>>>>>> gcc/ChangeLog:
>>>>>>>>>
>>>>>>>>> 2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
>>>>>>>>>
>>>>>>>>>           * conditions.h: Define macros even if HAVE_cc0 is
>>>>>>>>> undefined.
>>>>>>>>>           * emit-rtl.c: Define functions even if HAVE_cc0 is
>>>>>>>>> undefined.
>>>>>>>>>           * final.c: Likewise.
>>>>>>>>>           * jump.c: Likewise.
>>>>>>>>>           * recog.c: Likewise.
>>>>>>>>>           * recog.h: Declare functions even when HAVE_cc0 is
>>>>>>>>> undefined.
>>>>>>>>>           * sched-deps.c (sched_analyze_2): Always compile case for
>>>>>>>>> cc0.
>>>>>>
>>>>>> If I've counted right after the git bisect, this patch seems to break
>>>>>> the ARM buildi (arm-none-linux-gnueabihf):
>>>>>>
>>>>>>     In file included from insn-output.c:40:0:
>>>>>>     ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT"
>>>>>> redefined [-Werror]
>>>>>>      #define CC_STATUS_INIT  \
>>>
>>> This is a warning-to-error from -Werror, so this came out during
>>> bootstrap
>>> rather than a cross-build, right?
>>>
>>>
>>>>>>      ^
>>>>>>     In file included from tm.h:35:0,
>>>>>>                      from insn-output.c:7:
>>>>>>     ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the
>>>>>> location of the previous definition
>>>>>>      #define CC_STATUS_INIT \
>>>>>>      ^
>>>>>>
>>>>>> I guess the conditions.h definition wants wrapping in #ifndef - though
>>>>>> a
>>>>>> quick grep suggests that ARM is the only target defining
>>>>>> CC_STATUS_INIT
>>>>>> so lets CC the ARM maintainers and see what their preference is...
>>>>>
>>>>> Well, that seems pretty weird, but it looks intentional arm does this
>>>>> see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
>>>>>
>>>>> Of course I now see final.c also defines a fall back, so maybe the
>>>>> right
>>>>> thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
>>>>> maybe the final.c definition can go away? Right now I'm to tired to
>>>>> make
>>>>> a good decision about that.
>>>>>
>>>>> sorry about the bustage!
>>>>
>>>> Looks like the best thing is to turn this into a target hook then?  Or
>>>> move the
>>>> fallback/default to defaults.h
>>>
>>> Shall we revert this patch for now then to restore bootstrap?
>>>
>> Isn't the most constructive temporary fix to just wrap the definition in
>> conditions.h with #ifndef CC_STATUS_INIT?
>
>
> Like this?
> Ok for trunk as a temporary fix?

Ok.

Richard.

> Thanks,
> Kyrill
>
> 2015-04-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * conditions.h (CC_STATUS_INIT): Gate on #ifndef CC_STATUS_INIT.
>
>> R.
>>
>>> Kyrill
>>>
>>>> Richard.
>>>>
>>>>> Trev
>>>>>
>>>>>
>>>>>> Thanks,
>>>>>> James
>
>

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [PATCH 02/12] remove some ifdef HAVE_cc0
  2015-04-23  9:58                 ` Kyrill Tkachov
  2015-04-23 10:30                   ` Richard Biener
@ 2015-04-23 12:01                   ` Trevor Saunders
  1 sibling, 0 replies; 46+ messages in thread
From: Trevor Saunders @ 2015-04-23 12:01 UTC (permalink / raw)
  To: Kyrill Tkachov
  Cc: Richard Earnshaw, Richard Biener, James Greenhalgh, tbsaunde+gcc,
	GCC Patches, Ramana Radhakrishnan, nickc, Bin Cheng,
	Bernd Schmidt

On Thu, Apr 23, 2015 at 10:58:22AM +0100, Kyrill Tkachov wrote:
> 
> On 23/04/15 10:08, Richard Earnshaw wrote:
> >On 23/04/15 09:41, Kyrill Tkachov wrote:
> >>On 23/04/15 09:35, Richard Biener wrote:
> >>>On Thu, Apr 23, 2015 at 6:54 AM, Trevor Saunders <tbsaunde@tbsaunde.org> wrote:
> >>>>On Thu, Apr 23, 2015 at 04:27:59AM +0100, James Greenhalgh wrote:
> >>>>>On Tue, Apr 21, 2015 at 04:24:44PM +0100, Trevor Saunders wrote:
> >>>>>>On Tue, Apr 21, 2015 at 04:14:01PM +0200, Richard Biener wrote:
> >>>>>>>On Tue, Apr 21, 2015 at 3:24 PM,  <tbsaunde+gcc@tbsaunde.org> wrote:
> >>>>>>>>From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
> >>>>>>>>
> >>>>>>>>gcc/ChangeLog:
> >>>>>>>>
> >>>>>>>>2015-04-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
> >>>>>>>>
> >>>>>>>>          * conditions.h: Define macros even if HAVE_cc0 is undefined.
> >>>>>>>>          * emit-rtl.c: Define functions even if HAVE_cc0 is undefined.
> >>>>>>>>          * final.c: Likewise.
> >>>>>>>>          * jump.c: Likewise.
> >>>>>>>>          * recog.c: Likewise.
> >>>>>>>>          * recog.h: Declare functions even when HAVE_cc0 is undefined.
> >>>>>>>>          * sched-deps.c (sched_analyze_2): Always compile case for cc0.
> >>>>>If I've counted right after the git bisect, this patch seems to break
> >>>>>the ARM buildi (arm-none-linux-gnueabihf):
> >>>>>
> >>>>>    In file included from insn-output.c:40:0:
> >>>>>    ..../gcc-src/gcc/conditions.h:112:0: error: "CC_STATUS_INIT" redefined [-Werror]
> >>>>>     #define CC_STATUS_INIT  \
> >>This is a warning-to-error from -Werror, so this came out during bootstrap
> >>rather than a cross-build, right?
> >>
> >>
> >>>>>     ^
> >>>>>    In file included from tm.h:35:0,
> >>>>>                     from insn-output.c:7:
> >>>>>    ..../gcc-src/gcc/config/arm/arm.h:2159:0: note: this is the location of the previous definition
> >>>>>     #define CC_STATUS_INIT \
> >>>>>     ^
> >>>>>
> >>>>>I guess the conditions.h definition wants wrapping in #ifndef - though a
> >>>>>quick grep suggests that ARM is the only target defining CC_STATUS_INIT
> >>>>>so lets CC the ARM maintainers and see what their preference is...
> >>>>Well, that seems pretty weird, but it looks intentional arm does this
> >>>>see http://gcc.gnu.org/ml/gcc-patches/2010-07/msg00437.html
> >>>>
> >>>>Of course I now see final.c also defines a fall back, so maybe the right
> >>>>thing to do is wrap the conditions.h definition in #if HAVE_cc0, or
> >>>>maybe the final.c definition can go away? Right now I'm to tired to make
> >>>>a good decision about that.
> >>>>
> >>>>sorry about the bustage!
> >>>Looks like the best thing is to turn this into a target hook then?  Or move the
> >>>fallback/default to defaults.h

Given the macro has multiple definitions I guess ultimately it should
move to a target hook unless someone decides to rework the arm backend.
Till then the ifdef in conditions.h doesn't seem to bad (I may well work
on converting a bunch of stuff to target hooks in the somewhat near
future).

> >>Shall we revert this patch for now then to restore bootstrap?
> >>
> >Isn't the most constructive temporary fix to just wrap the definition in
> >conditions.h with #ifndef CC_STATUS_INIT?
> 
> Like this?
> Ok for trunk as a temporary fix?

sgtm, thanks!

Trev

> 
> Thanks,
> Kyrill
> 
> 2015-04-23  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>     * conditions.h (CC_STATUS_INIT): Gate on #ifndef CC_STATUS_INIT.
> >R.
> >
> >>Kyrill
> >>
> >>>Richard.
> >>>
> >>>>Trev
> >>>>
> >>>>
> >>>>>Thanks,
> >>>>>James
> 

> diff --git a/gcc/conditions.h b/gcc/conditions.h
> index 7cd1e1c..0bda9a4 100644
> --- a/gcc/conditions.h
> +++ b/gcc/conditions.h
> @@ -109,8 +109,10 @@ extern CC_STATUS cc_status;
>  /* This is how to initialize the variable cc_status.
>     final does this at appropriate moments.  */
>  
> +/* FIXME: We want to get rid of these ifndefs.  */
> +#ifndef CC_STATUS_INIT
>  #define CC_STATUS_INIT  \
>   (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0,  \
>    CC_STATUS_MDEP_INIT)
> -
> +#endif
>  #endif /* GCC_CONDITIONS_H */

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2015-04-23 12:01 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-21 13:25 [PATCH 00/12] Reduce conditional compilation tbsaunde+gcc
2015-04-21 13:25 ` [PATCH 07/12] provide default for MASK_RETURN_ADDR tbsaunde+gcc
2015-04-21 13:32   ` Jeff Law
2015-04-21 13:25 ` [PATCH 12/12] add default for INSN_REFERENCES_ARE_DELAYED tbsaunde+gcc
2015-04-21 13:30   ` Jeff Law
2015-04-21 13:25 ` [PATCH 06/12] provide default for RETURN_ADDR_OFFSET tbsaunde+gcc
2015-04-21 13:32   ` Jeff Law
2015-04-21 13:25 ` [PATCH 01/12] add default definition of EH_RETURN_DATA_REGNO tbsaunde+gcc
2015-04-21 13:40   ` Jeff Law
2015-04-21 14:00     ` Jakub Jelinek
2015-04-21 14:04       ` Jeff Law
2015-04-21 13:25 ` [PATCH 03/12] more removal of ifdef HAVE_cc0 tbsaunde+gcc
2015-04-21 13:51   ` Jeff Law
2015-04-21 15:24     ` Trevor Saunders
2015-04-21 13:25 ` [PATCH 04/12] always define HAVE_cc0 tbsaunde+gcc
2015-04-21 13:53   ` Jeff Law
2015-04-21 15:18     ` Trevor Saunders
2015-04-21 13:25 ` [PATCH 11/12] provide default for INSN_SETS_ARE_DELAYED tbsaunde+gcc
2015-04-21 13:31   ` Jeff Law
2015-04-21 13:25 ` [PATCH 05/12] make some HAVE_cc0 code always compiled tbsaunde+gcc
2015-04-21 13:54   ` Jeff Law
2015-04-21 13:25 ` [PATCH 10/12] remove more ifdefs for HAVE_cc0 tbsaunde+gcc
2015-04-21 13:55   ` Jeff Law
2015-04-21 13:25 ` [PATCH 08/12] reduce conditional compilation for HARD_FRAME_POINTER_IS_FRAME_POINTER tbsaunde+gcc
2015-04-21 13:37   ` Jeff Law
2015-04-21 13:25 ` [PATCH 09/12] remove #if for PIC_OFFSET_TABLE_REGNUM tbsaunde+gcc
2015-04-21 13:34   ` Jeff Law
2015-04-21 13:25 ` [PATCH 02/12] remove some ifdef HAVE_cc0 tbsaunde+gcc
2015-04-21 13:48   ` Jeff Law
2015-04-21 14:14   ` Richard Biener
2015-04-21 15:24     ` Trevor Saunders
2015-04-23  3:28       ` James Greenhalgh
2015-04-23  4:55         ` Trevor Saunders
2015-04-23  8:35           ` Richard Biener
2015-04-23  8:41             ` Kyrill Tkachov
2015-04-23  9:08               ` Richard Earnshaw
2015-04-23  9:58                 ` Kyrill Tkachov
2015-04-23 10:30                   ` Richard Biener
2015-04-23 12:01                   ` Trevor Saunders
2015-04-21 13:43 ` [PATCH 00/12] Reduce conditional compilation Jeff Law
2015-04-21 13:57 ` Jeff Law
2015-04-21 15:29   ` Trevor Saunders
2015-04-22 18:19     ` David Malcolm
2015-04-22 18:37       ` Jeff Law
2015-04-22 20:46         ` Trevor Saunders
2015-04-22 20:47           ` Jeff Law

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).