aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssanames.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-07-16 20:44:02 +0200
committerAldy Hernandez <aldyh@redhat.com>2023-07-17 09:17:59 +0200
commit53cf0c583b0d80f9db95edfde5778b11c572559f (patch)
tree9cf80a217f1b715228ba91ec491c012df6dfcaf9 /gcc/tree-ssanames.cc
parent56cf8b01fe1d4d4bb33a107e5d490f589d5f05bc (diff)
downloadgcc-53cf0c583b0d80f9db95edfde5778b11c572559f.zip
gcc-53cf0c583b0d80f9db95edfde5778b11c572559f.tar.gz
gcc-53cf0c583b0d80f9db95edfde5778b11c572559f.tar.bz2
Add global setter for value/mask pair for SSA names.
This patch provides a way to set the value/mask pair of known bits globally, similarly to how we can use set_nonzero_bits for known 0 bits. This can then be used by CCP and IPA to set value/mask info instead of throwing away the known 1 bits. In further clean-ups, I will see if it makes sense to remove set_nonzero_bits altogether, since it is subsumed by value/mask. gcc/ChangeLog: * tree-ssanames.cc (set_bitmask): New. * tree-ssanames.h (set_bitmask): New.
Diffstat (limited to 'gcc/tree-ssanames.cc')
-rw-r--r--gcc/tree-ssanames.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index 5fdb6a3..f543943 100644
--- a/gcc/tree-ssanames.cc
+++ b/gcc/tree-ssanames.cc
@@ -465,6 +465,21 @@ set_nonzero_bits (tree name, const wide_int &mask)
set_range_info (name, r);
}
+/* Update the known bits of NAME.
+
+ Zero bits in MASK cover constant values. Set bits in MASK cover
+ unknown values. VALUE are the known bits. */
+
+void
+set_bitmask (tree name, const wide_int &value, const wide_int &mask)
+{
+ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
+
+ int_range<2> r (TREE_TYPE (name));
+ r.update_bitmask (irange_bitmask (value, mask));
+ set_range_info (name, r);
+}
+
/* Return a widest_int with potentially non-zero bits in SSA_NAME
NAME, the constant for INTEGER_CST, or -1 if unknown. */