public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: [PATCH 02/14] analyzer: use _P() defines from tree.h
Date: Sun, 14 May 2023 01:23:09 +0200	[thread overview]
Message-ID: <20230513232321.279733-3-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com>

From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

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)
-- 
2.30.2


  parent reply	other threads:[~2023-05-13 23:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 23:23 [PATCH 00/14] " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 01/14] ada: " Bernhard Reutner-Fischer
2023-05-14 23:03   ` Jeff Law
2023-05-18 19:59     ` Bernhard Reutner-Fischer
2023-05-15 10:05   ` Eric Botcazou
2023-05-18 19:53     ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` Bernhard Reutner-Fischer [this message]
2023-05-13 23:23 ` [PATCH 03/14] gcc/config/*: " Bernhard Reutner-Fischer
2023-05-14  8:21   ` Iain Sandoe
2023-05-15  7:46     ` Richard Biener
2023-05-13 23:23 ` [PATCH 04/14] c++: " Bernhard Reutner-Fischer
2023-06-01 15:24   ` Patrick Palka
2023-06-01 16:33     ` Bernhard Reutner-Fischer
2023-06-01 18:10       ` Bernhard Reutner-Fischer
2023-08-02 16:51         ` Patrick Palka
2023-08-08 20:31           ` Jason Merrill
2023-11-15 17:42             ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 05/14] m2: " Bernhard Reutner-Fischer
2023-05-14  1:44   ` Gaius Mulley
2023-05-14  1:47   ` Gaius Mulley
2023-05-13 23:23 ` [PATCH 06/14] lto: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener
2023-05-13 23:23 ` [PATCH 07/14] d: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 08/14] fortran: " Bernhard Reutner-Fischer
2023-05-14 13:10   ` Mikael Morin
2023-05-18 15:18     ` Bernhard Reutner-Fischer
2023-05-18 19:20       ` Mikael Morin
2023-05-19 19:19         ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 09/14] rust: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 10/14] c: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 11/14] objc: " Bernhard Reutner-Fischer
2023-05-14  8:13   ` Iain Sandoe
2023-05-13 23:23 ` [PATCH 12/14] go: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 13/14] omp: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 14/14] gcc: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230513232321.279733-3-rep.dot.nop@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=aldot@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).