From patchwork Sat May 9 20:11:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1286856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=adacore-com.20150623.gappssmtp.com header.i=@adacore-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=Ezy1n+/T; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49KJMw5S1Yz9sNH for ; Sun, 10 May 2020 06:15:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7947C3840C36; Sat, 9 May 2020 20:15:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 10132385DC0C for ; Sat, 9 May 2020 20:14:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 10132385DC0C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=botcazou@adacore.com Received: by mail-wr1-x436.google.com with SMTP id g13so5973712wrb.8 for ; Sat, 09 May 2020 13:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=yHMxzsFbQeojVqXR/tzjsphE0dOGkGJEISrChTijKDw=; b=Ezy1n+/TQsGQ8znFm61qZJUJ6eUdelIK1BDqoBPRwUMdrVmd/LGfp5M6w+Vn4fEtiP /G23xpCGUoadhccnrHWao2fvyM8dm2gKjPih6MmsiGkAvj2TQnLFBTqc6aWQA5MCVtFo y2oif03H3N0bebVWwaExoK0z5p7jo9wMleLRXe+arN26DPlumZQ9HeLkMQ0v8Ywfk8CP gisCgvdUgAhuscOc2bSSoUN8VFU5yqldrGadkS718gg0hYyqqut/UcwJ4sUZcentXyPW bEXbTwNK43oBI0DQh9hlD3pdZwxwN9K+0etrNgzwBtvIY814MM0jJAqI7CHXcR41M2K8 9zkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=yHMxzsFbQeojVqXR/tzjsphE0dOGkGJEISrChTijKDw=; b=muisAl2kI256wUR17IlvLHmDnmg7KgyWa7X77dl0GM68Wj7JiXidiJTaKmce7svv6i GbcMVoCM/ld1zTVYPVTU85AU50iQgGIcGVLeRbBiezr92TE14WvPh3dG6whl8dol/Re9 eLO4g3se8F15H98boALpaI7kRzKBOP965fwPBhWRHwkuRnf24cNOlMmzkkQsOLNCUxfm Bs7chxFhkYgIGGjhi04/ZBlTOzMA9FZyjaJjTfxcHdi5mTlq+F4Epqo+a3b1glDTFHka 4lOH4TvyvBmrb7Bkfp06G4xW7yRORZbUyVXmFDaEQcxERbwoTN12B30gc6iNrJWhGs+O /CvQ== X-Gm-Message-State: AGi0PuYlNYYwaCUWKL1cZhBYjkGhu7fbD6fBiTppJKMhCTxhDa0FeofU ddvfx1aW+xVL5YOxunkn2fLrmiGV/+5ayA== X-Google-Smtp-Source: APiQypJO2FFqN8SaTwW/NeXGbr33pVY2uds75c3RAHkH8XoeNPJZL2epygrPXj1k7BpcfQmnBE83sQ== X-Received: by 2002:adf:f344:: with SMTP id e4mr9907794wrp.395.1589055296840; Sat, 09 May 2020 13:14:56 -0700 (PDT) Received: from polaris.localnet ([2a01:e0a:41b:9230:1a03:73ff:fe45:373a]) by smtp.gmail.com with ESMTPSA id g135sm1886317wme.22.2020.05.09.13.14.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 May 2020 13:14:56 -0700 (PDT) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Remove last use of expr_align Date: Sat, 09 May 2020 22:11:38 +0200 Message-ID: <8194624.2DZtM55l0p@polaris> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" It was in the ada/gcc-interface directory and is outdated. Tested on x86-64/Linux, applied on the mainline. 2020-05-09 Eric Botcazou * tree.h (expr_align): Delete. * tree.c (expr_align): Likewise. 2020-05-09 Eric Botcazou * gcc-interface/utils2.c: Include builtins.h. (known_alignment) : Use DECL_ALIGN for DECL_P operands and get_object_alignment for the rest. diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 6ff1372899c..30d08f50896 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -32,6 +32,7 @@ #include "alias.h" #include "tree.h" #include "inchash.h" +#include "builtins.h" #include "fold-const.h" #include "stor-layout.h" #include "stringpool.h" @@ -167,7 +168,10 @@ known_alignment (tree exp) break; case ADDR_EXPR: - this_alignment = expr_align (TREE_OPERAND (exp, 0)); + if (DECL_P (TREE_OPERAND (exp, 0))) + this_alignment = DECL_ALIGN (TREE_OPERAND (exp, 0)); + else + this_alignment = get_object_alignment (TREE_OPERAND (exp, 0)); break; case CALL_EXPR: diff --git a/gcc/tree.c b/gcc/tree.c index 397474900ff..5b7d3fddbcb 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3351,51 +3351,6 @@ int_byte_position (const_tree field) return tree_to_shwi (byte_position (field)); } -/* Return the strictest alignment, in bits, that T is known to have. */ - -unsigned int -expr_align (const_tree t) -{ - unsigned int align0, align1; - - switch (TREE_CODE (t)) - { - CASE_CONVERT: case NON_LVALUE_EXPR: - /* If we have conversions, we know that the alignment of the - object must meet each of the alignments of the types. */ - align0 = expr_align (TREE_OPERAND (t, 0)); - align1 = TYPE_ALIGN (TREE_TYPE (t)); - return MAX (align0, align1); - - case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR: - case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR: - case CLEANUP_POINT_EXPR: - /* These don't change the alignment of an object. */ - return expr_align (TREE_OPERAND (t, 0)); - - case COND_EXPR: - /* The best we can do is say that the alignment is the least aligned - of the two arms. */ - align0 = expr_align (TREE_OPERAND (t, 1)); - align1 = expr_align (TREE_OPERAND (t, 2)); - return MIN (align0, align1); - - /* FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set - meaningfully, it's always 1. */ - case LABEL_DECL: case CONST_DECL: - case VAR_DECL: case PARM_DECL: case RESULT_DECL: - case FUNCTION_DECL: - gcc_assert (DECL_ALIGN (t) != 0); - return DECL_ALIGN (t); - - default: - break; - } - - /* Otherwise take the alignment from that of the type. */ - return TYPE_ALIGN (TREE_TYPE (t)); -} - /* Return, as a tree node, the number of elements for TYPE (which is an ARRAY_TYPE) minus one. This counts only elements of the top array. */ diff --git a/gcc/tree.h b/gcc/tree.h index c51c4b651d4..4644d6616d9 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4641,7 +4641,6 @@ extern hashval_t type_hash_canon_hash (tree); extern tree type_hash_canon (unsigned int, tree); extern tree convert (tree, tree); -extern unsigned int expr_align (const_tree); extern tree size_in_bytes_loc (location_t, const_tree); inline tree size_in_bytes (const_tree t)