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]

[PATCH] VAX: Use gcc_{assert,unreachable}()


Hi!

This patch moves over the VAX-specific code to use gcc_unreachable()
and gcc_assert() instead of abort().

2005-04-23  Jan-Benedict Glaw  <jbglaw@lug-owl.de>

	gcc/config/vax/
	* vax.c: (print_operand_address) Use gcc_unreachable and
	gcc_assert. (vax_float_literal) Likewise.
	* vax.md: Likewise.

diff -Nurp src-gcc-fresh/gcc/config/vax/vax.c src-gcc-hacked/gcc/config/vax/vax.c
--- src-gcc-fresh/gcc/config/vax/vax.c	2005-04-08 10:25:16.000000000 +0200
+++ src-gcc-hacked/gcc/config/vax/vax.c	2005-04-23 20:22:55.000000000 +0200
@@ -268,7 +268,7 @@ print_operand_address (FILE * file, regi
 	  addr = XEXP (addr, 1);
 	}
       else
-	abort ();
+	gcc_unreachable ();
 
       if (GET_CODE (addr) == REG)
 	{
@@ -291,7 +291,7 @@ print_operand_address (FILE * file, regi
 		  else if (GET_CODE (XEXP (addr, 0)) == CONST_INT)
 		    offset = plus_constant (offset, INTVAL (XEXP (addr, 0)));
 		  else
-		    abort ();
+		    gcc_unreachable ();
 		}
 	      offset = XEXP (addr, 0);
 	    }
@@ -304,12 +304,11 @@ print_operand_address (FILE * file, regi
 	    }
 	  else if (GET_CODE (XEXP (addr, 0)) == MULT)
 	    {
-	      if (ireg)
-		abort ();
+	      gcc_assert (!ireg);
 	      ireg = XEXP (addr, 0);
 	    }
 	  else
-	    abort ();
+	    gcc_unreachable ();
 
 	  if (CONSTANT_ADDRESS_P (XEXP (addr, 1))
 	      || GET_CODE (XEXP (addr, 1)) == MEM)
@@ -321,7 +320,7 @@ print_operand_address (FILE * file, regi
 		  else if (GET_CODE (XEXP (addr, 1)) == CONST_INT)
 		    offset = plus_constant (offset, INTVAL (XEXP (addr, 1)));
 		  else
-		    abort ();
+		    gcc_unreachable ();
 		}
 	      offset = XEXP (addr, 1);
 	    }
@@ -334,23 +333,21 @@ print_operand_address (FILE * file, regi
 	    }
 	  else if (GET_CODE (XEXP (addr, 1)) == MULT)
 	    {
-	      if (ireg)
-		abort ();
+	      gcc_assert (!ireg);
 	      ireg = XEXP (addr, 1);
 	    }
 	  else
-	    abort ();
+	    gcc_unreachable ();
 	}
       else
-	abort ();
+	gcc_unreachable ();
 
       /* If REG1 is nonzero, figure out if it is a base or index register.  */
       if (reg1)
 	{
 	  if (breg != 0 || (offset && GET_CODE (offset) == MEM))
 	    {
-	      if (ireg)
-		abort ();
+	      gcc_assert (!ireg);
 	      ireg = reg1;
 	    }
 	  else
@@ -367,8 +364,7 @@ print_operand_address (FILE * file, regi
 	{
 	  if (GET_CODE (ireg) == MULT)
 	    ireg = XEXP (ireg, 0);
-	  if (GET_CODE (ireg) != REG)
-	    abort ();
+	  gcc_assert (GET_CODE (ireg) == REG);
 	  fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
 	}
       break;
@@ -405,7 +401,7 @@ rev_cond_name (rtx op)
       return "lssu";
 
     default:
-      abort ();
+      gcc_unreachable ();
     }
 }
 
@@ -435,8 +431,7 @@ vax_float_literal(register rtx c)
 
       if (REAL_VALUES_EQUAL (r, s))
 	return 1;
-      if (!exact_real_inverse (mode, &s))
-	abort ();
+      gcc_assert (exact_real_inverse (mode, &s));
       if (REAL_VALUES_EQUAL (r, s))
 	return 1;
     }
diff -Nurp src-gcc-fresh/gcc/config/vax/vax.md src-gcc-hacked/gcc/config/vax/vax.md
--- src-gcc-fresh/gcc/config/vax/vax.md	2005-04-23 19:59:03.000000000 +0200
+++ src-gcc-hacked/gcc/config/vax/vax.md	2005-04-23 20:14:06.000000000 +0200
@@ -1205,8 +1205,7 @@
 			    (match_operand:SI 3 "immediate_operand" "")))])]
   ""
 {
-  if (INTVAL (operands[3]) > 255 * 4 || INTVAL (operands[3]) % 4)
-    abort ();
+  gcc_assert (INTVAL (operands[3]) <= 255 * 4 && INTVAL (operands[3]) % 4 == 0);
 
   /* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
      during EH unwinding.  We must include the argument count pushed by
@@ -1234,8 +1233,7 @@
 			    (match_operand:SI 4 "immediate_operand" "")))])]
   ""
 {
-  if (INTVAL (operands[4]) > 255 * 4 || INTVAL (operands[4]) % 4)
-    abort ();
+  gcc_assert (INTVAL (operands[4]) <= 255 * 4 && INTVAL (operands[4]) % 4 == 0);
 
   /* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
      during EH unwinding.  We must include the argument count pushed by


MfG, JBG

-- 
AWEK microdata GmbH -- Am Wellbach 4 -- 33609 Bielefeld


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