Commit 7f71272e by Mikhail Maltsev Committed by Jeff Law

[PATCH 6/9] ENABLE_CHECKING refactoring: generators

        * genautomata.c: Use CHECKING_P instead of ENABLE_CHECKING.
        * genconditions.c: Define CHECKING_P in the generated code.
        * genextract.c: Use flag_checking in insn_extract.
        * gengtype.c (main): Remove conditional compilation.
        * gengtype.h: Likewise.

From-SVN: r229539
parent 21f0717a
2015-10-29 Mikhail Maltsev <maltsevm@gmail.com>
* genautomata.c: Use CHECKING_P instead of ENABLE_CHECKING.
* genconditions.c: Define CHECKING_P in the generated code.
* genextract.c: Use flag_checking in insn_extract.
* gengtype.c (main): Remove conditional compilation.
* gengtype.h: Likewise.
2015-10-29 Jeff Law <law@redhat.com> 2015-10-29 Jeff Law <law@redhat.com>
PR tree-optimization/67892 PR tree-optimization/67892
...@@ -879,7 +879,7 @@ struct state_ainsn_table ...@@ -879,7 +879,7 @@ struct state_ainsn_table
/* Macros to access members of unions. Use only them for access to /* Macros to access members of unions. Use only them for access to
union members of declarations and regexps. */ union members of declarations and regexps. */
#if defined ENABLE_CHECKING && (GCC_VERSION >= 2007) #if CHECKING_P && (GCC_VERSION >= 2007)
#define DECL_UNIT(d) __extension__ \ #define DECL_UNIT(d) __extension__ \
(({ __typeof (d) const _decl = (d); \ (({ __typeof (d) const _decl = (d); \
...@@ -1070,7 +1070,7 @@ regexp_mode_check_failed (enum regexp_mode mode, ...@@ -1070,7 +1070,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
exit (1); exit (1);
} }
#else /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */ #else /* #if CHECKING_P && (GCC_VERSION >= 2007) */
#define DECL_UNIT(d) (&(d)->decl.unit) #define DECL_UNIT(d) (&(d)->decl.unit)
#define DECL_BYPASS(d) (&(d)->decl.bypass) #define DECL_BYPASS(d) (&(d)->decl.bypass)
...@@ -1088,7 +1088,7 @@ regexp_mode_check_failed (enum regexp_mode mode, ...@@ -1088,7 +1088,7 @@ regexp_mode_check_failed (enum regexp_mode mode,
#define REGEXP_ALLOF(r) (&(r)->regexp.allof) #define REGEXP_ALLOF(r) (&(r)->regexp.allof)
#define REGEXP_ONEOF(r) (&(r)->regexp.oneof) #define REGEXP_ONEOF(r) (&(r)->regexp.oneof)
#endif /* #if defined ENABLE_RTL_CHECKING && (GCC_VERSION >= 2007) */ #endif /* #if CHECKING_P && (GCC_VERSION >= 2007) */
#define XCREATENODE(T) ((T *) create_node (sizeof (T))) #define XCREATENODE(T) ((T *) create_node (sizeof (T)))
#define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N))) #define XCREATENODEVEC(T, N) ((T *) create_node (sizeof (T) * (N)))
......
...@@ -60,6 +60,8 @@ write_header (void) ...@@ -60,6 +60,8 @@ write_header (void)
\n\ \n\
/* Do not allow checking to confuse the issue. */\n\ /* Do not allow checking to confuse the issue. */\n\
#undef ENABLE_CHECKING\n\ #undef ENABLE_CHECKING\n\
#undef CHECKING_P\n\
#define CHECKING_P 0\n\
#undef ENABLE_TREE_CHECKING\n\ #undef ENABLE_TREE_CHECKING\n\
#undef ENABLE_RTL_CHECKING\n\ #undef ENABLE_RTL_CHECKING\n\
#undef ENABLE_RTL_FLAG_CHECKING\n\ #undef ENABLE_RTL_FLAG_CHECKING\n\
......
...@@ -373,10 +373,11 @@ insn_extract (rtx_insn *insn)\n{\n\ ...@@ -373,10 +373,11 @@ insn_extract (rtx_insn *insn)\n{\n\
rtx pat = PATTERN (insn);\n\ rtx pat = PATTERN (insn);\n\
int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\ int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\
\n\ \n\
#ifdef ENABLE_CHECKING\n\ if (flag_checking)\n\
memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\ {\n\
memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\ memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\
#endif\n"); memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\
}\n");
puts ("\ puts ("\
switch (INSN_CODE (insn))\n\ switch (INSN_CODE (insn))\n\
......
...@@ -158,9 +158,6 @@ size_t num_lang_dirs; ...@@ -158,9 +158,6 @@ size_t num_lang_dirs;
BASE_FILES entry for each language. */ BASE_FILES entry for each language. */
static outf_p *base_files; static outf_p *base_files;
#if ENABLE_CHECKING
/* Utility debugging function, printing the various type counts within /* Utility debugging function, printing the various type counts within
a list of types. Called through the DBGPRINT_COUNT_TYPE macro. */ a list of types. Called through the DBGPRINT_COUNT_TYPE macro. */
void void
...@@ -222,7 +219,6 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t) ...@@ -222,7 +219,6 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
fprintf (stderr, "@@%%@@ %d undefined types\n", nb_undefined); fprintf (stderr, "@@%%@@ %d undefined types\n", nb_undefined);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
} }
#endif /* ENABLE_CHECKING */
/* Scan the input file, LIST, and determine how much space we need to /* Scan the input file, LIST, and determine how much space we need to
store strings in. Also, count the number of language directories store strings in. Also, count the number of language directories
...@@ -5188,7 +5184,6 @@ main (int argc, char **argv) ...@@ -5188,7 +5184,6 @@ main (int argc, char **argv)
parse_program_options (argc, argv); parse_program_options (argc, argv);
#if ENABLE_CHECKING
if (do_debug) if (do_debug)
{ {
time_t now = (time_t) 0; time_t now = (time_t) 0;
...@@ -5196,7 +5191,6 @@ main (int argc, char **argv) ...@@ -5196,7 +5191,6 @@ main (int argc, char **argv)
DBGPRINTF ("gengtype started pid %d at %s", DBGPRINTF ("gengtype started pid %d at %s",
(int) getpid (), ctime (&now)); (int) getpid (), ctime (&now));
} }
#endif /* ENABLE_CHECKING */
/* Parse the input list and the input files. */ /* Parse the input list and the input files. */
DBGPRINTF ("inputlist %s", inputlist); DBGPRINTF ("inputlist %s", inputlist);
......
...@@ -492,17 +492,12 @@ extern int do_dump; /* (-d) program argument. */ ...@@ -492,17 +492,12 @@ extern int do_dump; /* (-d) program argument. */
gengtype source code). Only useful to debug gengtype itself. */ gengtype source code). Only useful to debug gengtype itself. */
extern int do_debug; /* (-D) program argument. */ extern int do_debug; /* (-D) program argument. */
#if ENABLE_CHECKING
#define DBGPRINTF(Fmt,...) do {if (do_debug) \ #define DBGPRINTF(Fmt,...) do {if (do_debug) \
fprintf (stderr, "%s:%d: " Fmt "\n", \ fprintf (stderr, "%s:%d: " Fmt "\n", \
lbasename (__FILE__),__LINE__, ##__VA_ARGS__);} while (0) lbasename (__FILE__),__LINE__, ##__VA_ARGS__);} while (0)
void dbgprint_count_type_at (const char *, int, const char *, type_p); void dbgprint_count_type_at (const char *, int, const char *, type_p);
#define DBGPRINT_COUNT_TYPE(Msg,Ty) do {if (do_debug) \ #define DBGPRINT_COUNT_TYPE(Msg,Ty) do {if (do_debug) \
dbgprint_count_type_at (__FILE__, __LINE__, Msg, Ty);}while (0) dbgprint_count_type_at (__FILE__, __LINE__, Msg, Ty);}while (0)
#else
#define DBGPRINTF(Fmt,...) do {/*nodbgrintf*/} while (0)
#define DBGPRINT_COUNT_TYPE(Msg,Ty) do{/*nodbgprint_count_type*/}while (0)
#endif /*ENABLE_CHECKING */
#define FOR_ALL_INHERITED_FIELDS(TYPE, FIELD_VAR) \ #define FOR_ALL_INHERITED_FIELDS(TYPE, FIELD_VAR) \
for (type_p sub = (TYPE); sub; sub = sub->u.s.base_class) \ for (type_p sub = (TYPE); sub; sub = sub->u.s.base_class) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment