aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-query.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2024-05-17 10:44:27 -0400
committerAndrew MacLeod <amacleod@redhat.com>2024-05-23 16:48:44 -0400
commit6c64a85ebec448503c3247fc30923e14cc7074fd (patch)
tree20dd7c01f3da0c38b8f5d3596bc2e517bacd26c6 /gcc/value-query.cc
parentfca649dedaf6c4025ae3471cc1f322a90ebdd19a (diff)
downloadgcc-6c64a85ebec448503c3247fc30923e14cc7074fd.zip
gcc-6c64a85ebec448503c3247fc30923e14cc7074fd.tar.gz
gcc-6c64a85ebec448503c3247fc30923e14cc7074fd.tar.bz2
Allow components to be shared among range-queries.
Ranger and the ranger cache need to share components, this provides a blessed way to do so. * gimple-range.cc (gimple_ranger::gimple_ranger): Share the components from ranger_cache. (gimple_ranger::~gimple_ranger): Don't clear pointer. * value-query.cc (range_query::share_query): New. (range_query::range_query): Clear shared component flag. (range_query::~range_query): Don't free shared component copies. * value-query.h (share_query): New prototype. (m_shared_copy_p): New member.
Diffstat (limited to 'gcc/value-query.cc')
-rw-r--r--gcc/value-query.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index db64a95..adcc59c 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -211,13 +211,24 @@ range_query::destroy_relation_oracle ()
}
}
+void
+range_query::share_query (range_query &q)
+{
+ m_relation = q.m_relation;
+ m_shared_copy_p = true;
+}
+
range_query::range_query ()
{
m_relation = &default_relation_oracle;
+ m_shared_copy_p = false;
}
range_query::~range_query ()
{
+ // Do not destroy anything if this is a shared copy.
+ if (m_shared_copy_p)
+ return;
destroy_relation_oracle ();
}