From patchwork Sat May 10 20:24:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 347732 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 4AE8D140098 for ; Sun, 11 May 2014 06:24:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=YcqOS6uHbxsAsoU5B2OqaFO5TfhhW ZmjHFGwYB6k5cI15IoaVD71pfgkYW0nbynmkOmpQDT6RiV6eP5oyPEviXRfhGpTz AyUurtWp2yYgERW07d1E8GeezCtXPmL/RIFijoTXmQ1rcRMS6S1+kucf933szL9D glHsPCY5WktJ7A= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=dzoyJ4UH57U0H1GS46SxT4o0HwI=; b=t41 4rn4ub/cxlyeZE+dJRIIJO5uY/Kn3gcjLuIxK2kf/X7/W/+muKLiIXIvkYMYfktR lSfYuwUWhK4WRfQq//DtrBx/zXwTS/fthrUbaF0oap2CaIs8gD9Doe51BaneQtUq 7ybGzCqBjtnDBY7s940rLOCKUSIbo7lQljpV2sKI= Received: (qmail 16614 invoked by alias); 10 May 2014 20:24:34 -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 16596 invoked by uid 89); 10 May 2014 20:24:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wi0-f173.google.com Received: from mail-wi0-f173.google.com (HELO mail-wi0-f173.google.com) (209.85.212.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 10 May 2014 20:24:27 +0000 Received: by mail-wi0-f173.google.com with SMTP id bs8so2800433wib.0 for ; Sat, 10 May 2014 13:24:24 -0700 (PDT) X-Received: by 10.194.95.195 with SMTP id dm3mr14032695wjb.17.1399753464826; Sat, 10 May 2014 13:24:24 -0700 (PDT) Received: from localhost ([2.26.169.52]) by mx.google.com with ESMTPSA id h1sm10739300wjy.7.2014.05.10.13.24.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 May 2014 13:24:24 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [PATCH 7/7] Move SYMBOL_REF_FLAGS to rtx header References: <87a9ap1k8n.fsf@talisman.default> Date: Sat, 10 May 2014 21:24:23 +0100 In-Reply-To: <87a9ap1k8n.fsf@talisman.default> (Richard Sandiford's message of "Sat, 10 May 2014 20:55:52 +0100") Message-ID: <87fvkhz8js.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Very much like the code to move ORIGINAL_REGNO, but with a few more knock-on changes. I handled the printing by dumping the flags immediately before the SYMBOL_REF_DATA. Tested on x86_64-linux-gnu. OK to install? Thanks, Richard gcc/ * rtl.def (SYMBOL_REF): Remove middle "0" field. * rtl.h (block_symbol): Reduce number of fields to 2. (rtx_def): Add u2.symbol_ref_flags. (SYMBOL_REF_FLAGS): Use it. (SYMBOL_REF_DATA, SET_SYMBOL_REF_DECL, SYMBOL_REF_DECL) (SET_SYMBOL_REF_CONSTANT, SYMBOL_REF_CONSTANT): Lower index. * gengtype.c (adjust_field_rtx_def): Remove SYMBOL_REF_FLAGS handling. Lower index of SYMBOL_REF_DATA. * print-rtl.c (print_rtx): Lower index for SYMBOL_REF_DATA. Print SYMBOL_REF_FLAGS at the same time. * genattrtab.c (attr_rtx_1): Only initialize 1 "0" SYMBOL_REF field. Index: gcc/rtl.def =================================================================== --- gcc/rtl.def 2014-05-10 21:17:11.883121021 +0100 +++ gcc/rtl.def 2014-05-10 21:22:23.685816826 +0100 @@ -429,10 +429,9 @@ DEF_RTL_EXPR(LABEL_REF, "label_ref", "u" /* Reference to a named label: Operand 0: label name - Operand 1: flags (see SYMBOL_FLAG_* in rtl.h) - Operand 2: tree from which this symbol is derived, or null. + Operand 1: tree from which this symbol is derived, or null. This is either a DECL node, or some kind of constant. */ -DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s00", RTX_CONST_OBJ) +DEF_RTL_EXPR(SYMBOL_REF, "symbol_ref", "s0", RTX_CONST_OBJ) /* The condition code register is represented, in our imagination, as a register holding a value that can be compared to zero. Index: gcc/rtl.h =================================================================== --- gcc/rtl.h 2014-05-10 21:17:11.883121021 +0100 +++ gcc/rtl.h 2014-05-10 21:22:23.686816835 +0100 @@ -211,7 +211,7 @@ struct GTY(()) reg_attrs { if SYMBOL_REF_HAS_BLOCK_INFO_P is true. */ struct GTY(()) block_symbol { /* The usual SYMBOL_REF fields. */ - rtunion GTY ((skip)) fld[3]; + rtunion GTY ((skip)) fld[2]; /* The block that contains this object. */ struct object_block *block; @@ -362,6 +362,9 @@ struct GTY((chain_next ("RTX_NEXT (&%h)" /* The INSN_UID of an RTX_INSN-class code. */ int insn_uid; + /* The SYMBOL_REF_FLAGS of a SYMBOL_REF. */ + unsigned int symbol_ref_flags; + /* The PAT_VAR_LOCATION_STATUS of a VAR_LOCATION. */ enum var_init_status var_location_status; @@ -1765,24 +1768,24 @@ #define SYMBOL_REF_WEAK(RTX) \ /* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or SYMBOL_REF_CONSTANT. */ -#define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 2) +#define SYMBOL_REF_DATA(RTX) X0ANY ((RTX), 1) /* Set RTX's SYMBOL_REF_DECL to DECL. RTX must not be a constant pool symbol. */ #define SET_SYMBOL_REF_DECL(RTX, DECL) \ - (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 2) = (DECL)) + (gcc_assert (!CONSTANT_POOL_ADDRESS_P (RTX)), X0TREE ((RTX), 1) = (DECL)) /* The tree (decl or constant) associated with the symbol, or null. */ #define SYMBOL_REF_DECL(RTX) \ - (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 2)) + (CONSTANT_POOL_ADDRESS_P (RTX) ? NULL : X0TREE ((RTX), 1)) /* Set RTX's SYMBOL_REF_CONSTANT to C. RTX must be a constant pool symbol. */ #define SET_SYMBOL_REF_CONSTANT(RTX, C) \ - (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 2) = (C)) + (gcc_assert (CONSTANT_POOL_ADDRESS_P (RTX)), X0CONSTANT ((RTX), 1) = (C)) /* The rtx constant pool entry for a symbol, or null. */ #define SYMBOL_REF_CONSTANT(RTX) \ - (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 2) : NULL) + (CONSTANT_POOL_ADDRESS_P (RTX) ? X0CONSTANT ((RTX), 1) : NULL) /* A set of flags on a symbol_ref that are, in some respects, redundant with information derivable from the tree decl associated with this symbol. @@ -1791,7 +1794,9 @@ #define SYMBOL_REF_CONSTANT(RTX) \ this information to avoid recomputing it. Finally, this allows space for the target to store more than one bit of information, as with SYMBOL_REF_FLAG. */ -#define SYMBOL_REF_FLAGS(RTX) X0INT ((RTX), 1) +#define SYMBOL_REF_FLAGS(RTX) \ + (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAGS", (RTX), SYMBOL_REF) \ + ->u2.symbol_ref_flags) /* These flags are common enough to be defined for all targets. They are computed by the default version of targetm.encode_section_info. */ Index: gcc/gengtype.c =================================================================== --- gcc/gengtype.c 2014-05-10 21:13:06.242993283 +0100 +++ gcc/gengtype.c 2014-05-10 21:22:23.685816826 +0100 @@ -1250,8 +1250,6 @@ adjust_field_rtx_def (type_p t, options_ else if (i == REG && aindex == 1) t = reg_attrs_tp, subname = "rt_reg"; else if (i == SYMBOL_REF && aindex == 1) - t = scalar_tp, subname = "rt_int"; - else if (i == SYMBOL_REF && aindex == 2) t = symbol_union_tp, subname = ""; else if (i == JUMP_TABLE_DATA && aindex >= 4) t = scalar_tp, subname = "rt_int"; Index: gcc/print-rtl.c =================================================================== --- gcc/print-rtl.c 2014-05-10 21:13:03.384968484 +0100 +++ gcc/print-rtl.c 2014-05-10 21:22:23.686816835 +0100 @@ -224,9 +224,6 @@ print_rtx (const_rtx in_rtx) int flags = SYMBOL_REF_FLAGS (in_rtx); if (flags) fprintf (outfile, " [flags %#x]", flags); - } - else if (i == 2 && GET_CODE (in_rtx) == SYMBOL_REF) - { tree decl = SYMBOL_REF_DECL (in_rtx); if (decl) print_node_brief (outfile, "", decl, dump_flags); Index: gcc/genattrtab.c =================================================================== --- gcc/genattrtab.c 2014-05-10 21:05:11.673853221 +0100 +++ gcc/genattrtab.c 2014-05-10 21:22:23.684816818 +0100 @@ -472,10 +472,7 @@ attr_rtx_1 (enum rtx_code code, va_list rt_val = rtx_alloc (code); XSTR (rt_val, 0) = arg0; if (code == SYMBOL_REF) - { - X0EXP (rt_val, 1) = NULL_RTX; - X0EXP (rt_val, 2) = NULL_RTX; - } + X0EXP (rt_val, 1) = NULL_RTX; } } else if (GET_RTX_LENGTH (code) == 2