From patchwork Sun Oct 18 23:55:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikhail Maltsev X-Patchwork-Id: 532066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 51E761402B0 for ; Mon, 19 Oct 2015 10:55:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=YEWnlbdV; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=auqWJJ/qcuNENyP5e qIMx7dXpes/4lX81TqP0AJMnmwlzu/eIc7F/j8y3BI93jBtLCDPQtnCNtGhjvm1/ WAuPeD7B6qBHO5CVjZy8SS6GxSazYA+N60Ow8oRsbLhmDLlCLGlB0IWLyf1SVfWV kK5CRfxy53yTHMyMToMxbDtKH4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=elxojB0QlWjKgXVGn8d9eJC t4pw=; b=YEWnlbdVr78ERfsllvQhPoEXA2GMjhG+nknIGM1uWegT9lyg7ZZlIb/ RyCpLKI4Dqrtl6eWJvEnLrxPWoRR0FELcjLQ1OhbgchbVOFyM4afseej0f5PdY3v 6z2uNVxnJefLpoJNfHzPUJ8V1cK6DifT8Jw23heJVWv+dLbZRP+Q= Received: (qmail 11399 invoked by alias); 18 Oct 2015 23:55:49 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11389 invoked by uid 89); 18 Oct 2015 23:55:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lf0-f54.google.com Received: from mail-lf0-f54.google.com (HELO mail-lf0-f54.google.com) (209.85.215.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 18 Oct 2015 23:55:47 +0000 Received: by lffv3 with SMTP id v3so99492131lff.0 for ; Sun, 18 Oct 2015 16:55:43 -0700 (PDT) X-Received: by 10.25.147.76 with SMTP id v73mr8742453lfd.102.1445212543707; Sun, 18 Oct 2015 16:55:43 -0700 (PDT) Received: from [192.168.123.200] ([77.41.78.126]) by smtp.googlemail.com with ESMTPSA id ba7sm4772506lbc.48.2015.10.18.16.55.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 16:55:42 -0700 (PDT) Message-ID: <5624317E.7050403@gmail.com> Date: Mon, 19 Oct 2015 02:55:42 +0300 From: Mikhail Maltsev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Richard Biener CC: gcc-patches mailing list , Jeff Law Subject: Re: [PATCH 6/9] ENABLE_CHECKING refactoring: generators References: <56130763.4070206@gmail.com> <561308F8.20805@gmail.com> In-Reply-To: X-IsSubscribed: yes On 10/06/2015 03:56 PM, Richard Biener wrote: > The generators should simply unconditionally check (not in generated > files, of course). > And the generated code parts should use flag_checking. > > Richard. genautomata has some macros similar to tree checks, so I avoided changing them. genconditions for some reason #undef-s ENABLE_CHECKING in the generated code. I did not look at it in details, but decided to simply #define CHECKING_P to 0 for consistency. As for genextract and gengtype, I followed your recommendations, that is, used flag_checking instead of CHECKING_P in genextract, and always enable debugging functions in gengtype. From df421545d314192e9a4ac2868754f34590d73027 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Sun, 4 Oct 2015 22:50:02 +0300 Subject: [PATCH 5/7] Generators - v2 --- gcc/genautomata.c | 2 +- gcc/genconditions.c | 2 ++ gcc/genextract.c | 9 +++++---- gcc/gengtype.c | 6 ------ gcc/gengtype.h | 5 ----- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/gcc/genautomata.c b/gcc/genautomata.c index 5196d68..beae5ef 100644 --- a/gcc/genautomata.c +++ b/gcc/genautomata.c @@ -879,7 +879,7 @@ struct state_ainsn_table /* Macros to access members of unions. Use only them for access to union members of declarations and regexps. */ -#if defined ENABLE_CHECKING && (GCC_VERSION >= 2007) +#if CHECKING_P && (GCC_VERSION >= 2007) #define DECL_UNIT(d) __extension__ \ (({ __typeof (d) const _decl = (d); \ diff --git a/gcc/genconditions.c b/gcc/genconditions.c index 001e58e..7481ab4 100644 --- a/gcc/genconditions.c +++ b/gcc/genconditions.c @@ -60,6 +60,8 @@ write_header (void) \n\ /* Do not allow checking to confuse the issue. */\n\ #undef ENABLE_CHECKING\n\ +#undef CHECKING_P\n\ +#define CHECKING_P 0\n\ #undef ENABLE_TREE_CHECKING\n\ #undef ENABLE_RTL_CHECKING\n\ #undef ENABLE_RTL_FLAG_CHECKING\n\ diff --git a/gcc/genextract.c b/gcc/genextract.c index fe97701..a03ac97 100644 --- a/gcc/genextract.c +++ b/gcc/genextract.c @@ -373,10 +373,11 @@ insn_extract (rtx_insn *insn)\n{\n\ rtx pat = PATTERN (insn);\n\ int i ATTRIBUTE_UNUSED; /* only for peepholes */\n\ \n\ -#ifdef ENABLE_CHECKING\n\ - memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\ - memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\ -#endif\n"); + if (flag_checking)\n\ + {\n\ + memset (ro, 0xab, sizeof (*ro) * MAX_RECOG_OPERANDS);\n\ + memset (ro_loc, 0xab, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n\ + }\n"); puts ("\ switch (INSN_CODE (insn))\n\ diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 866d809..b7a33c6 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -158,9 +158,6 @@ size_t num_lang_dirs; BASE_FILES entry for each language. */ static outf_p *base_files; - - -#if ENABLE_CHECKING /* Utility debugging function, printing the various type counts within a list of types. Called through the DBGPRINT_COUNT_TYPE macro. */ void @@ -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, "\n"); } -#endif /* ENABLE_CHECKING */ /* Scan the input file, LIST, and determine how much space we need to store strings in. Also, count the number of language directories @@ -5181,7 +5177,6 @@ main (int argc, char **argv) parse_program_options (argc, argv); -#if ENABLE_CHECKING if (do_debug) { time_t now = (time_t) 0; @@ -5189,7 +5184,6 @@ main (int argc, char **argv) DBGPRINTF ("gengtype started pid %d at %s", (int) getpid (), ctime (&now)); } -#endif /* ENABLE_CHECKING */ /* Parse the input list and the input files. */ DBGPRINTF ("inputlist %s", inputlist); diff --git a/gcc/gengtype.h b/gcc/gengtype.h index 83f3632..b8ce7ce 100644 --- a/gcc/gengtype.h +++ b/gcc/gengtype.h @@ -492,17 +492,12 @@ extern int do_dump; /* (-d) program argument. */ gengtype source code). Only useful to debug gengtype itself. */ extern int do_debug; /* (-D) program argument. */ -#if ENABLE_CHECKING #define DBGPRINTF(Fmt,...) do {if (do_debug) \ fprintf (stderr, "%s:%d: " Fmt "\n", \ lbasename (__FILE__),__LINE__, ##__VA_ARGS__);} while (0) void dbgprint_count_type_at (const char *, int, const char *, type_p); #define DBGPRINT_COUNT_TYPE(Msg,Ty) do {if (do_debug) \ 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) \ for (type_p sub = (TYPE); sub; sub = sub->u.s.base_class) \ -- 2.1.4