From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29423 invoked by alias); 30 Jul 2013 17:14:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 29323 invoked by uid 89); 30 Jul 2013 17:14:10 -0000 X-Spam-SWARE-Status: No, score=-5.6 required=5.0 tests=AWL,BAYES_05,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.1 Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 30 Jul 2013 17:13:41 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6UHDXve009246 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 30 Jul 2013 13:13:34 -0400 Received: from [10.10.61.198] (vpn-61-198.rdu2.redhat.com [10.10.61.198]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6UHDWxD011944 for ; Tue, 30 Jul 2013 13:13:33 -0400 Message-ID: <51F7F43C.4040003@redhat.com> Date: Tue, 30 Jul 2013 17:14:00 -0000 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/5] Atomic type qualifier - Add type alignment override hook References: <51F2AEB1.60408@redhat.com> <51F7EE86.20805@redhat.com> In-Reply-To: <51F7EE86.20805@redhat.com> Content-Type: multipart/mixed; boundary="------------000803020100070703000004" X-Virus-Found: No X-SW-Source: 2013-07/txt/msg01487.txt.bz2 This is a multi-part message in MIME format. --------------000803020100070703000004 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 136 This patch adds a target hook which a target can use to override the alignment of the lock-free atomic type for a given mode. Andrew --------------000803020100070703000004 Content-Type: text/x-patch; name="f1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="f1.diff" Content-length: 3667 * hooks.c (hook_uint_mode_0): Return 0 unit hook. * hooks.h (hook_uint_mode_0): Prototype. * target.def (atomic_align_for_mode): define hook. * tm.texi (TARGET_ATOMIC_TYPE_FOR_MODE): Define. * doc/tm.texi.in (TARGET_ATOMIC_TYPE_FOR_MODE): Add. Index: gcc/hooks.c =================================================================== *** gcc/hooks.c (revision 201248) --- gcc/hooks.c (working copy) *************** hook_rtx_tree_int_null (tree a ATTRIBUTE *** 352,357 **** --- 352,364 ---- return NULL; } + /* Generic hook that takes a machine mode and returns an unsigned int 0. */ + unsigned int + hook_uint_mode_0 (enum machine_mode m ATTRIBUTE_UNUSED) + { + return 0; + } + /* Generic hook that takes three trees and returns the last one as is. */ tree hook_tree_tree_tree_tree_3rd_identity (tree a ATTRIBUTE_UNUSED, Index: gcc/hooks.h =================================================================== *** gcc/hooks.h (revision 201248) --- gcc/hooks.h (working copy) *************** extern tree hook_tree_tree_tree_tree_3rd *** 89,94 **** --- 89,95 ---- extern tree hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool); extern unsigned hook_uint_void_0 (void); + extern unsigned int hook_uint_mode_0 (enum machine_mode); extern bool default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT, HOST_WIDE_INT, const_tree); Index: gcc/target.def =================================================================== *** gcc/target.def (revision 201248) --- gcc/target.def (working copy) *************** DEFHOOKPOD *** 5116,5122 **** @code{atomic_test_and_set} is not exactly 1, i.e. the\ @code{bool} @code{true}.", unsigned char, 1) ! /* Leave the boolean fields at the end. */ /* True if we can create zeroed data by switching to a BSS section --- 5116,5134 ---- @code{atomic_test_and_set} is not exactly 1, i.e. the\ @code{bool} @code{true}.", unsigned char, 1) ! ! /* Return an unsigned int representing the alignment (in bits) of the atomic ! type which maps to machine MODE. This allows alignment to be overridden ! as needed. */ ! DEFHOOK ! (atomic_align_for_mode, ! "If defined, this function returns an appropriate alignment in bits for an\ ! atomic object of machine_mode @var{mode}. If 0 is returned then the\ ! default alignment for the specified mode is used. ", ! unsigned int, (enum machine_mode mode), ! hook_uint_mode_0) ! ! /* Leave the boolean fields at the end. */ /* True if we can create zeroed data by switching to a BSS section Index: gcc/doc/tm.texi =================================================================== *** gcc/doc/tm.texi (revision 201248) --- gcc/doc/tm.texi (working copy) *************** It returns true if the target supports G *** 11375,11377 **** --- 11375,11381 ---- The support includes the assembler, linker and dynamic linker. The default value of this hook is based on target's libc. @end deftypefn + + @deftypefn {Target Hook} {unsigned int} TARGET_ATOMIC_ALIGN_FOR_MODE (enum machine_mode @var{mode}) + If defined, this function returns an appropriate alignment in bits for an atomic object of machine_mode @var{mode}. If 0 is returned then the default alignment for the specified mode is used. + @end deftypefn Index: gcc/doc/tm.texi.in =================================================================== *** gcc/doc/tm.texi.in (revision 201248) --- gcc/doc/tm.texi.in (working copy) *************** and the associated definitions of those *** 8415,8417 **** --- 8415,8419 ---- @hook TARGET_ATOMIC_TEST_AND_SET_TRUEVAL @hook TARGET_HAS_IFUNC_P + + @hook TARGET_ATOMIC_ALIGN_FOR_MODE --------------000803020100070703000004--