OSDN Git Service

2011-11-04 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / genattrtab.c
index e927ca2..4a4c2a2 100644 (file)
@@ -114,6 +114,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "read-md.h"
 #include "gensupport.h"
 #include "vecprim.h"
+#include "fnmatch.h"
 
 /* Flags for make_internal_attr's `special' parameter.  */
 #define ATTR_NONE              0
@@ -433,8 +434,9 @@ attr_rtx_1 (enum rtx_code code, va_list p)
          XEXP (rt_val, 1) = arg1;
        }
     }
-  else if (GET_RTX_LENGTH (code) == 1
-          && GET_RTX_FORMAT (code)[0] == 's')
+  else if (code == SYMBOL_REF
+          || (GET_RTX_LENGTH (code) == 1
+              && GET_RTX_FORMAT (code)[0] == 's'))
     {
       char *arg0 = va_arg (p, char *);
 
@@ -452,6 +454,11 @@ attr_rtx_1 (enum rtx_code code, va_list p)
          rtl_obstack = hash_obstack;
          rt_val = rtx_alloc (code);
          XSTR (rt_val, 0) = arg0;
+         if (code == SYMBOL_REF)
+           {
+             X0EXP (rt_val, 1) = NULL_RTX;
+             X0EXP (rt_val, 2) = NULL_RTX;
+           }
        }
     }
   else if (GET_RTX_LENGTH (code) == 2
@@ -610,6 +617,7 @@ attr_string (const char *str, int len)
   memcpy (new_str, str, len);
   new_str[len] = '\0';
   attr_hash_add_string (hashcode, new_str);
+  copy_md_ptr_loc (new_str, str);
 
   return new_str;                      /* Return the new string.  */
 }
@@ -650,6 +658,7 @@ attr_copy_rtx (rtx orig)
     case CONST_DOUBLE:
     case CONST_VECTOR:
     case SYMBOL_REF:
+    case MATCH_TEST:
     case CODE_LABEL:
     case PC:
     case CC0:
@@ -833,6 +842,11 @@ check_attr_test (rtx exp, int is_const, int lineno)
       XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), is_const, lineno);
       break;
 
+    case MATCH_TEST:
+      exp = attr_rtx (MATCH_TEST, XSTR (exp, 0));
+      ATTR_IND_SIMPLIFIED_P (exp) = 1;
+      break;
+
     case MATCH_OPERAND:
       if (is_const)
        fatal ("RTL operator \"%s\" not valid in constant attribute test",
@@ -2899,6 +2913,7 @@ clear_struct_flag (rtx x)
     case CONST_INT:
     case CONST_DOUBLE:
     case CONST_VECTOR:
+    case MATCH_TEST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
@@ -3563,6 +3578,12 @@ write_test_expr (rtx exp, unsigned int attrs_cached, int flags)
       printf (HOST_WIDE_INT_PRINT_DEC, XWINT (exp, 0));
       break;
 
+    case MATCH_TEST:
+      print_c_condition (XSTR (exp, 0));
+      if (flags & FLG_BITWISE)
+       printf (" != 0");
+      break;
+
     /* A random C expression.  */
     case SYMBOL_REF:
       print_c_condition (XSTR (exp, 0));
@@ -3757,6 +3778,7 @@ walk_attr_value (rtx exp)
       must_extract = 1;
       return;
 
+    case MATCH_TEST:
     case EQ_ATTR_ALT:
       must_extract = must_constrain = 1;
       break;
@@ -4553,7 +4575,7 @@ gen_insn_reserv (rtx def)
 struct bypass_list
 {
   struct bypass_list *next;
-  const char *insn;
+  const char *pattern;
 };
 
 static struct bypass_list *all_bypasses;
@@ -4569,11 +4591,11 @@ gen_bypass_1 (const char *s, size_t len)
 
   s = attr_string (s, len);
   for (b = all_bypasses; b; b = b->next)
-    if (s == b->insn)
+    if (s == b->pattern)
       return;  /* already got that one */
 
   b = oballoc (struct bypass_list);
-  b->insn = s;
+  b->pattern = s;
   b->next = all_bypasses;
   all_bypasses = b;
   n_bypasses++;
@@ -4607,7 +4629,7 @@ process_bypasses (void)
      list.  */
   for (r = all_insn_reservs; r; r = r->next)
     for (b = all_bypasses; b; b = b->next)
-      if (r->name == b->insn)
+      if (fnmatch (b->pattern, r->name, 0) == 0)
        r->bypassed = true;
 }