]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
r110124@banpei: zack | 2006-01-22 14:45:55 -0800
authorZack Weinberg <zackw@panix.com>
Mon, 23 Jan 2006 15:15:12 +0000 (15:15 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Mon, 23 Jan 2006 15:15:12 +0000 (15:15 +0000)
 r110124@banpei:  zack | 2006-01-22 14:45:55 -0800
  * gensupport.c: Define get_insn_name and record_insn_name here.
  (read_md_rtx): Call record_insn_name as appropriate.
  * genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c
  * genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c
  * genpreds.c, genrecog.c: Don't define get_insn_name nor
  record_insn_name.
  * Makefile.in (BUILD_SUPPORT, BUILD_PRINT): Fold into BUILD_RTL.
  (BUILD_VARRAY): Delete.
  (genprognormal): Rename genprogmd.  Fold in all programs from
  genprognoprint; also attrtab.
  (build/genattrtab): Just mention genautomata.o and varray.o.
  Reorganize a bit, add comments to make the categories clearer.

From-SVN: r110120

15 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/genattr.c
gcc/genattrtab.c
gcc/gencodes.c
gcc/genconfig.c
gcc/genemit.c
gcc/genextract.c
gcc/genflags.c
gcc/genopinit.c
gcc/genoutput.c
gcc/genpeep.c
gcc/genpreds.c
gcc/genrecog.c
gcc/gensupport.c

index 6b723cc965bd0733e75825cc77a964559e039f97..b67c0339b6c92728f152cd3bb9c38091da819e7e 100644 (file)
@@ -1,3 +1,18 @@
+2006-01-22  Zack Weinberg  <zackw@panix.com>
+
+       * gensupport.c: Define get_insn_name and record_insn_name here.
+       (read_md_rtx): Call record_insn_name as appropriate.
+       * genattr.c, genattrtab.c, gencodes.c, genconfig.c, genemit.c
+       * genextract.c, genflags.c, genopinit.c, genoutput.c, genpeep.c
+       * genpreds.c, genrecog.c: Don't define get_insn_name nor
+       record_insn_name.
+       * Makefile.in (BUILD_SUPPORT, BUILD_PRINT): Fold into BUILD_RTL.
+       (BUILD_VARRAY): Delete.
+       (genprognormal): Rename genprogmd.  Fold in all programs from
+       genprognoprint; also attrtab.
+       (build/genattrtab): Just mention genautomata.o and varray.o.
+       Reorganize a bit, add comments to make the categories clearer.
+
 2006-01-22  Zack Weinberg  <zackw@panix.com>
 
        * genconditions.c (condition_table, add_condition): Delete.
index c6eec9832c16ba3318f5852719a454cd00c8e166..6d25f9001c10ebfb8ca660e64e887c581e78efda 100644 (file)
@@ -839,11 +839,8 @@ LDEXP_LIB = @LDEXP_LIB@
 BUILD_LIBS = $(BUILD_LIBIBERTY)
 
 BUILD_RTL = build/rtl.o build/read-rtl.o build/ggc-none.o \
-           build/min-insn-modes.o
-BUILD_SUPPORT = build/gensupport.o
-BUILD_PRINT = build/print-rtl.o
+           build/min-insn-modes.o build/gensupport.o build/print-rtl.o
 BUILD_ERRORS = build/errors.o
-BUILD_VARRAY = build/varray.o
 
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
@@ -2964,29 +2961,19 @@ build/gen%$(build_exeext): build/gen%.o $(BUILD_LIBDEPS)
        $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
            $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
 
-# All these programs have the same additional dependency set.
-genprognormal = attr codes config emit extract flags opinit output peep recog \
-               preds
-$(genprognormal:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_SUPPORT) \
-  $(BUILD_PRINT) $(BUILD_ERRORS)
-
-# These don't have the glue to link with print-rtl.o.
-genprognoprint = mddeps constants conditions
-$(genprognoprint:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_SUPPORT) \
-  $(BUILD_ERRORS)
+# All these programs use the MD reader ($(BUILD_RTL)).
+genprogmd = attr attrtab codes conditions config constants emit extract \
+           flags mddeps opinit output peep preds recog
+$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_RTL) $(BUILD_ERRORS)
 
+# These programs need files over and above what they get from the above list.
+build/genextract$(build_exeext) : build/vec.o
+build/genattrtab$(build_exeext) : build/genautomata.o build/varray.o
+build/genattrtab$(build_exeext) : BUILD_LIBS += -lm
 
+# These programs are not linked with the MD reader.
 build/gengenrtl$(build_exeext) : $(BUILD_ERRORS)
 build/genmodes$(build_exeext) : $(BUILD_ERRORS)
-build/genextract$(build_exeext): build/vec.o
-
-# These programs are made from more than one source file.
-# The primary source file comes from the pattern rule above.
-build/genattrtab$(build_exeext) : build/genautomata.o \
-  $(BUILD_RTL) $(BUILD_SUPPORT) $(BUILD_PRINT) $(BUILD_ERRORS) \
-  $(BUILD_VARRAY)
-build/genattrtab$(build_exeext) : BUILD_LIBS += -lm
-
 build/gengtype$(build_exeext) : build/gengtype-lex.o \
   build/gengtype-yacc.o $(BUILD_ERRORS)
 
index 0e039e7a4b2e2dc5da582a7beacd6dd12e217988..7d6d50fffb0d5bc4f213a7105d5eb11e8dfafd0a 100644 (file)
@@ -286,10 +286,3 @@ main (int argc, char **argv)
 
   return SUCCESS_EXIT_CODE;
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index 359ddddae107a456aef70d1bc89f58fd6f2d174f..41dda6bb5daf7003ead4764b30bab6804156b94e 100644 (file)
@@ -4626,10 +4626,3 @@ from the machine description file `md'.  */\n\n");
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index adfca88e94f0c1c2ca3a1f40fd5bf48628921392..27a68ad4a265841a8a61c631574d95c9c0e8d0f8 100644 (file)
@@ -96,11 +96,3 @@ enum insn_code {");
 
   return SUCCESS_EXIT_CODE;
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index b92cd2fed9f9230e10c900fd53a4046b7502786d..9391315108473742a56163b66e22fb729be0154f 100644 (file)
@@ -364,10 +364,3 @@ main (int argc, char **argv)
 
   return SUCCESS_EXIT_CODE;
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int ARG_UNUSED (code))
-{
-  return NULL;
-}
index 691e42c5dd1fecb75b851dcb554cd416f936b703..e9773082f9eb11599ae874704d38e2ce19333caf 100644 (file)
@@ -894,10 +894,3 @@ from the machine description file `md'.  */\n\n");
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index 1fd684228cf4323d2fdb969f188b66a614e6ce74..319a0b0bfa96b321db8402f48a958f9f4028c16b 100644 (file)
@@ -86,7 +86,6 @@ struct accum_extract
 
 /* Forward declarations.  */
 static void walk_rtx (rtx, struct accum_extract *);
-static void record_insn_name (int, const char *);
 
 static void
 gen_insn (rtx insn, int insn_code_number)
@@ -416,10 +415,7 @@ main (int argc, char **argv)
   while ((desc = read_md_rtx (&line_no, &insn_code_number)) != NULL)
     {
        if (GET_CODE (desc) == DEFINE_INSN)
-       {
-         record_insn_name (insn_code_number, XSTR (desc, 0));
-         gen_insn (desc, insn_code_number);
-       }
+        gen_insn (desc, insn_code_number);
 
       else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
        {
@@ -493,49 +489,3 @@ main (int argc, char **argv)
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-
-/* Holds an array of names indexed by insn_code_number.  */
-static char **insn_name_ptr = 0;
-static int insn_name_ptr_size = 0;
-
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  if (code < insn_name_ptr_size)
-    return insn_name_ptr[code];
-  else
-    return NULL;
-}
-
-static void
-record_insn_name (int code, const char *name)
-{
-  static const char *last_real_name = "insn";
-  static int last_real_code = 0;
-  char *new;
-
-  if (insn_name_ptr_size <= code)
-    {
-      int new_size;
-      new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
-      insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
-      memset (insn_name_ptr + insn_name_ptr_size, 0,
-             sizeof(char *) * (new_size - insn_name_ptr_size));
-      insn_name_ptr_size = new_size;
-    }
-
-  if (!name || name[0] == '\0')
-    {
-      new = xmalloc (strlen (last_real_name) + 10);
-      sprintf (new, "%s+%d", last_real_name, code - last_real_code);
-    }
-  else
-    {
-      last_real_name = new = xstrdup (name);
-      last_real_code = code;
-    }
-
-  insn_name_ptr[code] = new;
-}
index 075a355ee72192afa1b478076835a8df3fd35abd..30e9c7e103a03b1f95cf5f3f950c426ea05ed860 100644 (file)
@@ -279,10 +279,3 @@ main (int argc, char **argv)
 
   return SUCCESS_EXIT_CODE;
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int ARG_UNUSED (code))
-{
-  return NULL;
-}
index d9582202b3b99a5f5592a8e5c06f4b12a4993b9d..c9cea085852a08372ed373709ec1d084d0c24148 100644 (file)
@@ -453,10 +453,3 @@ from the machine description file `md'.  */\n\n");
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index e94e20f3d1643ba872fb5486de25dc89da4b09cc..4a73904259910c51018e119542d6bcadf75e312d 100644 (file)
@@ -192,28 +192,6 @@ static void gen_split (rtx, int);
 static void check_constraint_len (void);
 static int constraint_len (const char *, int);
 \f
-const char *
-get_insn_name (int index)
-{
-  static char buf[100];
-
-  struct data *i, *last_named = NULL;
-  for (i = idata; i ; i = i->next)
-    {
-      if (i->index_number == index)
-       return i->name;
-      if (i->name)
-       last_named = i;
-    }
-
-  if (last_named)
-    sprintf(buf, "%s+%d", last_named->name, index - last_named->index_number);
-  else
-    sprintf(buf, "insn %d", index);
-
-  return buf;
-}
-
 static void
 output_prologue (void)
 {
index 89da38f1b3b32065b5b4e38d87d438411cb31ee5..ad4b5a1135130db10390df17ef015faeb9433880 100644 (file)
@@ -426,10 +426,3 @@ from the machine description file `md'.  */\n\n");
   fflush (stdout);
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
-
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return NULL;
-}
index dd044f771e4b6e7f1a3450257845a7507fc55d32..6dbe7d4b9201bd2f619728627a55a24ff92f664a 100644 (file)
@@ -492,10 +492,3 @@ main (int argc, char **argv)
 
   return SUCCESS_EXIT_CODE;
 }
-
-/* Dummy for debugging purposes.  */
-const char *
-get_insn_name (int code ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
index 82248482de0654a60be036ce223c5e76b2c1d3bf..cb86849e9369628ec12e2d62c3a4993ad9e3de06 100644 (file)
 #define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
   printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
 
-/* Holds an array of names indexed by insn_code_number.  */
-static char **insn_name_ptr = 0;
-static int insn_name_ptr_size = 0;
-
 /* A listhead of decision trees.  The alternatives to a node are kept
    in a doubly-linked list so we can easily add nodes to the proper
    place when merging.  */
@@ -473,9 +469,6 @@ static struct decision_head make_insn_sequence
 static void process_tree
   (struct decision_head *, enum routine_type);
 
-static void record_insn_name
-  (int, const char *);
-
 static void debug_decision_0
   (struct decision *, int, int);
 static void debug_decision_1
@@ -2189,7 +2182,7 @@ write_action (struct decision *p, struct decision_test *test,
                    indent, test->u.insn.num_clobbers_to_add);
          printf ("%sreturn %d;  /* %s */\n", indent,
                  test->u.insn.code_number,
-                 insn_name_ptr[test->u.insn.code_number]);
+                 get_insn_name (test->u.insn.code_number));
          break;
 
        case SPLIT:
@@ -2548,8 +2541,6 @@ make_insn_sequence (rtx insn, enum routine_type type)
   /* We should never see an insn whose C test is false at compile time.  */
   gcc_assert (truth);
 
-  record_insn_name (next_insn_code, (type == RECOG ? XSTR (insn, 0) : NULL));
-
   c_test_pos[0] = '\0';
   if (type == PEEPHOLE2)
     {
@@ -2798,47 +2789,6 @@ main (int argc, char **argv)
   return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
 }
 \f
-/* Define this so we can link with print-rtl.o to get debug_rtx function.  */
-const char *
-get_insn_name (int code)
-{
-  if (code < insn_name_ptr_size)
-    return insn_name_ptr[code];
-  else
-    return NULL;
-}
-
-static void
-record_insn_name (int code, const char *name)
-{
-  static const char *last_real_name = "insn";
-  static int last_real_code = 0;
-  char *new;
-
-  if (insn_name_ptr_size <= code)
-    {
-      int new_size;
-      new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
-      insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
-      memset (insn_name_ptr + insn_name_ptr_size, 0,
-             sizeof(char *) * (new_size - insn_name_ptr_size));
-      insn_name_ptr_size = new_size;
-    }
-
-  if (!name || name[0] == '\0')
-    {
-      new = xmalloc (strlen (last_real_name) + 10);
-      sprintf (new, "%s+%d", last_real_name, code - last_real_code);
-    }
-  else
-    {
-      last_real_name = new = xstrdup (name);
-      last_real_code = code;
-    }
-
-  insn_name_ptr[code] = new;
-}
-\f
 static void
 debug_decision_2 (struct decision_test *test)
 {
index 94d27aca975303ecc38bdccaae511526841ab425..bbac33a2c8863d496d827f23418ff10c5eb9d907 100644 (file)
@@ -118,6 +118,7 @@ static void process_define_cond_exec (void);
 static void process_include (rtx, int);
 static char *save_string (const char *, int);
 static void init_predicate_table (void);
+static void record_insn_name (int, const char *);
 \f
 void
 message_with_line (int lineno, const char *msg, ...)
@@ -1104,6 +1105,10 @@ read_md_rtx (int *lineno, int *seqnr)
        sequence_num++;
       else if (insn_elision)
        goto discard;
+
+      /* *seqnr is used here so the name table will match caller's
+        idea of insn numbering, whether or not elision is active.  */
+      record_insn_name (*seqnr, XSTR (desc, 0));
       break;
 
     case DEFINE_SPLIT:
@@ -1373,3 +1378,50 @@ init_predicate_table (void)
       add_predicate (pred);
     }
 }
+\f
+/* These functions allow linkage with print-rtl.c.  Also, some generators
+   like to annotate their output with insn names.  */
+
+/* Holds an array of names indexed by insn_code_number.  */
+static char **insn_name_ptr = 0;
+static int insn_name_ptr_size = 0;
+
+const char *
+get_insn_name (int code)
+{
+  if (code < insn_name_ptr_size)
+    return insn_name_ptr[code];
+  else
+    return NULL;
+}
+
+static void
+record_insn_name (int code, const char *name)
+{
+  static const char *last_real_name = "insn";
+  static int last_real_code = 0;
+  char *new;
+
+  if (insn_name_ptr_size <= code)
+    {
+      int new_size;
+      new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
+      insn_name_ptr = xrealloc (insn_name_ptr, sizeof(char *) * new_size);
+      memset (insn_name_ptr + insn_name_ptr_size, 0,
+             sizeof(char *) * (new_size - insn_name_ptr_size));
+      insn_name_ptr_size = new_size;
+    }
+
+  if (!name || name[0] == '\0')
+    {
+      new = xmalloc (strlen (last_real_name) + 10);
+      sprintf (new, "%s+%d", last_real_name, code - last_real_code);
+    }
+  else
+    {
+      last_real_name = new = xstrdup (name);
+      last_real_code = code;
+    }
+
+  insn_name_ptr[code] = new;
+}