From patchwork Sat May 13 23:23:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 93627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6016373vqo; Sat, 13 May 2023 16:29:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qDWCX9mbiHUgDwdu2c5RCd/3sLjvRSMDw7Bj0uSxr/2FZmjuo4uuwee47xqgLm4K8UeDc X-Received: by 2002:a17:907:3d9e:b0:96a:bb6:7309 with SMTP id he30-20020a1709073d9e00b0096a0bb67309mr18421524ejc.62.1684020570445; Sat, 13 May 2023 16:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020570; cv=none; d=google.com; s=arc-20160816; b=jo0/Yua/X7SlZpR3HIkrT9npoi10CujMuV6mJC9WnZmN5OA8TVLkftFNP0PYCZ/8fZ gNrCANd4vuxycHm0gEOVIA5Zh9Ga834jCqOaxJwGtNG07E8v6kpfN5sdJ3MKY86+JW72 0hnnzjPvRUg41ZknMIAk3Bou6o8+nrQMt4dbuzMGHr5QINa3bm2OD2xRzK8i1vEZ4rvf 3b0YoJ8E8JgRYFwx2BSKbDg6KiF3WqicKo2zo5yOjdveqncmBgs0krOu3z7CCD+XfHcG R6dEwgZA7LW2meBL4ijsI6nGNVoXQoofeyLjAX752U5fNztELwK+5R/k5Aqb6e+d+DYn FjiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=3sMHHQ8gEZtgAclcE8kvW8NCY8sZ7hnfueaVLOuhScE=; b=cuZee5epZsCOXqrPcbLCdBxvnYiPmgbzklV1zLr+lC1Qb9Ug96pCd9Htvan9krRF/t y8GxU+qTviLaAnY468ZZEyjaHmdQKjR1NwxFB5T5TRA1vLbkntFICC1aZyoL5PdRwcf+ OGgwUdVn3onQ0Fb2IkThBt2RWqkiFA9yk+UN4SoyFL5kX5rThpnVJYaWBYvZbxbmX07f +7irMKrVgFXfPk91aNa55DBYzr+eKkYbzxeg1utgev3vbEHJA7QWRQ5Xt4Wz+SFPkvCE lSkY0JvAF6JBUyHhbqNSZUBUz3Ukr7E0J7jEyvVB6lo240yomUkN2SERkEl1q/vZb5IA oS/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YrfQbNb7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n24-20020a17090673d800b009614fd83fddsi9851420ejl.654.2023.05.13.16.29.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=YrfQbNb7; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 01BB4382BC39 for ; Sat, 13 May 2023 23:26:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01BB4382BC39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020390; bh=3sMHHQ8gEZtgAclcE8kvW8NCY8sZ7hnfueaVLOuhScE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=YrfQbNb7/kzWhxwOSLeJyWTlBr50qdl0a9YzyYIy49Lj39eYv0Q4oY7eDU4bmtweH JZDT5UDzexJYguJLYZUukaubZqQG3GfFFOO55auR+WV7Dh2FXFF+0v/jbYa1W1+XQ9 oNLOOPYi6tMuRYGIw1eUVEpCxF6s0AASO9BA76kg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id EFDE83857729; Sat, 13 May 2023 23:23:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFDE83857729 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-96598a7c5e0so1828289066b.3; Sat, 13 May 2023 16:23:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020234; x=1686612234; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3sMHHQ8gEZtgAclcE8kvW8NCY8sZ7hnfueaVLOuhScE=; b=Nei+F2bmd6PJ0DdZCNxmxudHaYLconWQqt1jU+6mKGAaViUR2oik/uoEcJ/LwyqaxV eCrtPiOn+FFbvvqRrzg7SKMCEiJ/CPaEtt+xEEK0g6/8B5psYcVTHCNHrCU8OpIIpz8r qhwWBEx0r4stNZ4OqdM+OsT5LQsUS6XHnproJUd6uOUoEANAaCU63JvcA9bt2EbeliS/ MHw7RkKMTMxKoiwSj6MYGHwQHUeOO1sWQVLzxUPKWelRVLWQ4aLhVi9G+3cBY2JQSy6k iEUR4IPpTH7ob+5XTu08N8z0s3hFb8mrm8naRNLVfh8tbV1sFNH2aPfz9vr5kZeak1x0 Dwbg== X-Gm-Message-State: AC+VfDwFf6Ak9A0Q91EJffTxvFeFcKTRTevY9KnLALUUMtb1zaPBUEIn qJ06mQAUOLXz30568YNRjEfdsclfy9Y= X-Received: by 2002:a17:907:96a4:b0:96a:1f7c:3207 with SMTP id hd36-20020a17090796a400b0096a1f7c3207mr17664025ejc.19.1684020234195; Sat, 13 May 2023 16:23:54 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id ml23-20020a170906cc1700b0094ea3a32694sm7368777ejb.190.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:48 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amj-0L; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 08/14] fortran: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:15 +0200 Message-Id: <20230513232321.279733-9-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com> References: <20230513232321.279733-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765823553373165305?= X-GMAIL-MSGID: =?utf-8?q?1765823553373165305?= From: Bernhard Reutner-Fischer gcc/fortran/ChangeLog: * trans-array.cc (is_pointer_array): Use _P() defines from tree.h. (gfc_conv_scalarized_array_ref): Ditto. (gfc_conv_array_ref): Ditto. * trans-decl.cc (gfc_finish_decl): Ditto. (gfc_get_symbol_decl): Ditto. * trans-expr.cc (gfc_trans_pointer_assignment): Ditto. (gfc_trans_arrayfunc_assign): Ditto. (gfc_trans_assignment_1): Ditto. * trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto. (conv_intrinsic_ieee_value): Ditto. * trans-io.cc (gfc_convert_array_to_string): Ditto. * trans-openmp.cc (gfc_omp_is_optional_argument): Ditto. (gfc_trans_omp_clauses): Ditto. * trans-stmt.cc (gfc_conv_label_variable): Ditto. * trans.cc (gfc_build_addr_expr): Ditto. (get_array_span): Ditto. --- gcc/fortran/trans-array.cc | 10 +++++----- gcc/fortran/trans-decl.cc | 4 ++-- gcc/fortran/trans-expr.cc | 6 +++--- gcc/fortran/trans-intrinsic.cc | 4 ++-- gcc/fortran/trans-io.cc | 2 +- gcc/fortran/trans-openmp.cc | 7 +++---- gcc/fortran/trans-stmt.cc | 2 +- gcc/fortran/trans.cc | 4 ++-- 8 files changed, 19 insertions(+), 20 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 9f8aa09673a..15719845ca8 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -880,7 +880,7 @@ is_pointer_array (tree expr) || GFC_CLASS_TYPE_P (TREE_TYPE (expr))) return false; - if (TREE_CODE (expr) == VAR_DECL + if (VAR_P (expr) && GFC_DECL_PTR_ARRAY_P (expr)) return true; @@ -888,7 +888,7 @@ is_pointer_array (tree expr) && GFC_DECL_PTR_ARRAY_P (expr)) return true; - if (TREE_CODE (expr) == INDIRECT_REF + if (INDIRECT_REF_P (expr) && GFC_DECL_PTR_ARRAY_P (TREE_OPERAND (expr, 0))) return true; @@ -3803,7 +3803,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar, { if (TREE_CODE (info->descriptor) == COMPONENT_REF) decl = info->descriptor; - else if (TREE_CODE (info->descriptor) == INDIRECT_REF) + else if (INDIRECT_REF_P (info->descriptor)) decl = TREE_OPERAND (info->descriptor, 0); if (decl == NULL_TREE) @@ -4057,7 +4057,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, { if (TREE_CODE (se->expr) == COMPONENT_REF) decl = se->expr; - else if (TREE_CODE (se->expr) == INDIRECT_REF) + else if (INDIRECT_REF_P (se->expr)) decl = TREE_OPERAND (se->expr, 0); else decl = se->expr; @@ -4069,7 +4069,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr, if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se->expr))) { decl = se->expr; - if (TREE_CODE (decl) == INDIRECT_REF) + if (INDIRECT_REF_P (decl)) decl = TREE_OPERAND (decl, 0); } else diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index cd32542eb86..7f21dc2b09f 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -558,7 +558,7 @@ gfc_finish_decl (tree decl) return; if (DECL_SIZE (decl) == NULL_TREE - && TYPE_SIZE (TREE_TYPE (decl)) != NULL_TREE) + && COMPLETE_TYPE_P (TREE_TYPE (decl))) layout_decl (decl, 0); /* A few consistency checks. */ @@ -1889,7 +1889,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) length = fold_convert (gfc_charlen_type_node, length); gfc_finish_var_decl (length, sym); if (!sym->attr.associate_var - && TREE_CODE (length) == VAR_DECL + && VAR_P (length) && sym->value && sym->value->expr_type != EXPR_NULL && sym->value->ts.u.cl->length) { diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index d902e8f3281..292aba76aaa 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -10246,7 +10246,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_conv_descriptor_data_set (&block, desc, data); /* Copy the span. */ - if (TREE_CODE (rse.expr) == VAR_DECL + if (VAR_P (rse.expr) && GFC_DECL_PTR_ARRAY_P (rse.expr)) span = gfc_conv_descriptor_span_get (rse.expr); else @@ -10933,7 +10933,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2) { tmp = sym->backend_decl; lhs = sym->backend_decl; - if (TREE_CODE (tmp) == INDIRECT_REF) + if (INDIRECT_REF_P (tmp)) tmp = TREE_OPERAND (tmp, 0); sym->backend_decl = gfc_create_var (TREE_TYPE (tmp), "lhs"); gfc_add_modify (&se.pre, sym->backend_decl, tmp); @@ -11883,7 +11883,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred && !(VAR_P (rse.string_length) || TREE_CODE (rse.string_length) == PARM_DECL - || TREE_CODE (rse.string_length) == INDIRECT_REF)) + || INDIRECT_REF_P (rse.string_length))) string_length = gfc_evaluate_now (rse.string_length, &rse.pre); else if (expr2->ts.type == BT_CHARACTER) { diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index e0c171d5f25..a0e1110c5e0 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -4112,7 +4112,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op) /* Handle absent optional arguments by ignoring the comparison. */ if (argexpr->expr->expr_type == EXPR_VARIABLE && argexpr->expr->symtree->n.sym->attr.optional - && TREE_CODE (val) == INDIRECT_REF) + && INDIRECT_REF_P (val)) { cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node, @@ -10155,7 +10155,7 @@ conv_intrinsic_ieee_value (gfc_se *se, gfc_expr *expr) arg = gfc_evaluate_now (arg, &se->pre); type = gfc_typenode_for_spec (&expr->ts); - gcc_assert (TREE_CODE (type) == REAL_TYPE); + gcc_assert (SCALAR_FLOAT_TYPE_P (type)); ret = gfc_create_var (type, NULL); gfc_init_block (&body); diff --git a/gcc/fortran/trans-io.cc b/gcc/fortran/trans-io.cc index 9b54d2f0d31..0c0e3332778 100644 --- a/gcc/fortran/trans-io.cc +++ b/gcc/fortran/trans-io.cc @@ -791,7 +791,7 @@ gfc_convert_array_to_string (gfc_se * se, gfc_expr * e) } else { - gcc_assert (TREE_CODE (se->expr) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (se->expr)); tree ptr = TREE_OPERAND (se->expr, 0); gcc_assert (TREE_CODE (ptr) == POINTER_PLUS_EXPR); diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 96aecdd1cb3..16ffb74a0f7 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -73,7 +73,7 @@ static bool gfc_omp_is_optional_argument (const_tree decl) { /* Note: VAR_DECL can occur with BIND(C) and array descriptors. */ - return ((TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL) + return ((TREE_CODE (decl) == PARM_DECL || VAR_P (decl)) && DECL_LANG_SPECIFIC (decl) && TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))) @@ -3334,9 +3334,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, } } else if (present - && TREE_CODE (decl) == INDIRECT_REF - && (TREE_CODE (TREE_OPERAND (decl, 0)) - == INDIRECT_REF)) + && INDIRECT_REF_P (decl) + && INDIRECT_REF_P (TREE_OPERAND (decl, 0))) { /* A single indirectref is handled by the middle end. */ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (decl))); diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 589f200162a..b5b82941b41 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -82,7 +82,7 @@ gfc_conv_label_variable (gfc_se * se, gfc_expr * expr) if (TREE_CODE (se->expr) == COMPONENT_REF) se->expr = TREE_OPERAND (se->expr, 1); /* Deals with dummy argument. Get the parameter declaration. */ - else if (TREE_CODE (se->expr) == INDIRECT_REF) + else if (INDIRECT_REF_P (se->expr)) se->expr = TREE_OPERAND (se->expr, 0); } diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index f7745add045..0b32b6896cd 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -332,7 +332,7 @@ gfc_build_addr_expr (tree type, tree t) else natural_type = build_pointer_type (base_type); - if (TREE_CODE (t) == INDIRECT_REF) + if (INDIRECT_REF_P (t)) { if (!type) type = natural_type; @@ -365,7 +365,7 @@ get_array_span (tree type, tree decl) if (TREE_CODE (decl) == COMPONENT_REF && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) return gfc_conv_descriptor_span_get (decl); - else if (TREE_CODE (decl) == INDIRECT_REF + else if (INDIRECT_REF_P (decl) && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))) return gfc_conv_descriptor_span_get (decl);