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


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

Re: [PATCH] Fix unwinding through noreturn functions


Richard Henderson <rth@redhat.com> writes:

> I think maybe it would be better to introduce an attribute that
> is true for all patterns that expand to nothing.

Regtested again on ia64-linux.

2004-07-03  Andreas Schwab  <schwab@suse.de>

	* config/ia64/ia64.md: Define new attribute "empty".
	(prologue_use, nop_x, insn_group_barrier): Set it.

	* config/ia64/ia64.c (ia64_reorg): When looking for trailing call
	skip over "empty" insns.

Index: gcc/config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.293
diff -u -p -a -r1.293 ia64.c
--- gcc/config/ia64/ia64.c	2 Jul 2004 04:53:30 -0000	1.293
+++ gcc/config/ia64/ia64.c	3 Jul 2004 11:37:09 -0000
@@ -7666,11 +7666,12 @@ ia64_reorg (void)
       insn = get_last_insn ();
       if (! INSN_P (insn))
         insn = prev_active_insn (insn);
-      if (GET_CODE (insn) == INSN
-	  && GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE
-	  && XINT (PATTERN (insn), 1) == UNSPECV_INSN_GROUP_BARRIER)
-	{
-	  saw_stop = 1;
+      /* Skip over insns that expand to nothing.  */
+      while (GET_CODE (insn) == INSN && get_attr_empty (insn) == EMPTY_YES)
+        {
+	  if (GET_CODE (PATTERN (insn)) == UNSPEC_VOLATILE
+	      && XINT (PATTERN (insn), 1) == UNSPECV_INSN_GROUP_BARRIER)
+	    saw_stop = 1;
 	  insn = prev_active_insn (insn);
 	}
       if (GET_CODE (insn) == CALL_INSN)
Index: gcc/config/ia64/ia64.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.md,v
retrieving revision 1.129
diff -u -p -a -r1.129 ia64.md
--- gcc/config/ia64/ia64.md	27 Apr 2004 05:19:49 -0000	1.129
+++ gcc/config/ia64/ia64.md	3 Jul 2004 11:37:09 -0000
@@ -154,6 +154,10 @@
 
 (define_attr "predicable" "no,yes" (const_string "yes"))
 
+;; Empty.  True iff this insn does not generate any code.
+
+(define_attr "empty" "no,yes" (const_string "no"))
+
 
 
 ;; DFA descriptions of ia64 processors used for insn scheduling and
@@ -5425,7 +5429,8 @@
   ""
   ""
   [(set_attr "itanium_class" "ignore")
-   (set_attr "predicable" "no")])
+   (set_attr "predicable" "no")
+   (set_attr "empty" "yes")])
 
 ;; Allocate a new register frame.
 
@@ -5592,7 +5597,8 @@
   [(const_int 5)]
   ""
   ""
-  [(set_attr "itanium_class" "nop_x")])
+  [(set_attr "itanium_class" "nop_x")
+   (set_attr "empty" "yes")])
 
 ;; The following insn will be never generated.  It is used only by
 ;; insn scheduler to change state before advancing cycle.
@@ -5624,7 +5630,8 @@
   ""
   ";;"
   [(set_attr "itanium_class" "stop_bit")
-   (set_attr "predicable" "no")])
+   (set_attr "predicable" "no")
+   (set_attr "empty" "yes")])
 
 (define_expand "trap"
   [(trap_if (const_int 1) (const_int 0))]

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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