From patchwork Sat May 13 23:23:13 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: 93634 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6020024vqo; Sat, 13 May 2023 16:40:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6FBZcwUQWTdcGkH9GgEEL5ObpWP5gdMTHOS98ZqcPIjbgfiZh9AiPJytiJcHIYxa2Kl1Ox X-Received: by 2002:a17:907:94c3:b0:969:e7da:fca0 with SMTP id dn3-20020a17090794c300b00969e7dafca0mr18316022ejc.8.1684021245546; Sat, 13 May 2023 16:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684021245; cv=none; d=google.com; s=arc-20160816; b=HlKzSsTLrpXTgudypNke6gdDpcwo6jADfynwIz9PrUt/JolEs5dwN4X4akZDTkYkvI 7NSRUPZA1GLB++fRdZhG7Rrmzt8B/7RaADXRs9Cv3IdP1ZsBbDzO2PYc9ZOnJ1GBn5sB pPW1AdeRTIxwhluF9ZRzZnsTgodBr4aTf8gFO19/janEqaPy6pwPk/e9TcZWS2sQOfww 8CGHyCiDw5V0HkXc7k8+wbBRGwEc5SyekAGoQwQn7bp+R0Haxc6AAEJ8HgOfdo5v3GFT SBypqMbhNbFVl1cluFrQrfe3bDDFMD0IOIrhcDq+lP400G13vycSKgdv04e6AGjKjJqb fYiw== 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=hPMp9fqLPTamnu8RY1H/m9OJoctTSt8rsgmO/n6C47U=; b=EQ6G0kh1USEOuk4FZ5auKfm+IZiZYlTYc0FHxMfS7N+Xga5lXBnyIveVqkLqsZ+J/Q VH5nuA05QcZFXR/NuBU++u9/HbSeqpYowhRIcdWbTaqxni7txxDpOPbmWaQDdnql+PvN uUpEeCstGSr+HQ/zTojzMzl90uVwPZ5o2sueplH7GyRNJnfLK8lry+8uaPd7tu4qlCXF 6FiESU+OUYC5Ec9fNEtcl2K/ZeTPzWwB17z0N5dKlQTermV1gjp1bO53ZlmdbR+pyyzH DMN6vJsHF2ttslJPGT2yNXJozZAYF1xUNBnVmZg0fd9RLzqg3dfRzR8NmuRhOaIwVlth Vqhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ub3zeUwj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sb39-20020a1709076da700b00969f9e8a75dsi10362404ejc.1046.2023.05.13.16.40.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:40:45 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Ub3zeUwj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 37FF53857714 for ; Sat, 13 May 2023 23:40:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37FF53857714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684021244; bh=hPMp9fqLPTamnu8RY1H/m9OJoctTSt8rsgmO/n6C47U=; 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=Ub3zeUwjWOnhzSJFOo31g9Wz1SGNQY+xV5vYu2vgTkUYovtEO4ZxM9r9tbpiJcb7n t71ETftJ9xa73KBGM3p2HIOfApgf531Zlr01bAiH1vlcHDv2u7TicUGwkFtF5ee40q Ncah/LGOA1CUharfeQgf1KOQTRjQCqOmIpUEAsyE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id D94A93858D3C; Sat, 13 May 2023 23:39:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D94A93858D3C Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-96aae59bbd6so397337166b.3; Sat, 13 May 2023 16:39:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684021198; x=1686613198; 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=hPMp9fqLPTamnu8RY1H/m9OJoctTSt8rsgmO/n6C47U=; b=HGaOuOijMKzz/9XD+Qc6klg6BQRO8TAVGnQfKxyf1cG9AbY6o2Kj65lKXnAeGB3m4e PRXypNtzHWkC6NZgB7xhWDLJdngYE3nY9VJt7WsaQhURFy4Ze/Lf9GhIlOJnjZK44XRq C0rsje6NJIcGzO6pmRfLIEZ/jnRUpOFvRFQbtEhxl8zJ34x3vdiFmRfUVAe4lnhWBOAI D6CtTIbMkoVUjpOfZs1t+WQFhKomGunxE7mbkTsWJHDYjXg4LkxqFVie4dSVradrgizh v+r/y18P7I14ZgaXj0pRXznNvaqJzC00toecmxZ/1C1TDpoDS0v0OnSOo+TdGHNTxPcC slBg== X-Gm-Message-State: AC+VfDwuoBpJ6OEK0yHCKzqtfp7UcNLkTECUuh2nnppP0e9tz8fqJljL 7GMj11wvafm8K6ZJPHzDR3bkQWcbvIo= X-Received: by 2002:a17:907:1c03:b0:94e:4489:f24d with SMTP id nc3-20020a1709071c0300b0094e4489f24dmr28119768ejc.61.1684021197848; Sat, 13 May 2023 16:39:57 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id v9-20020a170906338900b0094ee99eeb01sm7356621eja.150.2023.05.13.16.39.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:39:57 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001Amb-08; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 06/14] lto: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:13 +0200 Message-Id: <20230513232321.279733-7-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.4 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?1765824261727665351?= X-GMAIL-MSGID: =?utf-8?q?1765824261727665351?= From: Bernhard Reutner-Fischer gcc/ChangeLog: * lto-streamer-in.cc (lto_input_var_decl_ref): Use _P defines from tree.h. (lto_read_body_or_constructor): Ditto. * lto-streamer-out.cc (tree_is_indexable): Ditto. (lto_output_var_decl_ref): Ditto. (DFS::DFS_write_tree_body): Ditto. (wrap_refs): Ditto. (write_symbol_extension_info): Ditto. gcc/lto/ChangeLog: * lto-common.cc (lto_maybe_register_decl): * lto-symtab.cc (warn_type_compatibility_p): (lto_symtab_resolve_replaceable_p): (lto_symtab_merge_decls_1): * lto-symtab.h (lto_symtab_prevailing_decl): --- gcc/lto-streamer-in.cc | 4 ++-- gcc/lto-streamer-out.cc | 11 +++++------ gcc/lto/lto-common.cc | 2 +- gcc/lto/lto-symtab.cc | 8 ++++---- gcc/lto/lto-symtab.h | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc index 03cb41cfa16..2cb83406db5 100644 --- a/gcc/lto-streamer-in.cc +++ b/gcc/lto-streamer-in.cc @@ -671,7 +671,7 @@ lto_input_var_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data) unsigned int ix_u = streamer_read_uhwi (ib); tree result = (*file_data->current_decl_state ->streams[LTO_DECL_STREAM])[ix_u]; - gcc_assert (TREE_CODE (result) == VAR_DECL); + gcc_assert (VAR_P (result)); return result; } @@ -1653,7 +1653,7 @@ lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symta if (TYPE_P (t)) { - gcc_assert (TYPE_CANONICAL (t) == NULL_TREE); + gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t)); if (type_with_alias_set_p (t) && canonical_type_used_p (t)) TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t); diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc index 0bca530313c..5ab2eb4301e 100644 --- a/gcc/lto-streamer-out.cc +++ b/gcc/lto-streamer-out.cc @@ -178,7 +178,7 @@ tree_is_indexable (tree t) && lto_variably_modified_type_p (DECL_CONTEXT (t))) return false; else - return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME); + return (IS_TYPE_OR_DECL_P (t) || TREE_CODE (t) == SSA_NAME); } @@ -346,7 +346,7 @@ void lto_output_var_decl_ref (struct lto_out_decl_state *decl_state, struct lto_output_stream * obs, tree decl) { - gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); + gcc_checking_assert (VAR_P (decl)); streamer_write_uhwi_stream (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM], decl)); @@ -1078,8 +1078,7 @@ DFS::DFS_write_tree_body (struct output_block *ob, else if (RECORD_OR_UNION_TYPE_P (expr)) for (tree t = TYPE_FIELDS (expr); t; t = TREE_CHAIN (t)) DFS_follow_tree_edge (t); - else if (TREE_CODE (expr) == FUNCTION_TYPE - || TREE_CODE (expr) == METHOD_TYPE) + else if (FUNC_OR_METHOD_TYPE_P (expr)) DFS_follow_tree_edge (TYPE_ARG_TYPES (expr)); if (!POINTER_TYPE_P (expr)) @@ -2626,7 +2625,7 @@ wrap_refs (tree *tp, int *ws, void *) { tree t = *tp; if (handled_component_p (t) - && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL + && VAR_P (TREE_OPERAND (t, 0)) && TREE_PUBLIC (TREE_OPERAND (t, 0))) { tree decl = TREE_OPERAND (t, 0); @@ -3064,7 +3063,7 @@ write_symbol_extension_info (tree t) ? GCCST_VARIABLE : GCCST_FUNCTION); lto_write_data (&c, 1); unsigned char section_kind = 0; - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) { section *s = get_variable_section (t, false); if (s->common.flags & SECTION_BSS) diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc index 882dd8971a4..537570204b3 100644 --- a/gcc/lto/lto-common.cc +++ b/gcc/lto/lto-common.cc @@ -958,7 +958,7 @@ lto_register_function_decl_in_symtab (class data_in *data_in, tree decl, static void lto_maybe_register_decl (class data_in *data_in, tree t, unsigned ix) { - if (TREE_CODE (t) == VAR_DECL) + if (VAR_P (t)) lto_register_var_decl_in_symtab (data_in, t, ix); else if (TREE_CODE (t) == FUNCTION_DECL && !fndecl_built_in_p (t)) diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc index 2b57d0d5371..79ba8ddde20 100644 --- a/gcc/lto/lto-symtab.cc +++ b/gcc/lto/lto-symtab.cc @@ -214,7 +214,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type, /* Function types needs special care, because types_compatible_p never thinks prototype is compatible to non-prototype. */ - if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE) + if (FUNC_OR_METHOD_TYPE_P (type)) { if (TREE_CODE (type) != TREE_CODE (prevailing_type)) lev |= 1; @@ -401,7 +401,7 @@ lto_symtab_resolve_replaceable_p (symtab_node *e) || DECL_WEAK (e->decl)) return true; - if (TREE_CODE (e->decl) == VAR_DECL) + if (VAR_P (e->decl)) return (DECL_COMMON (e->decl) || (!flag_no_common && !DECL_INITIAL (e->decl))); @@ -803,7 +803,7 @@ lto_symtab_merge_decls_1 (symtab_node *first) This is needed for C++ typeinfos, for example in lto/20081204-1 there are typeifos in both units, just one of them do have size. */ - if (TREE_CODE (prevailing->decl) == VAR_DECL) + if (VAR_P (prevailing->decl)) { for (e = prevailing->next_sharing_asm_name; e; e = e->next_sharing_asm_name) @@ -848,7 +848,7 @@ lto_symtab_merge_decls_1 (symtab_node *first) break; case FUNCTION_DECL: - gcc_assert (TREE_CODE (e->decl) == VAR_DECL); + gcc_assert (VAR_P (e->decl)); error_at (DECL_SOURCE_LOCATION (e->decl), "function %qD redeclared as variable", prevailing->decl); diff --git a/gcc/lto/lto-symtab.h b/gcc/lto/lto-symtab.h index f654f2cdebb..a60f262869b 100644 --- a/gcc/lto/lto-symtab.h +++ b/gcc/lto/lto-symtab.h @@ -46,7 +46,7 @@ lto_symtab_prevailing_decl (tree decl) return DECL_CHAIN (decl); else { - if ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL) + if ((VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL) && DECL_VIRTUAL_P (decl) && (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)) && !symtab_node::get (decl))