From patchwork Sat May 13 23:23:09 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: 93621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6015269vqo; Sat, 13 May 2023 16:25:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6hRh7jKtLdlzZWBejiorXVmQo/gXI0EkttO4H4cEGjjRqvjtnCpYdpfHUptsit3d/fT4QB X-Received: by 2002:a17:907:d16:b0:966:391b:5b3e with SMTP id gn22-20020a1709070d1600b00966391b5b3emr25213910ejc.55.1684020318281; Sat, 13 May 2023 16:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020318; cv=none; d=google.com; s=arc-20160816; b=Y1UyKd+7QfG+r/hxAX+GxOiHllyDn+AGzvvYfu0H/Q55WPclq7geChg/wYbRNQsg35 /klSn0wxX/VtZ3wov1+o1U3MuY8AyO1+XmI+oFAPtbusWZxUwsRXazFCw4SsTLg3kR+A a5HUvNUE2+mSk716Lf6gyvx3g1F8LJ6L/5EEd5gi3i/GLdsmotCMHXP17sLn+8Z9xuCL SqyhilpvYhNgaW0r+FcU0dj3r89pHXb4hbivAn4F8rLDOoRf8KN8Ii3YMWu8fawkw9/Y 6R+G4VZeR5Vvlwr57kEUT8P1Au9Hx8QqRXKoPGkKrKB3/RtSNA/e5meaOhQroM3sHzFw izvQ== 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=dre9x3IV/wtfaEtbToyVfLoniK6q7RxUOHq+sVkHQqA=; b=ytLH7KtGl13Ju7oGxCFim7jn7oabPrDCJRoLARWuJd6yEWkQKaUop8Dc4tpyNNh0Qw vQQCdPx6nOnhFxQhoJXjBRB+8mTdPHGlmkZRv15lZByKo1ha44vhavQWOWmyvpWwLZVT SOUfv7XU4xi2Ioh38p/zXm02Dq6/6O8CTsvJKNaqOH1LBV4lqDgM5saR8dX+INUziMrO 1d9uc4voaNkIGm3JgDGjJPv5dPTCQ15VOpH05Yq88upjlBV8SgHBMUIUEDMApl+vYKKK LVKsPALIOjb+o5CLPazInm0+LJrgEE1wkEHCi4A5bwPzw3nmZoBpIEwyoTXrFROqLEyU +dtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=XqCY2anO; 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 y13-20020a170906070d00b00965d9892ba7si10905027ejb.551.2023.05.13.16.25.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:25:18 -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=XqCY2anO; 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 B7EC6385291F for ; Sat, 13 May 2023 23:24:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7EC6385291F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020280; bh=dre9x3IV/wtfaEtbToyVfLoniK6q7RxUOHq+sVkHQqA=; 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=XqCY2anOGyfs1K7bHYPAlEISwk8e2kiJaRBMDQg/Vr0H9USligD0rOWZB2kE/SC1m cZyZs4hEuIo1cE+V+YVBN79u9GOUySPeqgdiBwlXvEOYCUm5FrQqzavq7MtVpNOk81 RA+c2x6blsupVNz193uIA2Vq+1WlyrRezZGusxWo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id A403F385840A; Sat, 13 May 2023 23:23:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A403F385840A Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-50bc570b4a3so20483286a12.1; Sat, 13 May 2023 16:23:51 -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=dre9x3IV/wtfaEtbToyVfLoniK6q7RxUOHq+sVkHQqA=; b=gG8BKGD2whfLJSxAYK+fa0hZ9xQkAnnZ8eJ8dXLiOn4n+ARX1+kkXt/iXu3GeTrGJF VqVEcF4o7llLLp9+Eze0tq/Wor8IEWLX5ns5AQvmkCqGCPgKxVkej+se9tyqXYq3FhE1 DF+SvM4GaVE9XEtegkkRDQrsZl3Je48zSeok8agiX5J9P5yWZqfXFiGUq6rxxZrVvEjY YgSn2x9nMGQuMSKYqyTQc/pqFPe8im2Mo7MAfN53W9UVdHUmnKCvJSra/CG9NtXEBCc+ v9zFGT48i4gWugfCak+XNr3J1I6TNGXVH0gY5exMihuq9dOEbPdQy8gc0qJvDdRPaLUI jxDg== X-Gm-Message-State: AC+VfDyURTJJ1wH4q16N2abih0CxeDgpYOx0422rK+zadHuoeb6OZNgh +EeNiO6xzyIkqRTdhJe1oSSIOUmJTCU= X-Received: by 2002:a17:907:9816:b0:96a:77a2:bba with SMTP id ji22-20020a170907981600b0096a77a20bbamr10435437ejc.60.1684020229440; Sat, 13 May 2023 16:23:49 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id og16-20020a1709071dd000b0096637a19dcasm7326211ejc.4.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-001AmK-34; Sun, 14 May 2023 01:23:47 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 02/14] analyzer: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:09 +0200 Message-Id: <20230513232321.279733-3-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=-9.6 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?1765823289284635239?= X-GMAIL-MSGID: =?utf-8?q?1765823289284635239?= From: Bernhard Reutner-Fischer gcc/analyzer/ChangeLog: * region-model-manager.cc (get_code_for_cast): Use _P defines from tree.h. (region_model_manager::get_or_create_cast): Ditto. (region_model_manager::get_region_for_global): Ditto. * region-model.cc (region_model::get_lvalue_1): Ditto. * region.cc (decl_region::maybe_get_constant_value): Ditto. --- gcc/analyzer/region-model-manager.cc | 8 ++++---- gcc/analyzer/region-model.cc | 2 +- gcc/analyzer/region.cc | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index fab5bba15d5..3b95e432aba 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -507,7 +507,7 @@ get_code_for_cast (tree dst_type, tree src_type) if (!src_type) return NOP_EXPR; - if (TREE_CODE (src_type) == REAL_TYPE) + if (SCALAR_FLOAT_TYPE_P (src_type)) { if (TREE_CODE (dst_type) == INTEGER_TYPE) return FIX_TRUNC_EXPR; @@ -531,9 +531,9 @@ region_model_manager::get_or_create_cast (tree type, const svalue *arg) return arg; /* Don't attempt to handle casts involving vector types for now. */ - if (TREE_CODE (type) == VECTOR_TYPE + if (VECTOR_TYPE_P (type) || (arg->get_type () - && TREE_CODE (arg->get_type ()) == VECTOR_TYPE)) + && VECTOR_TYPE_P (arg->get_type ()))) return get_or_create_unknown_svalue (type); enum tree_code op = get_code_for_cast (type, arg->get_type ()); @@ -1410,7 +1410,7 @@ region_model_manager::get_region_for_label (tree label) const decl_region * region_model_manager::get_region_for_global (tree expr) { - gcc_assert (TREE_CODE (expr) == VAR_DECL); + gcc_assert (VAR_P (expr)); decl_region **slot = m_globals_map.get (expr); if (slot) diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc index fb81d43f91b..3bb3df2f063 100644 --- a/gcc/analyzer/region-model.cc +++ b/gcc/analyzer/region-model.cc @@ -2092,7 +2092,7 @@ region_model::get_lvalue_1 (path_var pv, region_model_context *ctxt) const { gcc_assert (TREE_CODE (expr) == SSA_NAME || TREE_CODE (expr) == PARM_DECL - || TREE_CODE (expr) == VAR_DECL + || VAR_P (expr) || TREE_CODE (expr) == RESULT_DECL); int stack_index = pv.m_stack_depth; diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index a18bfa50d09..8f0eb569b33 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -1162,7 +1162,7 @@ decl_region::get_stack_depth () const const svalue * decl_region::maybe_get_constant_value (region_model_manager *mgr) const { - if (TREE_CODE (m_decl) == VAR_DECL + if (VAR_P (m_decl) && DECL_IN_CONSTANT_POOL (m_decl) && DECL_INITIAL (m_decl) && TREE_CODE (DECL_INITIAL (m_decl)) == CONSTRUCTOR)