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 FR30] Use existing predicates for RTL objects


This patch is to use existing predicates for RTL objects at config/fr30 directory.
Tested on fr30-elf simulator.


There are many unexpected failures when test gcc on fr30-elf target. Please to see the following gcc summary. Is it normal?

=== gcc Summary ===

# of expected passes 40392
# of unexpected failures 8896
# of unexpected successes 4
# of expected failures 71
# of unresolved testcases 104
# of unsupported tests 613
/home/pzhao/cross-compile/fr30-build/gcc/xgcc version 4.5.0 20090601 (experimental) [trunk revision 148068] (GCC)


2009-06-02  Shujing Zhao  <pearly.zhao@oracle.com>
	* config/fr30/fr30.c: Use REG_P, MEM_P and CONST_INT_P where
	applicable.
	* config/fr30/fr30.h: Ditto.
	* config/fr30/fr30.md: Ditto.
	* config/fr30/predicates.md: Ditto.

Index: config/fr30/fr30.c
===================================================================
--- config/fr30/fr30.c	(revision 148069)
+++ config/fr30/fr30.c	(working copy)
@@ -478,7 +478,7 @@ fr30_print_operand (FILE *file, rtx x, i
     case 'p':
       /* Compute the register name of the second register in a hi/lo
 	 register pair.  */
-      if (GET_CODE (x) != REG)
+      if (!REG_P (x))
 	output_operand_lossage ("fr30_print_operand: unrecognized %%p code");
       else
 	fprintf (file, "r%d", REGNO (x) + 1);
@@ -527,7 +527,7 @@ fr30_print_operand (FILE *file, rtx x, i
 
     case 'A':
       /* Print a signed byte value as an unsigned value.  */
-      if (GET_CODE (x) != CONST_INT)
+      if (!CONST_INT_P (x))
 	output_operand_lossage ("fr30_print_operand: invalid operand to %%A code");
       else
 	{
@@ -542,7 +542,7 @@ fr30_print_operand (FILE *file, rtx x, i
       return;
       
     case 'x':
-      if (GET_CODE (x) != CONST_INT
+      if (!CONST_INT_P (x)
 	  || INTVAL (x) < 16
 	  || INTVAL (x) > 32)
 	output_operand_lossage ("fr30_print_operand: invalid %%x code");
@@ -590,10 +590,10 @@ fr30_print_operand (FILE *file, rtx x, i
 	  break;
 
 	case PLUS:
-	  if (GET_CODE (XEXP (x0, 0)) != REG
+	  if (!REG_P (XEXP (x0, 0))
 	      || REGNO (XEXP (x0, 0)) < FRAME_POINTER_REGNUM
 	      || REGNO (XEXP (x0, 0)) > STACK_POINTER_REGNUM
-	      || GET_CODE (XEXP (x0, 1)) != CONST_INT)
+	      || !CONST_INT_P (XEXP (x0, 1)))
 	    {
 	      fprintf (stderr, "bad INDEXed address:");
 	      debug_rtx (x);
@@ -738,7 +738,7 @@ fr30_check_multiple_regs (rtx *operands,
       
       while (num_operands --)
 	{
-	  if (GET_CODE (operands [num_operands]) != REG)
+	  if (!REG_P (operands [num_operands]))
 	    return 0;
 	  
 	  if (REGNO (operands [num_operands]) < prev_regno)
@@ -753,7 +753,7 @@ fr30_check_multiple_regs (rtx *operands,
       
       while (num_operands --)
 	{
-	  if (GET_CODE (operands [num_operands]) != REG)
+	  if (!REG_P (operands [num_operands]))
 	    return 0;
 	  
 	  if (REGNO (operands [num_operands]) > prev_regno)
@@ -826,7 +826,7 @@ fr30_move_double (rtx * operands)
 	  rtx dest1 = operand_subword (dest, 1, TRUE, mode);;
 	  rtx new_mem;
 	  
-	  gcc_assert (GET_CODE (addr) == REG);
+	  gcc_assert (REG_P (addr));
 	  
 	  /* Copy the address before clobbering it.  See PR 34174.  */
 	  emit_insn (gen_rtx_SET (SImode, dest1, addr));
@@ -859,7 +859,7 @@ fr30_move_double (rtx * operands)
       rtx src0;
       rtx src1;
 
-      gcc_assert (GET_CODE (addr) == REG);
+      gcc_assert (REG_P (addr));
 
       src0 = operand_subword (src, 0, TRUE, mode);
       src1 = operand_subword (src, 1, TRUE, mode);
Index: config/fr30/fr30.h
===================================================================
--- config/fr30/fr30.h	(revision 148069)
+++ config/fr30/fr30.h	(working copy)
@@ -458,7 +458,7 @@ enum reg_class
    input and `r' on the output.  The next alternative specifies `m' on the
    input and a register class that does not include r0 on the output.  */
 #define EXTRA_CONSTRAINT(VALUE, C) \
-   ((C) == 'Q' ? (GET_CODE (VALUE) == MEM && GET_CODE (XEXP (VALUE, 0)) == SYMBOL_REF) : 0)
+   ((C) == 'Q' ? (MEM_P (VALUE) && GET_CODE (XEXP (VALUE, 0)) == SYMBOL_REF) : 0)
 
 /*}}}*/ 
 /*{{{  Basic Stack Layout.  */ 
@@ -842,20 +842,20 @@ do										\
 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)			\
   do									\
     {									\
-      if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))			\
+      if (REG_P (X) && REG_OK_FOR_BASE_P (X))			\
         goto LABEL;							\
       if (GET_CODE (X) == PLUS						\
 	  && ((MODE) == SImode || (MODE) == SFmode)			\
-	  && GET_CODE (XEXP (X, 0)) == REG				\
+	  && REG_P (XEXP (X, 0))				\
           && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM		\
-	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
+	  && CONST_INT_P (XEXP (X, 1))			\
 	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
 	goto LABEL;							\
       if (GET_CODE (X) == PLUS						\
 	  && ((MODE) == SImode || (MODE) == SFmode)			\
-	  && GET_CODE (XEXP (X, 0)) == REG				\
+	  && REG_P (XEXP (X, 0))				\
           && REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM		\
-	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
+	  && CONST_INT_P (XEXP (X, 1))			\
 	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
         goto LABEL;							\
     }									\
@@ -864,21 +864,21 @@ do										\
 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)			\
   do									\
     {									\
-      if (GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))			\
+      if (REG_P (X) && REG_OK_FOR_BASE_P (X))			\
         goto LABEL;							\
       if (GET_CODE (X) == PLUS						\
 	  && ((MODE) == SImode || (MODE) == SFmode)			\
-	  && GET_CODE (XEXP (X, 0)) == REG				\
+	  && REG_P (XEXP (X, 0))				\
           && REGNO (XEXP (X, 0)) == STACK_POINTER_REGNUM		\
-	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
+	  && CONST_INT_P (XEXP (X, 1))			\
 	  && IN_RANGE (INTVAL (XEXP (X, 1)), 0, (1 <<  6) - 4))		\
 	goto LABEL;							\
       if (GET_CODE (X) == PLUS						\
 	  && ((MODE) == SImode || (MODE) == SFmode)			\
-	  && GET_CODE (XEXP (X, 0)) == REG				\
+	  && REG_P (XEXP (X, 0))				\
           && (REGNO (XEXP (X, 0)) == FRAME_POINTER_REGNUM		\
 	      || REGNO (XEXP (X, 0)) == ARG_POINTER_REGNUM)		\
-	  && GET_CODE (XEXP (X, 1)) == CONST_INT			\
+	  && CONST_INT_P (XEXP (X, 1))			\
 	  && IN_RANGE (INTVAL (XEXP (X, 1)), -(1 << 9), (1 <<  9) - 4))	\
         goto LABEL;							\
     }									\
Index: config/fr30/fr30.md
===================================================================
--- config/fr30/fr30.md	(revision 148069)
+++ config/fr30/fr30.md	(working copy)
@@ -165,8 +165,8 @@ (define_expand "movqi"
 {
   if (!reload_in_progress
       && !reload_completed
-      && GET_CODE (operands[0]) == MEM
-      && (GET_CODE (operands[1]) == MEM
+      && MEM_P (operands[0])
+      && (MEM_P (operands[1])
          || immediate_operand (operands[1], QImode)))
     operands[1] = copy_to_mode_reg (QImode, operands[1]);
 }")
@@ -211,8 +211,8 @@ (define_expand "movhi"
 {
   if (!reload_in_progress
       && !reload_completed
-      && GET_CODE (operands[0]) == MEM
-      && (GET_CODE (operands[1]) == MEM
+      && MEM_P (operands[0])
+      && (MEM_P (operands[1])
 	 || immediate_operand (operands[1], HImode)))
     operands[1] = copy_to_mode_reg (HImode, operands[1]);
 }")
@@ -261,8 +261,8 @@ (define_expand "movsi"
   "{
   if (!reload_in_progress
       && !reload_completed
-      && GET_CODE(operands[0]) == MEM
-      && (GET_CODE (operands[1]) == MEM
+      && MEM_P(operands[0])
+      && (MEM_P (operands[1])
 	  || immediate_operand (operands[1], SImode)))
      operands[1] = copy_to_mode_reg (SImode, operands[1]);
   }"
@@ -385,7 +385,7 @@ (define_expand "movdi"
   "
   /* Everything except mem = const or mem = mem can be done easily.  */
 
-  if (GET_CODE (operands[0]) == MEM)
+  if (MEM_P (operands[0]))
     operands[1] = force_reg (DImode, operands[1]);
   "
 )
@@ -653,10 +653,10 @@ (define_expand "addsi3"
 		 (match_operand:SI 2 "nonmemory_operand" "")))]
   ""
   "{
-  if (   GET_CODE (operands[2]) == REG
+  if (   REG_P (operands[2])
       || GET_CODE (operands[2]) == SUBREG)
     emit_insn (gen_addsi_regs (operands[0], operands[1], operands[2]));
-  else if (GET_CODE (operands[2]) != CONST_INT)
+  else if (!CONST_INT_P (operands[2]))
     emit_insn (gen_addsi_big_int (operands[0], operands[1], operands[2]));
   else if (INTVAL (operands[2]) >= -16
 	   && INTVAL (operands[2]) <= 15
@@ -1148,7 +1148,7 @@ (define_insn "jump"
 ;; Indirect jump through a register
 (define_insn "indirect_jump"
   [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "r"))]
-  "GET_CODE (operands[0]) != MEM || GET_CODE (XEXP (operands[0], 0)) != PLUS"
+  "!MEM_P (operands[0]) || GET_CODE (XEXP (operands[0], 0)) != PLUS"
   "jmp%#\\t@%0"
   [(set_attr "delay_type" "delayed")]
 )
Index: config/fr30/predicates.md
===================================================================
--- config/fr30/predicates.md	(revision 148069)
+++ config/fr30/predicates.md	(working copy)
@@ -24,7 +24,7 @@ (define_predicate "stack_add_operand"
   (match_code "const_int")
 {
   return
-    (GET_CODE (op) == CONST_INT
+    (CONST_INT_P (op)
      && INTVAL (op) >= -512
      && INTVAL (op) <=  508
      && ((INTVAL (op) & 3) == 0));
@@ -36,7 +36,7 @@ (define_predicate "high_register_operand
   (match_code "reg")
 {
   return
-    (GET_CODE (op) == REG
+    (REG_P (op)
      && REGNO (op) <= 15
      && REGNO (op) >= 8);
 })
@@ -47,7 +47,7 @@ (define_predicate "low_register_operand"
   (match_code "reg")
 {
   return
-    (GET_CODE (op) == REG
+    (REG_P (op)
      && REGNO (op) <= 7);
 })
 
@@ -56,9 +56,9 @@ (define_predicate "low_register_operand"
 (define_predicate "call_operand"
   (match_code "mem")
 {
-  return (GET_CODE (op) == MEM
+  return (MEM_P (op)
 	  && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	      || GET_CODE (XEXP (op, 0)) == REG));
+	      || REG_P (XEXP (op, 0))));
 })
 
 ;; Returns TRUE if OP is a valid operand of a DImode operation.
@@ -103,7 +103,7 @@ (define_predicate "nonimmediate_di_opera
   if (GET_CODE (op) == SUBREG)
     op = SUBREG_REG (op);
 
-  if (GET_CODE (op) == MEM)
+  if (MEM_P (op))
     return memory_address_p (DImode, XEXP (op, 0));
 
   return FALSE;
@@ -116,8 +116,8 @@ (define_predicate "add_immediate_operand
   (match_code "reg,const_int")
 {
   return
-    (GET_CODE (op) == REG
-     || (GET_CODE (op) == CONST_INT
+    (REG_P (op)
+     || (CONST_INT_P (op)
 	 && INTVAL (op) >= -16
 	 && INTVAL (op) <=  15));
 })

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