From patchwork Mon Oct 22 08:47:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 193116 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 4A5C52C008C for ; Mon, 22 Oct 2012 19:50:21 +1100 (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=1351500622; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=NNldtH60pCHn9gU9S3rom/w81XI=; b=bdRfBLgA1ElHI04 BGopTWrSMEv9dxEhdg2mS7BkakbJ3UAKMM9WzynkQZS3D6erdIOronYXkwXQ2sWY uaMn1fYt6NuWTNLQtmE24wlU12UlMIBQP96IuDqOYQqz1inzdAkZ3TRh+WPVEGo7 006n3Oq5HbUFdXRnMhVF/UhTtWzw= 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:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=TYKLT9Jq+uYqw1K96V2H8fs7Rf0E6jQGAoYKXor56Fp+ZkEh3CXDJMPZoye8sZ rIPKYJDJCkntPKDOnYWdjETCoQfCNYt67Z6Ja5kB5BREAQ7lVEPfC9Zxgp2zPZi4 bEZCxXnjPcEJoUrsh9266v95anOVqQIZckMTYMuMuke1k=; Received: (qmail 3042 invoked by alias); 22 Oct 2012 08:50:15 -0000 Received: (qmail 3031 invoked by uid 22791); 22 Oct 2012 08:50:15 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Oct 2012 08:50:10 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 06B93290B2B for ; Mon, 22 Oct 2012 10:50:10 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KC8UsFNbbW-4 for ; Mon, 22 Oct 2012 10:50:09 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id C8E50290B26 for ; Mon, 22 Oct 2012 10:50:09 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Adjust rest_of_record_type_compilation to sizetype change Date: Mon, 22 Oct 2012 10:47:30 +0200 Message-ID: <7904484.PoSFYKUNpJ@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 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 The function does a bit of pattern matching to emit the special encoding for variable-sized record types in the debug info and it needs to be adjusted to the sizetype change. Tested on x86_64-suse-linux, applied on the mainline. 2012-10-22 Eric Botcazou * gcc-interface/utils.c (rest_of_record_type_compilation): Simplify and robustify pattern machine code for masking operations. Index: gcc-interface/utils.c =================================================================== --- gcc-interface/utils.c (revision 192648) +++ gcc-interface/utils.c (working copy) @@ -1731,19 +1731,23 @@ rest_of_record_type_compilation (tree re tree offset = TREE_OPERAND (curpos, 0); align = tree_low_cst (TREE_OPERAND (curpos, 1), 1); - /* An offset which is a bitwise AND with a negative power of 2 - means an alignment corresponding to this power of 2. Note - that, as sizetype is sign-extended but nonetheless unsigned, - we don't directly use tree_int_cst_sgn. */ + /* An offset which is a bitwise AND with a mask increases the + alignment according to the number of trailing zeros. */ offset = remove_conversions (offset, true); if (TREE_CODE (offset) == BIT_AND_EXPR - && host_integerp (TREE_OPERAND (offset, 1), 0) - && TREE_INT_CST_HIGH (TREE_OPERAND (offset, 1)) < 0) + && TREE_CODE (TREE_OPERAND (offset, 1)) == INTEGER_CST) { - unsigned int pow - = - tree_low_cst (TREE_OPERAND (offset, 1), 0); - if (exact_log2 (pow) > 0) - align *= pow; + unsigned HOST_WIDE_INT mask + = TREE_INT_CST_LOW (TREE_OPERAND (offset, 1)); + unsigned int i; + + for (i = 0; i < HOST_BITS_PER_WIDE_INT; i++) + { + if (mask & 1) + break; + mask >>= 1; + align *= 2; + } } pos = compute_related_constant (curpos,