OSDN Git Service

2007-07-06 H.J. Lu <hongjiu.lu@intel.com>
[pf3gnuchains/gcc-fork.git] / gcc / genconditions.c
index bc4bfd5..1a653d0 100644 (file)
@@ -52,9 +52,8 @@ write_header (void)
    machine description file.  */\n\
 \n\
 #include \"bconfig.h\"\n\
-#include \"system.h\"\n");
-
-  puts ("\
+#include \"system.h\"\n\
+\n\
 /* It is necessary, but not entirely safe, to include the headers below\n\
    in a generator program.  As a defensive measure, don't do so when the\n\
    table isn't going to have anything in it.  */\n\
@@ -66,23 +65,20 @@ write_header (void)
 #undef ENABLE_RTL_CHECKING\n\
 #undef ENABLE_RTL_FLAG_CHECKING\n\
 #undef ENABLE_GC_CHECKING\n\
-#undef ENABLE_GC_ALWAYS_COLLECT\n");
-
-  puts ("\
+#undef ENABLE_GC_ALWAYS_COLLECT\n\
+\n\
 #include \"coretypes.h\"\n\
 #include \"tm.h\"\n\
 #include \"insn-constants.h\"\n\
 #include \"rtl.h\"\n\
 #include \"tm_p.h\"\n\
-#include \"function.h\"\n");
-
-  puts ("\
+#include \"function.h\"\n\
+\n\
 /* Fake - insn-config.h doesn't exist yet.  */\n\
 #define MAX_RECOG_OPERANDS 10\n\
 #define MAX_DUP_OPERANDS 10\n\
-#define MAX_INSNS_PER_SPLIT 5\n");
-
-  puts ("\
+#define MAX_INSNS_PER_SPLIT 5\n\
+\n\
 #include \"regs.h\"\n\
 #include \"recog.h\"\n\
 #include \"real.h\"\n\
@@ -91,7 +87,8 @@ write_header (void)
 #include \"hard-reg-set.h\"\n\
 #include \"resource.h\"\n\
 #include \"toplev.h\"\n\
-#include \"reload.h\"\n");
+#include \"reload.h\"\n\
+#include \"tm-constrs.h\"\n");
 
   if (saw_eh_return)
     puts ("#define HAVE_eh_return 1");
@@ -134,11 +131,11 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
       putchar (*p);
     }
 
-  printf ("\",\n    __builtin_constant_p ");
+  fputs ("\",\n    __builtin_constant_p ", stdout);
   print_c_condition (test->expr);
-  printf ("\n    ? (int) ");
+  fputs ("\n    ? (int) ", stdout);
   print_c_condition (test->expr);
-  printf ("\n    : -1 },\n");
+  fputs ("\n    : -1 },\n", stdout);
   return 1;
 }
 
@@ -154,9 +151,8 @@ struct c_test\n\
 {\n\
   const char *expr;\n\
   int value;\n\
-};\n");
-
-  puts ("\
+};\n\
+\n\
 /* This table lists each condition found in the machine description.\n\
    Each condition is mapped to its truth value (0 or 1), or -1 if that\n\
    cannot be calculated at compile time.\n\
@@ -165,12 +161,12 @@ struct c_test\n\
    vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
    optimizing.  */\n\
 \n\
-static const struct c_test insn_conditions[] = {\n\
-#if GCC_VERSION >= 3001\n");
+#if GCC_VERSION >= 3001\n\
+static const struct c_test insn_conditions[] = {\n");
 
   traverse_c_tests (write_one_condition, 0);
 
-  puts ("\n#endif /* gcc >= 3.0.1 */\n};\n");
+  puts ("\n};\n#endif /* gcc >= 3.0.1 */\n");
 }
 
 /* Emit code which will convert the C-format table to a
@@ -186,6 +182,7 @@ write_writer (void)
        "  unsigned int i;\n"
         "  const char *p;\n"
         "  puts (\"(define_conditions [\");\n"
+       "#if GCC_VERSION >= 3001\n"
        "  for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
        "    {\n"
        "      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
@@ -200,8 +197,9 @@ write_writer (void)
        "          putchar (*p);\n"
        "        }\n"
         "      puts (\"\\\")\");\n"
-        "    }");
-  puts ("  puts (\"])\");\n"
+        "    }\n"
+       "#endif /* gcc >= 3.0.1 */\n"
+       "  puts (\"])\");\n"
         "  fflush (stdout);\n"
         "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n"
        "}");