From patchwork Sat May 13 23:23:08 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: 93630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6016707vqo; Sat, 13 May 2023 16:30:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7I6LYbKb6C23Nz9Qbn/mlPonQddtjyDEbWqaXP1PnrlFDfHQsZ+wcQPf6LN3KPG2NXFX1s X-Received: by 2002:a17:906:9b8f:b0:96a:6c3:5e72 with SMTP id dd15-20020a1709069b8f00b0096a06c35e72mr15118619ejc.10.1684020631277; Sat, 13 May 2023 16:30:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020631; cv=none; d=google.com; s=arc-20160816; b=jgI9+aFMy0PZaktUBcMZJVu2p+EFZMFjqmqArY/vxOnqSoMpxBVW+gv21JLjYZzBxV xYxEwxEgXxCgzrQJAWHEiERELN9fjhJEY2CzmaXW6ruE046j2jCm8kS3/hjo8n1gx7QH fVEQzwPiUEpeTlj4xrpkDUnrdqfB2QXdwoSDOpRssJVHxgVArmOty76VIzl69J6yKRYj 1wKo+TJA+xRJ8aPb9x0K6diwcSRxeZ+VyhefYozFhOsA2/ooyISY1B2i62ddu0Jy2kLe yWY5XAyXieB09lz13/9om71RQOgVw/a9ll69JP/gJ8XykvXvuHEGWJjqa9kH5OuaqM9n zZgg== 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=RBY6jWlcf9eQWCe76s+eqIOlOL/GgZ0HBFaXBDdgUt0=; b=lpjNHOnnG3ZD/db1y0GHeo5vQW7nnP+Gqb0jVobvkrAbtb25y8ezM2L6KvmCDhAlAn hdLm6LZZvuAPR8EbUL0OEY7CJOYAFpaJ5EXUwcaYR2ozYMDa0PQMlYSZ5ea5gq0ps2an o0zYw+KHeoAwN4oSQximXPlz8dirFN7s4uEau4shgjOlTghUuIs59G43mqtHXTYgHUhs 6mRUMZQtDHnOTV4Y3zXjo6+SjwlvUoZjmi3Y39OI0x0ScCzFvcJfWtx8kuQfkbESmJyI MbyguEF5msPdPM9njI3ke6r9qJFE8/IpNl2/gZF9TA83WdGnnzzRAIFNItFrgKX5Bu61 h/9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=MgEihX4p; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k12-20020a170906a38c00b00965e92c658dsi11541716ejz.70.2023.05.13.16.30.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:30:31 -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=MgEihX4p; 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 A5D70388981A for ; Sat, 13 May 2023 23:26:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5D70388981A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020413; bh=RBY6jWlcf9eQWCe76s+eqIOlOL/GgZ0HBFaXBDdgUt0=; 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=MgEihX4p3/1+Xl13bOFCon3m8MDK1UV9g3sMngVNd//fCp4I4RVU3SkIeW/z6ufSr 6FUt+rDx3hhF6Gpxm/N9OV+EGdyix0hnVGSGAELU2RQjIiE73BjZ8PaVXSKBQqUl4Z dvkmGyGdoiKmfqdW4/1710vd0mixrQeVKbwMZjy4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by sourceware.org (Postfix) with ESMTPS id 7CA53385840E; Sat, 13 May 2023 23:23:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CA53385840E Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-50bc0117683so20062990a12.1; Sat, 13 May 2023 16:23:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020230; x=1686612230; 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=RBY6jWlcf9eQWCe76s+eqIOlOL/GgZ0HBFaXBDdgUt0=; b=J5/r6a6a9R/y5DEFU8rpyNEYBbuf3NCL//QCiOxDa5GQQgMM2fX8IkiGtiHo/U8qaw 5LVkfIjGREbpi3B3KZSigOrvU7d98K1TI+/HtBrUNiafzPlioKa8EytwoH9RZ0L78OYE UBuT+J7sDSUJguigK8mOUzN1or6Sraev+M0lwH7LtBntSc7TKzw6i5pEC8vZ49G1BoDU UfhGMq3pV0Qfz+xEGw7ZhirFQrRE1FYEj3L/AokQRwP/4jD+WPVodtx+xIJconghwJtV WQtXDLTkqoDNR6pL/j6MIYNJfmLUnFCKyr4OO2I0eXP13xxP9o+/VFPyoW0miGJ4MRgg jArQ== X-Gm-Message-State: AC+VfDxmB4F5r3TtYF7QgNp4k2KiOSlqD17MRd8OKUVSglMr5vHGmVUZ cHNkhqFv10BH73YxH22KbJ78zjUFatc= X-Received: by 2002:a17:907:6d15:b0:96a:bfc:7335 with SMTP id sa21-20020a1709076d1500b0096a0bfc7335mr14535788ejc.53.1684020230375; Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id fr30-20020a170906891e00b009663115c8f8sm7414049ejc.152.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 1pxyaZ-001AmH-2z; Sun, 14 May 2023 01:23:47 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 01/14] ada: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:08 +0200 Message-Id: <20230513232321.279733-2-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?1765823617245124627?= X-GMAIL-MSGID: =?utf-8?q?1765823617245124627?= From: Bernhard Reutner-Fischer gcc/ada/ChangeLog: * gcc-interface/decl.cc (gnat_to_gnu_entity): Use _P defines from tree.h. (constructor_address_p): Ditto. (elaborate_expression_1): Ditto. * gcc-interface/trans.cc (Identifier_to_gnu): Ditto. (is_nrv_p): Ditto. (Subprogram_Body_to_gnu): Ditto. (gnat_to_gnu): Ditto. (gnat_to_gnu_external): Ditto. (add_decl_expr): Ditto. (gnat_gimplify_expr): Ditto. * gcc-interface/utils.cc (finish_record_type): Ditto. (create_var_decl): Ditto. * gcc-interface/utils2.cc (get_base_type): Ditto. (build_binary_op): Ditto. (build_unary_op): Ditto. (gnat_protect_expr): Ditto. (gnat_invariant_expr): Ditto. --- gcc/ada/gcc-interface/decl.cc | 17 ++++++++--------- gcc/ada/gcc-interface/trans.cc | 20 ++++++++++---------- gcc/ada/gcc-interface/utils.cc | 10 +++++----- gcc/ada/gcc-interface/utils2.cc | 16 ++++++++-------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 20f43de9ea9..ec61593a65b 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -785,7 +785,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if ((TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE && No (gnat_renamed_obj)) || TYPE_IS_DUMMY_P (gnu_type) - || TREE_CODE (gnu_type) == VOID_TYPE) + || VOID_TYPE_P (gnu_type)) { gcc_assert (type_annotate_only); if (this_global) @@ -840,7 +840,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) if (TREE_CODE (gnu_expr) == COMPONENT_REF && TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))) - && TREE_CODE (TREE_OPERAND (gnu_expr, 0)) == VAR_DECL + && VAR_P (TREE_OPERAND (gnu_expr, 0)) && (TREE_READONLY (TREE_OPERAND (gnu_expr, 0)) || DECL_READONLY_ONCE_ELAB (TREE_OPERAND (gnu_expr, 0)))) @@ -1077,7 +1077,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* We need to detect the case where a temporary is created to hold the return value, since we cannot safely rename it at top level as it lives only in the elaboration routine. */ - || (TREE_CODE (inner) == VAR_DECL + || (VAR_P (inner) && DECL_RETURN_VALUE_P (inner)) /* We also need to detect the case where the front-end creates a dangling 'reference to a function call at top level and @@ -1093,10 +1093,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) We cannot safely rename the rewritten expression since the underlying object lives only in the elaboration routine. */ - || (TREE_CODE (inner) == INDIRECT_REF + || (INDIRECT_REF_P (inner) && (inner = remove_conversions (TREE_OPERAND (inner, 0), true)) - && TREE_CODE (inner) == VAR_DECL + && VAR_P (inner) && DECL_RETURN_VALUE_P (inner))) ; @@ -1611,7 +1611,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) and optimization isn't enabled, then force it in memory so that a register won't be allocated to it with possible subparts left uninitialized and reaching the register allocator. */ - else if (TREE_CODE (gnu_decl) == VAR_DECL + else if (VAR_P (gnu_decl) && !DECL_EXTERNAL (gnu_decl) && !TREE_STATIC (gnu_decl) && DECL_MODE (gnu_decl) != BLKmode @@ -6717,8 +6717,7 @@ range_cannot_be_superflat (Node_Id gnat_range) static bool constructor_address_p (tree gnu_expr) { - while (TREE_CODE (gnu_expr) == NOP_EXPR - || TREE_CODE (gnu_expr) == CONVERT_EXPR + while (CONVERT_EXPR_P (gnu_expr) || TREE_CODE (gnu_expr) == NON_LVALUE_EXPR) gnu_expr = TREE_OPERAND (gnu_expr, 0); @@ -7061,7 +7060,7 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, const char *s, expr_variable_p = !(inner - && TREE_CODE (inner) == VAR_DECL + && VAR_P (inner) && (TREE_READONLY (inner) || DECL_READONLY_ONCE_ELAB (inner))); } diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 5fc1a26fede..c26f1b6e1ac 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -1241,7 +1241,7 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) /* Do the final dereference. */ gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); - if ((TREE_CODE (gnu_result) == INDIRECT_REF + if ((INDIRECT_REF_P (gnu_result) || TREE_CODE (gnu_result) == UNCONSTRAINED_ARRAY_REF) && No (Address_Clause (gnat_entity))) TREE_THIS_NOTRAP (gnu_result) = 1; @@ -3391,7 +3391,7 @@ struct nrv_data static inline bool is_nrv_p (bitmap nrv, tree t) { - return TREE_CODE (t) == VAR_DECL && bitmap_bit_p (nrv, DECL_UID (t)); + return VAR_P (t) && bitmap_bit_p (nrv, DECL_UID (t)); } /* Helper function for walk_tree, used by finalize_nrv below. */ @@ -4136,7 +4136,7 @@ Subprogram_Body_to_gnu (Node_Id gnat_node) gnat_param = Next_Formal_With_Extras (gnat_param)) { tree gnu_param = get_gnu_tree (gnat_param); - bool is_var_decl = (TREE_CODE (gnu_param) == VAR_DECL); + bool is_var_decl = VAR_P (gnu_param); annotate_object (gnat_param, TREE_TYPE (gnu_param), NULL_TREE, DECL_BY_REF_P (gnu_param)); @@ -6908,7 +6908,7 @@ gnat_to_gnu (Node_Id gnat_node) && TYPE_CONTAINS_TEMPLATE_P (gnu_result_type)) gnu_aggr_type = TREE_TYPE (DECL_CHAIN (TYPE_FIELDS (gnu_result_type))); - else if (TREE_CODE (gnu_result_type) == VECTOR_TYPE) + else if (VECTOR_TYPE_P (gnu_result_type)) gnu_aggr_type = TYPE_REPRESENTATIVE_ARRAY (gnu_result_type); else gnu_aggr_type = gnu_result_type; @@ -7740,7 +7740,7 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = build2 (INIT_EXPR, void_type_node, gnu_ret_deref, gnu_ret_val); /* Avoid a useless copy with __builtin_return_slot. */ - if (TREE_CODE (gnu_ret_val) == INDIRECT_REF) + if (INDIRECT_REF_P (gnu_ret_val)) gnu_result = build3 (COND_EXPR, void_type_node, fold_build2 (NE_EXPR, boolean_type_node, @@ -8415,7 +8415,7 @@ gnat_to_gnu (Node_Id gnat_node) /* If we're supposed to return something of void_type, it means we have something we're elaborating for effect, so just return. */ - if (TREE_CODE (gnu_result_type) == VOID_TYPE) + if (VOID_TYPE_P (gnu_result_type)) return gnu_result; /* If the result is a constant that overflowed, raise Constraint_Error. */ @@ -8588,7 +8588,7 @@ gnat_to_gnu_external (Node_Id gnat_node) current_function_decl = NULL_TREE; /* Do not import locations from external units. */ - if (gnu_result && EXPR_P (gnu_result)) + if (CAN_HAVE_LOCATION_P (gnu_result)) SET_EXPR_LOCATION (gnu_result, UNKNOWN_LOCATION); return gnu_result; @@ -8722,7 +8722,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node) Note that walk_tree knows how to deal with TYPE_DECL, but neither VAR_DECL nor CONST_DECL. This appears to be somewhat arbitrary. */ MARK_VISITED (gnu_stmt); - if (TREE_CODE (gnu_decl) == VAR_DECL + if (VAR_P (gnu_decl) || TREE_CODE (gnu_decl) == CONST_DECL) { MARK_VISITED (DECL_SIZE (gnu_decl)); @@ -8739,7 +8739,7 @@ add_decl_expr (tree gnu_decl, Node_Id gnat_node) && !TYPE_FAT_POINTER_P (type)) MARK_VISITED (TYPE_ADA_SIZE (type)); - if (TREE_CODE (gnu_decl) == VAR_DECL && (gnu_init = DECL_INITIAL (gnu_decl))) + if (VAR_P (gnu_decl) && (gnu_init = DECL_INITIAL (gnu_decl))) { /* If this is a variable and an initializer is attached to it, it must be valid for the context. Similar to init_const in create_var_decl. */ @@ -9000,7 +9000,7 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, /* The expressions for the RM bounds must be gimplified to ensure that they are properly elaborated. See gimplify_decl_expr. */ - if ((TREE_CODE (op) == TYPE_DECL || TREE_CODE (op) == VAR_DECL) + if ((TREE_CODE (op) == TYPE_DECL || VAR_P (op)) && !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (op)) && (INTEGRAL_TYPE_P (TREE_TYPE (op)) || SCALAR_FLOAT_TYPE_P (TREE_TYPE (op)))) diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 0c4f8b90c8e..460ef6f1f01 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -1966,7 +1966,7 @@ finish_record_type (tree record_type, tree field_list, int rep_level, bool debug_info_p) { const enum tree_code orig_code = TREE_CODE (record_type); - const bool had_size = TYPE_SIZE (record_type) != NULL_TREE; + const bool had_size = COMPLETE_TYPE_P (record_type); const bool had_align = TYPE_ALIGN (record_type) > 0; /* For all-repped records with a size specified, lay the QUAL_UNION_TYPE out just like a UNION_TYPE, since the size will be fixed. */ @@ -2802,7 +2802,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, if (TREE_CODE (inner) == ADDR_EXPR && ((TREE_CODE (TREE_OPERAND (inner, 0)) == CALL_EXPR && !call_is_atomic_load (TREE_OPERAND (inner, 0))) - || (TREE_CODE (TREE_OPERAND (inner, 0)) == VAR_DECL + || (VAR_P (TREE_OPERAND (inner, 0)) && DECL_RETURN_VALUE_P (TREE_OPERAND (inner, 0))))) DECL_RETURN_VALUE_P (var_decl) = 1; } @@ -2853,7 +2853,7 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, support global BSS sections, uninitialized global variables would go in DATA instead, thus increasing the size of the executable. */ if (!flag_no_common - && TREE_CODE (var_decl) == VAR_DECL + && VAR_P (var_decl) && TREE_PUBLIC (var_decl) && !have_global_bss_p ()) DECL_COMMON (var_decl) = 1; @@ -2871,13 +2871,13 @@ create_var_decl (tree name, tree asm_name, tree type, tree init, DECL_IGNORED_P (var_decl) = 1; /* ??? Some attributes cannot be applied to CONST_DECLs. */ - if (TREE_CODE (var_decl) == VAR_DECL) + if (VAR_P (var_decl)) process_attributes (&var_decl, &attr_list, true, gnat_node); /* Add this decl to the current binding level. */ gnat_pushdecl (var_decl, gnat_node); - if (TREE_CODE (var_decl) == VAR_DECL && asm_name) + if (VAR_P (var_decl) && asm_name) { /* Let the target mangle the name if this isn't a verbatim asm. */ if (*IDENTIFIER_POINTER (asm_name) != '*') diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 6c17675f488..c56fccb4a98 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -68,7 +68,7 @@ get_base_type (tree type) while (TREE_TYPE (type) && (TREE_CODE (type) == INTEGER_TYPE - || TREE_CODE (type) == REAL_TYPE)) + || SCALAR_FLOAT_TYPE_P (type))) type = TREE_TYPE (type); return type; @@ -986,7 +986,7 @@ build_binary_op (enum tree_code op_code, tree result_type, break; } - gcc_assert (TREE_CODE (result) == INDIRECT_REF + gcc_assert (INDIRECT_REF_P (result) || TREE_CODE (result) == NULL_EXPR || TREE_CODE (result) == SAVE_EXPR || DECL_P (result)); @@ -1423,7 +1423,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) the corresponding address, e.g. for an allocator. However do it for a return value to expose it for later recognition. */ if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE - || (TREE_CODE (TREE_OPERAND (operand, 1)) == VAR_DECL + || (VAR_P (TREE_OPERAND (operand, 1)) && DECL_RETURN_VALUE_P (TREE_OPERAND (operand, 1)))) { result = build_unary_op (ADDR_EXPR, result_type, @@ -1597,11 +1597,11 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) if (!TYPE_IS_FAT_POINTER_P (type) && TYPE_VOLATILE (TREE_TYPE (type))) { TREE_SIDE_EFFECTS (result) = 1; - if (TREE_CODE (result) == INDIRECT_REF) + if (INDIRECT_REF_P (result)) TREE_THIS_VOLATILE (result) = TYPE_VOLATILE (TREE_TYPE (result)); } - if ((TREE_CODE (result) == INDIRECT_REF + if ((INDIRECT_REF_P (result) || TREE_CODE (result) == UNCONSTRAINED_ARRAY_REF) && can_never_be_null) TREE_THIS_NOTRAP (result) = 1; @@ -2926,7 +2926,7 @@ gnat_protect_expr (tree exp) /* Likewise if we're indirectly referencing part of something. */ if (code == COMPONENT_REF - && TREE_CODE (TREE_OPERAND (exp, 0)) == INDIRECT_REF) + && INDIRECT_REF_P (TREE_OPERAND (exp, 0))) return build3 (code, type, gnat_protect_expr (TREE_OPERAND (exp, 0)), TREE_OPERAND (exp, 1), NULL_TREE); @@ -3263,7 +3263,7 @@ gnat_invariant_expr (tree expr) /* Look through temporaries created to capture values. */ while ((TREE_CODE (expr) == CONST_DECL - || (TREE_CODE (expr) == VAR_DECL && TREE_READONLY (expr))) + || (VAR_P (expr) && TREE_READONLY (expr))) && decl_function_context (expr) == current_function_decl && DECL_INITIAL (expr)) { @@ -3362,7 +3362,7 @@ object: if (TREE_CODE (t) == PARM_DECL) return fold_convert (type, expr); - if (TREE_CODE (t) == VAR_DECL + if (VAR_P (t) && (DECL_EXTERNAL (t) || decl_function_context (t) != current_function_decl)) return fold_convert (type, expr);