From patchwork Thu Sep 22 13:39:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Preudhomme X-Patchwork-Id: 673405 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 3sfyKt2pt9z9t25 for ; Thu, 22 Sep 2016 23:40:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=heCd2w7j; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=m5rydpkc7w8+waf3vi1VvTIHWxiXjvAOfss5zW/6CawfZiC52c GOr9eGQ0CoQWZhBrwohHmehTgE3tOlKSiyVjliXbdNX7PIBvOAqhyILQS9V3wbGp PblytYaSSV0KIEeGrEfwS8gGFiKiXM7IU3oUsVSBThQZXpDfoU1SnIyNI= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=5hbOPe+Z+CRNKAB6Qk5GQKy52Cw=; b=heCd2w7jOTtZd6u5l7r6 uwxb3Z6xlCmvwGIpDocnkt7WG8EoEf2YQD9cRTcUx2Vs1h8aclJr641ja1BFORvu hGFsaBubQEwlj0XR3V1hjPr1Ug8PBITLNvtwf6myJhSUwNN3DwADKpVqaxYBy/QK BtKLGNTHikC10ITU4/4hJ4c= Received: (qmail 85880 invoked by alias); 22 Sep 2016 13:40:05 -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 85854 invoked by uid 89); 22 Sep 2016 13:40:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=UD:diagnostic-core.h, dfh, 231, 7, SYNC X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Sep 2016 13:39:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6325217C; Thu, 22 Sep 2016 06:39:52 -0700 (PDT) Received: from [10.2.206.52] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5A123F21A; Thu, 22 Sep 2016 06:39:51 -0700 (PDT) To: "gcc-patches@gcc.gnu.org" , Richard Biener , Jakub Jelinek From: Thomas Preudhomme Subject: [PATCH, 1/7] Move memory model declarations in memmodel.h Message-ID: <5c3a83ab-454c-b3e0-3683-5d7bf53a3093@foss.arm.com> Date: Thu, 22 Sep 2016 14:39:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, This patch is part of a patch series to add support for ARMv8-M[1] to GCC. This specific patch moves memory model declarations in memmodel.h. Currently, is_mm_* memory model related functions are declared in tree.h which prevents using them in constraints machine description files. This patch move this functions into a new memmodel.h header to allow such a thing and update all users of this function to include the new header. ChangeLog entries are as follows: *** gcc/ChangeLog *** 2016-04-20 Thomas Preud'homme * tree.h (memmodel_from_int, memmodel_base, is_mm_relaxed, is_mm_consume, is_mm_acquire, is_mm_release, is_mm_acq_rel, is_mm_seq_cst, is_mm_sync): Move to ... * memmodel.h: This. New file. * builtins.c: Include memmodel.h. * optabs.c: Likewise. * tsan.c: Likewise. * config/aarch64/aarch64.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/i386/i386.c: Likewise. * config/ia64/ia64.c: Likewise. * config/mips/mips.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/sparc/sparc.c: Likewise. * genconditions.c: Include memmodel.h in generated file. * genemit.c: Likewise. * genoutput.c: Likewise. * genpeep.c: Likewise. * genpreds.c: Likewise. * genrecog.c: Likewise. *** gcc/c-family/ChangeLog *** 2016-04-20 Thomas Preud'homme * c-common.c: Include memmodel.h. Is this ok for trunk? Best regards, Thomas diff --git a/gcc/builtins.c b/gcc/builtins.c index b981bcd281af29cdbb1d6bcc1e9f93b769708897..3d9c8aa38b44446aea03b2f4ddc59222f19ba078 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "predict.h" #include "tm_p.h" diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 399ba975184e934bc061113286787840a7531291..a74301fa6de1897007635574ab36058572d953b3 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "function.h" #include "tree.h" +#include "memmodel.h" #include "c-common.h" #include "gimple-expr.h" #include "tm_p.h" diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 5efad462f11f2954a65386b3b6b8d51bd61c51c1..913e026f54cc8464ba9cee0dbecd2a711458dc41 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -26,6 +26,7 @@ #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "cfghooks.h" #include "cfgloop.h" diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 702cd277ede8860c53d3ce4c03a8c6d81f7b5c5b..488902741504bc2f93424da6e80e83270d24edd2 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "df.h" #include "tm_p.h" diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 946f308ca84e232af8af6eca4813464914cbd59c..97b3ef1673a98f406aed023f5715c35ebf69b07e 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -27,6 +27,7 @@ #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "cfghooks.h" #include "df.h" #include "tm_p.h" diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 3ac115c64f717f928eeb8085fea941383121df85..00c5a3db569e0d1758a8e96b3ff1b9f4446b6ad7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "backend.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "cfghooks.h" #include "cfgloop.h" diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index ebd2c86b8d8f917248453070105b1fb5178bc7a3..1f3628b254cac4ef9ea0e72024fe309c4d0eb0da 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "cfghooks.h" #include "df.h" #include "tm_p.h" diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 88f4038224a9cdc904cbf15b2a5833b6525702ab..3586a1001e7a920571b1be6d41f9a8e1345f33cc 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "cfghooks.h" #include "df.h" diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 557009f8099736960e4a7371104543def9d00bb9..11bde4af87d2eb468707c0e02ea6747d29fdabb8 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24,6 +24,7 @@ #include "backend.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "cfghooks.h" #include "cfgloop.h" diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 254b72298a36d57625f9d6555e2c295e684178e8..80b8b0e34c84e155aa46e236768fb344b076eb59 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "df.h" #include "tm_p.h" diff --git a/gcc/genconditions.c b/gcc/genconditions.c index e4f45b097cd01fdacb44916bde492160600f6113..d8b0ebba56b8db4bea9e0edced03293152e51d02 100644 --- a/gcc/genconditions.c +++ b/gcc/genconditions.c @@ -94,6 +94,7 @@ write_header (void) #include \"resource.h\"\n\ #include \"diagnostic-core.h\"\n\ #include \"reload.h\"\n\ +#include \"memmodel.h\"\n\ #include \"tm-constrs.h\"\n"); if (saw_eh_return) diff --git a/gcc/genemit.c b/gcc/genemit.c index 33040aac36da564cbab4ff66abf868671c17c951..d5e07a97a6d50f7b744e9d67ad49e72046e9df03 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -792,6 +792,7 @@ from the machine description file `md'. */\n\n"); printf ("#include \"reload.h\"\n"); printf ("#include \"diagnostic-core.h\"\n"); printf ("#include \"regs.h\"\n"); + printf ("#include \"memmodel.h\"\n"); printf ("#include \"tm-constrs.h\"\n"); printf ("#include \"ggc.h\"\n"); printf ("#include \"dumpfile.h\"\n"); diff --git a/gcc/genoutput.c b/gcc/genoutput.c index f8c25ac4df0532de7f59a27f94280f2858ac12cd..59092580e49e27cc679e444606a892f08ab8c4bd 100644 --- a/gcc/genoutput.c +++ b/gcc/genoutput.c @@ -231,6 +231,7 @@ output_prologue (void) printf ("#include \"diagnostic-core.h\"\n"); printf ("#include \"output.h\"\n"); printf ("#include \"target.h\"\n"); + printf ("#include \"memmodel.h\"\n"); printf ("#include \"tm-constrs.h\"\n"); } diff --git a/gcc/genpeep.c b/gcc/genpeep.c index 132cdced690a43aba222caa516f12302e561ede9..e1997e03e476de910c57f7854b7b62edd5360b8f 100644 --- a/gcc/genpeep.c +++ b/gcc/genpeep.c @@ -373,6 +373,7 @@ from the machine description file `md'. */\n\n"); printf ("#include \"except.h\"\n"); printf ("#include \"diagnostic-core.h\"\n"); printf ("#include \"flags.h\"\n"); + printf ("#include \"memmodel.h\"\n"); printf ("#include \"tm-constrs.h\"\n\n"); printf ("extern rtx peep_operand[];\n\n"); diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 4c9dfc65664a5a15c1bff80d59ae675498769f55..fdba81825789b658f5bdcd6af6bc955e9daf0553 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -1577,6 +1577,7 @@ write_insn_preds_c (void) #include \"reload.h\"\n\ #include \"regs.h\"\n\ #include \"emit-rtl.h\"\n\ +#include \"memmodel.h\"\n\ #include \"tm-constrs.h\"\n"); FOR_ALL_PREDICATES (p) diff --git a/gcc/genrecog.c b/gcc/genrecog.c index 056798c82f7a7719e0a14ccec4156a3f6c21793f..778610744923bb1cd3e9ecfb5c93faa1c142063a 100644 --- a/gcc/genrecog.c +++ b/gcc/genrecog.c @@ -4192,6 +4192,7 @@ write_header (void) #include \"diagnostic-core.h\"\n\ #include \"reload.h\"\n\ #include \"regs.h\"\n\ +#include \"memmodel.h\"\n\ #include \"tm-constrs.h\"\n\ \n"); diff --git a/gcc/memmodel.h b/gcc/memmodel.h new file mode 100644 index 0000000000000000000000000000000000000000..d53eb7bc9d9966c2b1510e584f0fd50b13cde572 --- /dev/null +++ b/gcc/memmodel.h @@ -0,0 +1,86 @@ +/* Prototypes of memory model helper functions. + Copyright (C) 2015-2016 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +. */ + +#ifndef GCC_MEMMODEL_H +#define GCC_MEMMODEL_H + +/* Return the memory model from a host integer. */ +static inline enum memmodel +memmodel_from_int (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_MASK); +} + +/* Return the base memory model from a host integer. */ +static inline enum memmodel +memmodel_base (unsigned HOST_WIDE_INT val) +{ + return (enum memmodel) (val & MEMMODEL_BASE_MASK); +} + +/* Return TRUE if the memory model is RELAXED. */ +static inline bool +is_mm_relaxed (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED; +} + +/* Return TRUE if the memory model is CONSUME. */ +static inline bool +is_mm_consume (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME; +} + +/* Return TRUE if the memory model is ACQUIRE. */ +static inline bool +is_mm_acquire (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE; +} + +/* Return TRUE if the memory model is RELEASE. */ +static inline bool +is_mm_release (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE; +} + +/* Return TRUE if the memory model is ACQ_REL. */ +static inline bool +is_mm_acq_rel (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL; +} + +/* Return TRUE if the memory model is SEQ_CST. */ +static inline bool +is_mm_seq_cst (enum memmodel model) +{ + return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST; +} + +/* Return TRUE if the memory model is a SYNC variant. */ +static inline bool +is_mm_sync (enum memmodel model) +{ + return (model & MEMMODEL_SYNC); +} + +#endif /* GCC_MEMMODEL_H */ diff --git a/gcc/optabs.c b/gcc/optabs.c index 87b4f978420dfd2df3d915985509912d85c94569..36afdc2c4b2bae683ed8fd76d91fbd4dca69a06a 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "predict.h" #include "tm_p.h" #include "expmed.h" diff --git a/gcc/tree.h b/gcc/tree.h index 38ee81675757902f147ac3d4e068bbdb56f925c9..dfbcb36ee772b72fc6c45e12845f38f0fb35a2ac 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4670,69 +4670,6 @@ extern void warn_deprecated_use (tree, tree); extern void cache_integer_cst (tree); extern const char *combined_fn_name (combined_fn); -/* Return the memory model from a host integer. */ -static inline enum memmodel -memmodel_from_int (unsigned HOST_WIDE_INT val) -{ - return (enum memmodel) (val & MEMMODEL_MASK); -} - -/* Return the base memory model from a host integer. */ -static inline enum memmodel -memmodel_base (unsigned HOST_WIDE_INT val) -{ - return (enum memmodel) (val & MEMMODEL_BASE_MASK); -} - -/* Return TRUE if the memory model is RELAXED. */ -static inline bool -is_mm_relaxed (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELAXED; -} - -/* Return TRUE if the memory model is CONSUME. */ -static inline bool -is_mm_consume (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_CONSUME; -} - -/* Return TRUE if the memory model is ACQUIRE. */ -static inline bool -is_mm_acquire (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQUIRE; -} - -/* Return TRUE if the memory model is RELEASE. */ -static inline bool -is_mm_release (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_RELEASE; -} - -/* Return TRUE if the memory model is ACQ_REL. */ -static inline bool -is_mm_acq_rel (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_ACQ_REL; -} - -/* Return TRUE if the memory model is SEQ_CST. */ -static inline bool -is_mm_seq_cst (enum memmodel model) -{ - return (model & MEMMODEL_BASE_MASK) == MEMMODEL_SEQ_CST; -} - -/* Return TRUE if the memory model is a SYNC variant. */ -static inline bool -is_mm_sync (enum memmodel model) -{ - return (model & MEMMODEL_SYNC); -} - /* Compare and hash for any structure which begins with a canonical pointer. Assumes all pointers are interchangeable, which is sort of already assumed by gcc elsewhere IIRC. */ diff --git a/gcc/tsan.c b/gcc/tsan.c index aa95f4ee69e0eaf0e5a8e9651733c663b0d7ae76..deafce86f3f3a69bc125e2162443744824cafc02 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "backend.h" #include "rtl.h" #include "tree.h" +#include "memmodel.h" #include "gimple.h" #include "tree-pass.h" #include "ssa.h"