diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-26 21:21:42 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-26 21:21:42 +0000 |
commit | 32dea8e67e93e24418eb71510f4d248241510c30 (patch) | |
tree | 44e0ab313b71fa4c5524ede47fac2115629a7120 | |
parent | dbd4ffcb4d3355fd8dfc00ea97c1f1f42ece10c9 (diff) | |
download | gcc-32dea8e67e93e24418eb71510f4d248241510c30.tar.gz |
* genconditions.c (write_header): In generated code, #ifdef out
all includes and fake declarations, except includes of bconfig.h
and system.h, unless GCC_VERSION >= 3001. Do not include
gensupport.h in any case.
(write_conditions): Generate a definition of struct c_test. Add
a comment to the generated #endif.
(write_one_condition): Escape backslashes in string too.
(write_writer): Generated code must escape backslashes and quote
marks (but not newlines) in the strings it writes.
* Makefile.in (build/gencondmd.o): Update dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110275 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 29 | ||||
-rw-r--r-- | gcc/Makefile.in | 8 | ||||
-rw-r--r-- | gcc/genconditions.c | 86 |
3 files changed, 84 insertions, 39 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db8c1f8b9c5..93c001b63d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2006-01-26 Zack Weinberg <zackw@panix.com> + + * genconditions.c (write_header): In generated code, #ifdef out + all includes and fake declarations, except includes of bconfig.h + and system.h, unless GCC_VERSION >= 3001. Do not include + gensupport.h in any case. + (write_conditions): Generate a definition of struct c_test. Add + a comment to the generated #endif. + (write_one_condition): Escape backslashes in string too. + (write_writer): Generated code must escape backslashes and quote + marks (but not newlines) in the strings it writes. + * Makefile.in (build/gencondmd.o): Update dependencies. + 2006-01-26 Steve Ellcey <sje@cup.hp.com> PR target/25961 @@ -30,7 +43,7 @@ constants provided by 80387 instructions in the destination mode. 2006-01-26 Richard Guenther <rguenther@suse.de> - Andrew Pinski <pinskia@physics.uc.edu> + Andrew Pinski <pinskia@physics.uc.edu> PR tree-opt/21470 partial PR tree-opt/17064 @@ -212,7 +225,7 @@ rather than find_pool_constant. (get_pool_constant_for_function): Delete. (get_pool_mode, mark_constant): Use SYMBOL_REF_CONSTANT rather than - find_pool_constant. + find_pool_constant. * rtl.h (rtunion_def): Add rt_constant and rt_ptr fields. (X0CONSTANT, X0PTR, SYMBOL_REF_DATA): New macros. (SYMBOL_REF_DECL): Return NULL if CONSTANT_POOL_ADDRESS_P. @@ -288,10 +301,10 @@ 2006-01-23 Paolo Bonzini <bonzini@gnu.org> - PR rtl-optimization/25890 - PR rtl-optimization/25905 - * combine.c (expand_compound_operation, expand_field_assignment): - Fail if the bitfield's final position is out of bounds. + PR rtl-optimization/25890 + PR rtl-optimization/25905 + * combine.c (expand_compound_operation, expand_field_assignment): + Fail if the bitfield's final position is out of bounds. 2006-01-24 Ian Lance Taylor <ian@airs.com> @@ -301,7 +314,7 @@ 2006-01-23 Adam Nemet <anemet@caviumnetworks.com> - * fix-header.c (read_scan_file): Add new parameter imultilib when + * fix-header.c (read_scan_file): Add new parameter imultilib when calling register_include_chains. 2006-01-23 Diego Novillo <dnovillo@redhat.com> @@ -313,7 +326,7 @@ PR tree-opt/25315 PR tree-opt/25857 - * tree-ssa-pre.c (insert_extra_phis): If an incomming edge is abnormal + * tree-ssa-pre.c (insert_extra_phis): If an incomming edge is abnormal return from the function. 2006-01-22 Zack Weinberg <zackw@panix.com> diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 131c76bfa0b..257fc6a5190 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2900,10 +2900,10 @@ build/rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) \ $(RTL_H) real.h $(GGC_H) errors.h build/vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) coretypes.h vec.h \ $(GGC_H) toplev.h -build/gencondmd.o : build/gencondmd.c $(CONFIG_H) $(SYSTEM_H) $(GTM_H) \ - $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) $(RECOG_H) real.h output.h \ - $(FLAGS_H) hard-reg-set.h $(RESOURCE_H) toplev.h reload.h \ - gensupport.h insn-constants.h coretypes.h +build/gencondmd.o : build/gencondmd.c $(BCONFIG_H) $(SYSTEM_H) \ + coretypes.h $(GTM_H) insn-constants.h $(RTL_H) $(TM_P_H) \ + $(FUNCTION_H) $(REGS_H) $(RECOG_H) real.h output.h $(FLAGS_H) \ + $(RESOURCE_H) toplev.h reload.h except.h # ...these are the programs themselves. build/genattr.o : genattr.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \ diff --git a/gcc/genconditions.c b/gcc/genconditions.c index 10dfc5896b4..bc4bfd57151 100644 --- a/gcc/genconditions.c +++ b/gcc/genconditions.c @@ -52,9 +52,14 @@ write_header (void) machine description file. */\n\ \n\ #include \"bconfig.h\"\n\ -#include \"insn-constants.h\"\n"); +#include \"system.h\"\n"); puts ("\ +/* 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\ +#if GCC_VERSION >= 3001\n\ +\n\ /* Do not allow checking to confuse the issue. */\n\ #undef ENABLE_CHECKING\n\ #undef ENABLE_TREE_CHECKING\n\ @@ -64,9 +69,9 @@ write_header (void) #undef ENABLE_GC_ALWAYS_COLLECT\n"); puts ("\ -#include \"system.h\"\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"); @@ -86,8 +91,7 @@ write_header (void) #include \"hard-reg-set.h\"\n\ #include \"resource.h\"\n\ #include \"toplev.h\"\n\ -#include \"reload.h\"\n\ -#include \"gensupport.h\"\n"); +#include \"reload.h\"\n"); if (saw_eh_return) puts ("#define HAVE_eh_return 1"); @@ -97,7 +101,9 @@ write_header (void) /* Dummy external declarations. */\n\ extern rtx insn;\n\ extern rtx ins1;\n\ -extern rtx operands[];\n"); +extern rtx operands[];\n\ +\n\ +#endif /* gcc >= 3.0.1 */\n"); } /* Write out one entry in the conditions table, using the data pointed @@ -118,12 +124,14 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy)) fputs (" { \"", stdout); for (p = test->expr; *p; p++) { - if (*p == '\n') - fputs ("\\n\\\n", stdout); - else if (*p == '"') - fputs ("\\\"", stdout); - else - putchar (*p); + switch (*p) + { + case '\n': fputs ("\\n\\", stdout); break; + case '\\': + case '\"': putchar ('\\'); break; + default: break; + } + putchar (*p); } printf ("\",\n __builtin_constant_p "); @@ -140,20 +148,29 @@ static void write_conditions (void) { puts ("\ +/* Structure definition duplicated from gensupport.h rather than\n\ + drag in that file and its dependencies. */\n\ +struct c_test\n\ +{\n\ + const char *expr;\n\ + int value;\n\ +};\n"); + + puts ("\ /* 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\ -\n\ -static const struct c_test insn_conditions[] = {\n \ -/* If we don't have __builtin_constant_p, or it's not acceptable in array\n\ + cannot be calculated at compile time.\n\ + If we don't have __builtin_constant_p, or it's not acceptable in array\n\ initializers, fall back to assuming that all conditions potentially\n\ vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\ optimizing. */\n\ -#if GCC_VERSION >= 3001"); +\n\ +static const struct c_test insn_conditions[] = {\n\ +#if GCC_VERSION >= 3001\n"); traverse_c_tests (write_one_condition, 0); - puts ("#endif\n};\n"); + puts ("\n#endif /* gcc >= 3.0.1 */\n};\n"); } /* Emit code which will convert the C-format table to a @@ -163,16 +180,31 @@ static const struct c_test insn_conditions[] = {\n \ static void write_writer (void) { - puts ("int\nmain(void)\n{\n\ - unsigned int i;\n\ -\n\ - puts (\"(define_conditions [\");\n\ - for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n\ - printf (\" (%d \\\"%s\\\")\\n\",\n\ - insn_conditions[i].value, insn_conditions[i].expr);\n\ - puts (\"])\");\n\ - fflush (stdout);\n\ - return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);\n}"); + puts ("int\n" + "main(void)\n" + "{\n" + " unsigned int i;\n" + " const char *p;\n" + " puts (\"(define_conditions [\");\n" + " for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n" + " {\n" + " printf (\" (%d \\\"\", insn_conditions[i].value);\n" + " for (p = insn_conditions[i].expr; *p; p++)\n" + " {\n" + " switch (*p)\n" + " {\n" + " case '\\\\':\n" + " case '\\\"': putchar ('\\\\'); break;\n" + " default: break;\n" + " }\n" + " putchar (*p);\n" + " }\n" + " puts (\"\\\")\");\n" + " }"); + puts (" puts (\"])\");\n" + " fflush (stdout);\n" + "return ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE;\n" + "}"); } int |