From patchwork Wed Jul 25 15:20:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 173199 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]) by ozlabs.org (Postfix) with SMTP id BE65F2C00A0 for ; Thu, 26 Jul 2012 01:20:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343834449; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=mqj1o3k ZhaBILmVRld6aathEmnU=; b=aHEXAgDpo2XPxXNBX062mBP0+apMldEitTizryx 9va9mnPTd2oAMmr556jNoSQHYBKZuflPPhYu/VLDPohKca6IEvraV/jA6YwOmDUb vGIxb8IH0u97E/h+iYdl8W3jeEUqb6bOGg0PMDy3j2ukZrtlJNUBEENG5gqvtD+j Ee+I= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=V1yN31VM1/JqEXPxYSEoqtLJsq87tE1OQy4ZklNukCdZhBmAti3g3+K8G+ZCsF 1acn1Gwi4bKrq+66thuNoyqHZ2r/fmBXlnYWeFNFmc6L8K4u6JWYxIPWmDv3M1Lz PHdm49HiOpt6CH1PiEFciKqTWmknpf0z1NVqsR0KhLQE8=; Received: (qmail 12721 invoked by alias); 25 Jul 2012 15:20:34 -0000 Received: (qmail 12521 invoked by uid 22791); 25 Jul 2012 15:20:32 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Jul 2012 15:20:18 +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 q6PFKHPn015032 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 25 Jul 2012 11:20:17 -0400 Received: from anchor.twiddle.home (vpn-235-148.phx2.redhat.com [10.3.235.148]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6PFKHQd005957 for ; Wed, 25 Jul 2012 11:20:17 -0400 Message-ID: <50100EB1.1020806@redhat.com> Date: Wed, 25 Jul 2012 08:20:17 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: GCC Patches Subject: [PATCH] Fix Ada bootstrap (PR 54092) X-IsSubscribed: yes 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 That's what I get for assuming front-ends don't touch back-end things like optabs and libcalls... I'm reasonably certain that a better solution would be to move the set_stack_check_libfunc declaration elsewhere and/or totally rearrange that specific interface: c.f. lang_hooks.eh_protect_cleanup_actions. That said, there's no practical benefit to using actual enums in this hash table. (Indeed, now that I think about it, it might even be better to use the same sort of packed encoding used for raw_optab_handler; not done here in this patch.) Which lets us lose the dependency on optabs.h, which has an implicit dependency on rtl.h. Which is where we got into trouble with the Ada front end. Tested on x86_64-linux and committed. r~ PR bootstrap/54092 * libfuncs.h: Don't include optabs.h. (struct libfunc_entry): Use "int" for op, mode1, mode2 members. * optabs.c (hash_libfunc): Don't cast members to int. * Makefile.in (LIBFUNCS_H): Don't include OPTABS_H. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 40f7c4d..d7b8a76 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -971,7 +971,7 @@ GCC_PLUGIN_H = gcc-plugin.h highlev-plugin-common.h plugin.def \ $(CONFIG_H) $(SYSTEM_H) $(HASHTAB_H) PLUGIN_H = plugin.h $(GCC_PLUGIN_H) PLUGIN_VERSION_H = plugin-version.h configargs.h -LIBFUNCS_H = libfuncs.h $(HASHTAB_H) $(OPTABS_H) +LIBFUNCS_H = libfuncs.h $(HASHTAB_H) # # Now figure out from those variables how to compile and link. diff --git a/gcc/libfuncs.h b/gcc/libfuncs.h index 75f7a69..262e10f 100644 --- a/gcc/libfuncs.h +++ b/gcc/libfuncs.h @@ -1,5 +1,5 @@ /* Definitions for code generation pass of GNU compiler. - Copyright (C) 2001, 2004, 2007, 2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2001-2012 Free Software Foundation, Inc. This file is part of GCC. @@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see #define GCC_LIBFUNCS_H #include "hashtab.h" -#include "optabs.h" /* Enumeration of indexes into libfunc_table. */ enum libfunc_index @@ -48,12 +47,16 @@ enum libfunc_index LTI_MAX }; -/* Information about an optab-related libfunc. We use the same hashtable - for normal optabs and conversion optabs. In the first case mode2 - is unused. */ +/* Information about an optab-related libfunc. The op field is logically + an enum optab_d, and the mode fields are logically enum machine_mode. + However, in the absence of forward-declared enums, there's no practical + benefit of pulling in the defining headers. + + We use the same hashtable for normal optabs and conversion optabs. In + the first case mode2 is forced to VOIDmode. */ + struct GTY(()) libfunc_entry { - optab op; - enum machine_mode mode1, mode2; + int op, mode1, mode2; rtx libfunc; }; diff --git a/gcc/optabs.c b/gcc/optabs.c index 022adfa..462aa7c 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -75,7 +75,7 @@ static hashval_t hash_libfunc (const void *p) { const struct libfunc_entry *const e = (const struct libfunc_entry *) p; - return (((int) e->mode1 + (int) e->mode2 * NUM_MACHINE_MODES) ^ e->op); + return ((e->mode1 + e->mode2 * NUM_MACHINE_MODES) ^ e->op); } /* Used for libfunc_hash. */