From 0b328720d7235e260244f6c09439db33762e4ef7 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Tue, 19 May 2020 10:22:04 -0400
Subject: [PATCH 147/159] FIXME: delete first revamp_state experiment

---
 gcc/Makefile.in                    |    1 -
 gcc/analyzer/analyzer-selftests.cc |    1 -
 gcc/analyzer/analyzer-selftests.h  |    1 -
 gcc/analyzer/analyzer.h            |    1 -
 gcc/analyzer/engine.cc             |   16 +-
 gcc/analyzer/program-state.cc      |   29 +-
 gcc/analyzer/program-state.h       |   10 +-
 gcc/analyzer/revamp-state.cc       | 1105 ----------------------------
 gcc/analyzer/revamp-state.h        |  593 ---------------
 9 files changed, 11 insertions(+), 1746 deletions(-)
 delete mode 100644 gcc/analyzer/revamp-state.cc
 delete mode 100644 gcc/analyzer/revamp-state.h

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 02dbb476215..4c68e3a087d 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1235,7 +1235,6 @@ ANALYZER_OBJS = \
 	analyzer/program-state.o \
 	analyzer/region-model.o \
 	analyzer/region-model2.o \
-	analyzer/revamp-state.o \
 	analyzer/sm.o \
 	analyzer/sm-file.o \
 	analyzer/sm-malloc.o \
diff --git a/gcc/analyzer/analyzer-selftests.cc b/gcc/analyzer/analyzer-selftests.cc
index 9e412759591..908c97b2746 100644
--- a/gcc/analyzer/analyzer-selftests.cc
+++ b/gcc/analyzer/analyzer-selftests.cc
@@ -60,7 +60,6 @@ run_analyzer_selftests ()
   analyzer_program_state_cc_tests ();
   analyzer_region_model_cc_tests ();
   analyzer_region_model2_cc_tests ();
-  analyzer_revamp_state_cc_tests ();
   analyzer_sm_file_cc_tests ();
   analyzer_sm_signal_cc_tests ();
   //analyzer_store2_cc_tests ();
diff --git a/gcc/analyzer/analyzer-selftests.h b/gcc/analyzer/analyzer-selftests.h
index fad549c4c9b..4bbb6c12ad9 100644
--- a/gcc/analyzer/analyzer-selftests.h
+++ b/gcc/analyzer/analyzer-selftests.h
@@ -42,7 +42,6 @@ extern void analyzer_program_point_cc_tests ();
 extern void analyzer_program_state_cc_tests ();
 extern void analyzer_region_model_cc_tests ();
 extern void analyzer_region_model2_cc_tests ();
-extern void analyzer_revamp_state_cc_tests ();
 extern void analyzer_sm_file_cc_tests ();
 extern void analyzer_sm_signal_cc_tests ();
 extern void analyzer_store2_cc_tests ();
diff --git a/gcc/analyzer/analyzer.h b/gcc/analyzer/analyzer.h
index 905ba42d58a..bec06713210 100644
--- a/gcc/analyzer/analyzer.h
+++ b/gcc/analyzer/analyzer.h
@@ -102,7 +102,6 @@ class state_purge_per_ssa_name;
 class state_change;
 class rewind_info_t;
 
-class engine;
 class engine2;
 
 /* Forward decls of functions.  */
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 04fb76ae68c..53d08f7be3d 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -1502,14 +1502,7 @@ exploded_node::on_stmt (exploded_graph &eg,
      source construct we're failing to handle.  */
   input_location = stmt->location;
 
-  if (state->m_revamp_state)
-     {
-       if (state->m_revamp_state->on_stmt (eg.get_ext_state (), snode, stmt))
-	 return on_stmt_flags (false);
-       else
-	 return on_stmt_flags::terminate_path ();
-     }
-  else if (state->m_region_model2)
+  if (state->m_region_model2)
     return on_stmt2 (eg, snode, stmt, state, change);
 
   /* Preserve the old state.  It is used here for looking
@@ -4928,10 +4921,6 @@ impl_run_checkers (logger *logger)
   FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node)
     node->get_untransformed_body ();
 
-  engine *eng = NULL;
-  if (getenv ("REVAMP"))
-    eng = new engine ();
-
   engine2 *eng2 = NULL;
   if (getenv ("REVAMP2"))
     eng2 = new engine2 ();
@@ -4976,7 +4965,7 @@ impl_run_checkers (logger *logger)
     }
 
   /* Extrinsic state shared by nodes in the graph.  */
-  const extrinsic_state ext_state (checkers, logger, eng, eng2);
+  const extrinsic_state ext_state (checkers, logger, eng2);
 
   const analysis_plan plan (sg, logger);
 
@@ -5024,7 +5013,6 @@ impl_run_checkers (logger *logger)
 
   delete purge_map;
   delete eng2;
-  delete eng;
 }
 
 /* External entrypoint to the analysis "engine".
diff --git a/gcc/analyzer/program-state.cc b/gcc/analyzer/program-state.cc
index 4f7e174e37f..00bceec934c 100644
--- a/gcc/analyzer/program-state.cc
+++ b/gcc/analyzer/program-state.cc
@@ -1046,16 +1046,13 @@ sm_state_map2::validate (const state_machine &sm,
 /* program_state's ctor.  */
 
 program_state::program_state (const extrinsic_state &ext_state)
-: m_revamp_state (NULL),
-  m_region_model2 (NULL),
+: m_region_model2 (NULL),
   m_region_model (NULL),
   m_checker_states (ext_state.get_num_checkers ()),
   m_checker_states2 (),
   m_valid (true)
 {
-  if (ext_state.get_engine ())
-    m_revamp_state = new revamp_state (ext_state);
-  else if (ext_state.get_engine2 ())
+  if (ext_state.get_engine2 ())
     {
       engine2 *eng2 = ext_state.get_engine2 ();
       region_model2_manager *mgr = eng2->get_model_manager ();
@@ -1074,8 +1071,7 @@ program_state::program_state (const extrinsic_state &ext_state)
 /* program_state's copy ctor.  */
 
 program_state::program_state (const program_state &other)
-: m_revamp_state (other.m_revamp_state),
-  m_region_model2 (NULL),
+: m_region_model2 (NULL),
   m_region_model (NULL),
   m_checker_states (other.m_checker_states.length ()),
   m_checker_states2 (other.m_checker_states2.length ()),
@@ -1099,7 +1095,6 @@ program_state::program_state (const program_state &other)
 program_state&
 program_state::operator= (const program_state &other)
 {
-  m_revamp_state = other.m_revamp_state;
   delete m_region_model2;
   if (other.m_region_model2)
     m_region_model2 = new region_model2 (*other.m_region_model2);
@@ -1134,8 +1129,7 @@ program_state::operator= (const program_state &other)
 #if __cplusplus >= 201103
 /* Move constructor for program_state (when building with C++11).  */
 program_state::program_state (program_state &&other)
-: m_revamp_state (other.m_revamp_state),
-  m_region_model2 (other.m_region_model2),
+: m_region_model2 (other.m_region_model2),
   m_region_model (other.m_region_model),
   m_checker_states (other.m_checker_states.length ()),
   m_checker_states2 (other.m_checker_states2.length ())
@@ -1371,8 +1365,6 @@ json::value *
 program_state::to_json () const
 {
   json::object *obj = new json::object ();
-  if (m_revamp_state)
-    obj->set ("revamp_state", m_revamp_state->to_json ());
 #if 0
   if (m_region_model2
     obj->set ("region_model2", m_region_model2->to_json ());
@@ -1384,11 +1376,7 @@ void
 program_state::push_frame (const extrinsic_state &ext_state,
 			   function *fun)
 {
-  if (m_revamp_state)
-    {
-      // TODO
-    }
-  else if (m_region_model2)
+  if (m_region_model2)
     {
       region_model2_context *ctxt = NULL; // FIXME
       m_region_model2->push_frame (fun, NULL, ctxt);
@@ -1441,12 +1429,7 @@ program_state::on_edge (exploded_graph &eg,
      Adding the relevant conditions for the edge could also trigger
      sm-state transitions (e.g. transitions due to ptrs becoming known
      to be NULL or non-NULL) */
-  if (m_revamp_state)
-    {
-      return m_revamp_state->maybe_update_for_edge (*succ,
-						    last_stmt);
-    }
-  else if (m_region_model2)
+  if (m_region_model2)
     {
       impl_region_model2_context ctxt (eg, &enode,
 				      &enode.get_state (),
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index e1d1adefc16..0e7eaa0cc94 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -30,9 +30,8 @@ class extrinsic_state
 public:
   extrinsic_state (auto_delete_vec <state_machine> &checkers,
 		   logger *logger = NULL,
-		   engine *eng = NULL,
 		   engine2 *eng2 = NULL)
-  : m_checkers (checkers), m_logger (logger), m_engine (eng), m_engine2 (eng2)
+  : m_checkers (checkers), m_logger (logger), m_engine2 (eng2)
   {
   }
 
@@ -54,7 +53,6 @@ public:
   void dump_to_file (FILE *outf) const;
   void dump () const;
 
-  engine *get_engine () const { return m_engine; }
   engine2 *get_engine2 () const { return m_engine2; }
 
 private:
@@ -62,14 +60,11 @@ private:
   auto_delete_vec <state_machine> &m_checkers;
 
   logger *m_logger;
-  engine *m_engine;
   engine2 *m_engine2;
 };
 
 } // namespace ana
 
-#include "revamp-state.h"
-
 template <> struct default_hash_traits<svalue_id>
 : public pod_hash_traits<svalue_id>
 {
@@ -421,10 +416,11 @@ public:
 			     const extrinsic_state &ext_state,
 			     region_model2_context *ctxt);
 
-  revamp_state *m_revamp_state;
+  /* TODO: eventually eliminate the two models in favor of the new one.  */
   region_model2 *m_region_model2;
   /* TODO: lose the pointer here (const-correctness issues?).  */
   region_model *m_region_model;
+  /* TODO: eventually eliminate the two sm_state_maps in favor of the new one.  */
   auto_delete_vec<sm_state_map> m_checker_states;
   auto_delete_vec<sm_state_map2> m_checker_states2;
 
diff --git a/gcc/analyzer/revamp-state.cc b/gcc/analyzer/revamp-state.cc
deleted file mode 100644
index 17f0dbf2acb..00000000000
--- a/gcc/analyzer/revamp-state.cc
+++ /dev/null
@@ -1,1105 +0,0 @@
-/* Classes for modeling the state of memory.
-   Copyright (C) 2019-2020 Free Software Foundation, Inc.
-   Contributed by David Malcolm <dmalcolm@redhat.com>.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tree.h"
-#include "function.h"
-#include "basic-block.h"
-#include "gimple.h"
-#include "gimple-iterator.h"
-#include "diagnostic-core.h"
-#include "graphviz.h"
-#include "options.h"
-#include "cgraph.h"
-#include "tree-dfa.h"
-#include "stringpool.h"
-#include "convert.h"
-#include "target.h"
-#include "fold-const.h"
-#include "tree-pretty-print.h"
-#include "diagnostic-color.h"
-#include "diagnostic-metadata.h"
-#include "tristate.h"
-#include "bitmap.h"
-#include "selftest.h"
-#include "function.h"
-#include "analyzer/analyzer.h"
-#include "analyzer/analyzer-logging.h"
-#include "ordered-hash-map.h"
-#include "options.h"
-#include "cgraph.h"
-#include "cfg.h"
-#include "digraph.h"
-#include "analyzer/supergraph.h"
-#include "sbitmap.h"
-#include "analyzer/region-model.h"
-#include "analyzer/revamp-state.h"
-#include "analyzer/constraint-manager.h"
-#include "diagnostic-event-id.h"
-#include "analyzer/sm.h"
-#include "diagnostic-event-id.h"
-#include "analyzer/sm.h"
-#include "analyzer/pending-diagnostic.h"
-#include "analyzer/analyzer-selftests.h"
-#include "stor-layout.h"
-#include "analyzer/program-state.h"
-
-#if ENABLE_ANALYZER
-
-namespace ana {
-
-static json::object *
-make_obj_with_address (const void *ptr)
-{
-  json::object *obj = new json::object ();
-  char buf[20];
-  sprintf (buf, "%p", ptr);
-  obj->set ("address", new json::string (buf));
-  return obj;
-}
-
-/* class sval.  */
-
-hashval_t
-sval::hash () const
-{
-  inchash::hash hstate;
-  hstate.add_int (get_kind ());
-  return hstate.end ();
-}
-
-bool
-sval::operator== (const sval &other) const
-{
-  if (get_kind () != other.get_kind ())
-    return false;
-  return cmp_fields (other);
-}
-
-DEBUG_FUNCTION void
-sval::dump () const
-{
-  pretty_printer pp;
-  pp_format_decoder (&pp) = default_tree_printer;
-  pp_show_color (&pp) = pp_show_color (global_dc->printer);
-  pp.buffer->stream = stderr;
-  dump_to_pp (&pp);
-  pp_newline (&pp);
-  pp_flush (&pp);
-}
-
-json::value *
-sval::to_json () const
-{
-  json::object *obj = make_obj_with_address (this);
-  pretty_printer pp;
-  pp_format_decoder (&pp) = default_tree_printer;
-  dump_to_pp (&pp);
-  obj->set ("desc", new json::string (pp_formatted_text (&pp)));
-  return obj;
-}
-
-/* class mem_region.  */
-
-hashval_t
-mem_region::hash () const
-{
-  inchash::hash hstate;
-  hstate.add_int (get_kind ());
-  return hstate.end ();
-}
-
-bool
-mem_region::operator== (const mem_region &other) const
-{
-  if (get_kind () != other.get_kind ())
-    return false;
-  return cmp_fields (other);
-}
-
-DEBUG_FUNCTION void
-mem_region::dump () const
-{
-  pretty_printer pp;
-  pp_format_decoder (&pp) = default_tree_printer;
-  pp_show_color (&pp) = pp_show_color (global_dc->printer);
-  pp.buffer->stream = stderr;
-  dump_to_pp (&pp);
-  pp_newline (&pp);
-  pp_flush (&pp);
-}
-
-json::value *
-mem_region::to_json () const
-{
-  json::object *obj = make_obj_with_address (this);
-  pretty_printer pp;
-  pp_format_decoder (&pp) = default_tree_printer;
-  dump_to_pp (&pp);
-  obj->set ("desc", new json::string (pp_formatted_text (&pp)));
-  return obj;
-}
-
-/* FIXME.  */
-
-const mem_region *
-mem_region::get_base_region () const
-{
-  const mem_region *iter = this;
-  while (iter)
-    {
-      switch (iter->get_kind ())
-	{
-	case RK_element_region:
-	case RK_field_region:
-	  iter = as_a <const sub_region *> (iter)->get_super_region ();
-	  continue;
-	default:
-	  return iter;
-	}
-    }
-  return iter;
-}
-
-/* sval hash implementations.  */
-
-void
-cst_sval::add_to_hash (inchash::hash &hstate) const
-{
-  inchash::add_expr (m_cst, hstate);
-}
-
-void
-unknown_sval::add_to_hash (inchash::hash &/*hstate*/) const
-{
-  /* Empty.  */
-}
-
-void
-mem_region_val::add_to_hash (inchash::hash &hstate) const
-{
-  hstate.add_ptr (m_region);
-}
-
-void
-symbolic_sval::add_to_hash (inchash::hash &hstate) const
-{
-  // no-op: don't hash the ID, to get reuse
-}
-
-void
-conjured_sval::add_to_hash (inchash::hash &hstate) const
-{
-  hstate.add_ptr (m_stmt);
-}
-
-/* mem_region hash implementations.  */
-
-void
-globals_mem_region::add_to_hash (inchash::hash &) const
-{
-  /* Empty.  */
-}
-
-void
-frame_mem_region::add_to_hash (inchash::hash &/*hstate*/) const
-{
-  /* TODO.  */
-}
-
-void
-sub_region::add_to_hash (inchash::hash &hstate) const
-{
-  hstate.add_ptr (m_super_region);
-}
-
-void
-var_decl_region::add_to_hash (inchash::hash &hstate) const
-{
-  sub_region::add_to_hash (hstate);
-  inchash::add_expr (m_decl, hstate);
-}
-
-void
-ssa_name_region::add_to_hash (inchash::hash &hstate) const
-{
-  sub_region::add_to_hash (hstate);
-  inchash::add_expr (m_name, hstate);
-}
-
-void
-element_region::add_to_hash (inchash::hash &hstate) const
-{
-  sub_region::add_to_hash (hstate);
-  hstate.add_ptr (m_element);
-}
-
-void
-field_region::add_to_hash (inchash::hash &hstate) const
-{
-  sub_region::add_to_hash (hstate);
-  inchash::add_expr (m_field, hstate);
-}
-
-/* sval cmp_fields implementations.  */
-
-bool
-cst_sval::cmp_fields (const sval &base_other) const
-{
-  const cst_sval &sub_other = (const cst_sval &)base_other;
-  return m_cst == sub_other.m_cst;
-}
-
-bool
-unknown_sval::cmp_fields (const sval &base_other) const
-{
-  // TODO
-  return true;
-}
-
-bool
-mem_region_val::cmp_fields (const sval &base_other) const
-{
-  const mem_region_val &sub_other = (const mem_region_val &)base_other;
-  return m_region == sub_other.m_region;
-}
-
-bool
-symbolic_sval::cmp_fields (const sval &base_other) const
-{
-  const symbolic_sval &sub_other = (const symbolic_sval &)base_other;
-  // FIXME: we deliberately don't compare the ID, to merge them
-  return true;
-}
-
-bool
-conjured_sval::cmp_fields (const sval &base_other) const
-{
-  const conjured_sval &sub_other = (const conjured_sval &)base_other;
-  if (!symbolic_sval::cmp_fields (sub_other))
-    return false;
-  return m_stmt == sub_other.m_stmt;
-}
-
-/* mem_region cmp_fields implementations.  */
-
-bool
-globals_mem_region::cmp_fields (const mem_region &/*base_other*/) const
-{
-  return true;
-}
-
-bool
-frame_mem_region::cmp_fields (const mem_region &/*base_other*/) const
-{
-  //const frame_mem_region &sub_other = (const frame_mem_region &)base_other;
-  // TODO
-  return true;
-}
-
-bool
-sub_region::cmp_fields (const mem_region &base_other) const
-{
-  const sub_region &sub_other = (const sub_region &)base_other;
-  return m_super_region == sub_other.m_super_region;
-}
-
-bool
-var_decl_region::cmp_fields (const mem_region &base_other) const
-{
-  if (!sub_region::cmp_fields (base_other))
-    return false;
-  const var_decl_region &sub_other = (const var_decl_region &)base_other;
-  return m_decl == sub_other.m_decl;
-}
-
-bool
-ssa_name_region::cmp_fields (const mem_region &base_other) const
-{
-  if (!sub_region::cmp_fields (base_other))
-    return false;
-  const ssa_name_region &sub_other = (const ssa_name_region &)base_other;
-  return m_name == sub_other.m_name;
-}
-
-bool
-element_region::cmp_fields (const mem_region &base_other) const
-{
-  if (!sub_region::cmp_fields (base_other))
-    return false;
-  const element_region &sub_other = (const element_region &)base_other;
-  return m_element == sub_other.m_element;
-}
-
-bool
-field_region::cmp_fields (const mem_region &base_other) const
-{
-  if (!sub_region::cmp_fields (base_other))
-    return false;
-  const field_region &sub_other = (const field_region &)base_other;
-  return m_field == sub_other.m_field;
-}
-
-/* sval dump_to_pp implementations.  */
-
-void
-cst_sval::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "cst_sval(%qE)", m_cst);
-}
-
-void
-unknown_sval::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "unknown_sval");
-}
-
-void
-mem_region_val::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "mem_region_val(");
-  m_region->dump_to_pp (pp);
-  pp_printf (pp, ")");
-}
-
-void
-conjured_sval::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "conjured_sval($%i)", get_id ());
-}
-
-/* mem_region dump_to_pp implementations.  */
-
-void
-globals_mem_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "globals_mem_region");
-}
-
-void
-frame_mem_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "frame_mem_region()"); // TODO
-}
-
-void
-var_decl_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "var_decl_region(");
-  get_super_region ()->dump_to_pp (pp);
-  pp_string (pp, ", ");
-  pp_printf (pp, "%qE)", m_decl);
-}
-
-void
-ssa_name_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_printf (pp, "ssa_name_region(%qE)", m_name);
-}
-
-void
-element_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_string (pp, "element_region(");
-  get_super_region ()->dump_to_pp (pp);
-  pp_string (pp, ", ");
-  m_element->dump_to_pp (pp);
-  pp_string (pp, ")");
-}
-
-void
-field_region::dump_to_pp (pretty_printer *pp) const
-{
-  pp_string (pp, "field_region(");
-  get_super_region ()->dump_to_pp (pp);
-  pp_printf (pp, ", %qE)", m_field);
-}
-
-const binding_cluster *
-binding_cluster::bind (const extrinsic_state &ext_state,
-		       const mem_region *reg, const sval *val) const
-{
-  gcc_unreachable ();
-  return this;
-}
-
-/* class store.  */
-
-store::store ()
-: m_map (new cluster_map_t ()) // FIXME: leak!
-{
-}
-
-store::store (const store &other)
-: m_map (other.m_map)
-{
-}
-
-void
-store::bind (const extrinsic_state &ext_state,
-	     const mem_region *dst, const sval *val)
-{
-  engine *eng = ext_state.get_engine ();
-  uniq_manager<cluster_map_t> *map_mgr = eng->get_store_map_manager ();
-  //uniq_manager<binding_cluster> *bc_mgr = eng->get_binding_cluster_manager ();
-  const mem_region *base = dst->get_base_region ();
-  if (const binding_cluster * const *c = m_map->get (base))
-    {
-      const binding_cluster *new_c = (*c)->bind (ext_state, dst, val);
-      m_map = m_map->put (base, new_c, map_mgr);
-    }
-  else
-    {
-      binding_cluster empty_c;
-      const binding_cluster *new_c = empty_c.bind (ext_state, dst, val);
-      m_map = m_map->put (base, new_c, map_mgr);
-    }
-}
-
-const sval *
-store::get_val_for_loc (const extrinsic_state &ext_state, const loc_val *val)
-{
-  if (const mem_region *reg = val->get_mem_region ())
-    {
-      const mem_region *base = reg->get_base_region ();
-      if (const binding_cluster * const *c = m_map->get (base))
-	{
-	  gcc_unreachable ();
-	}
-    }
-
-  // TODO:
-  /* No value recorded for this region; try parent.  */
-  // ...and try inheritance, default values, etc
-  // FIXME: for now, an unknown value
-  engine *eng = ext_state.get_engine ();
-  return eng->consolidate_sval (new conjured_sval (eng->alloc_sym_id (),
-						   NULL)); // FIXME
-  /* FIXME: we only want to allocate a sym ID if it's going to be a
-     new conjured_sval.  */
-}
-
-json::value *
-store::to_json () const
-{
-  json::object *store_obj = make_obj_with_address (this);
-#if 0
-  json::array *store_arr = new json::array ();
-  store_obj->set ("items", store_arr);
-  for (map_t::iterator iter = m_map.begin ();
-       iter != m_map.end ();
-       ++iter)
-    {
-      const mem_region *reg = (*iter).first;
-      const sval *val = (*iter).second;
-      json::object *item_obj = new json::object ();
-      item_obj->set ("region", reg->to_json ());
-      item_obj->set ("value", val->to_json ());
-      store_arr->append (item_obj);
-    }
-#endif
-  return store_obj;
-}
-
-DEBUG_FUNCTION void
-store::dump ()
-{
-  pretty_printer pp;
-  pp_format_decoder (&pp) = default_tree_printer;
-  pp_show_color (&pp) = pp_show_color (global_dc->printer);
-  pp.buffer->stream = stderr;
-  dump_to_pp (&pp);
-  pp_flush (&pp);
-}
-
-void
-store::dump_to_pp (pretty_printer *pp) const
-{
-  pp_character (pp, '{');
-#if 0
-  for (map_t::iterator iter = m_map.begin ();
-       iter != m_map.end ();
-       ++iter)
-    {
-      if (iter != m_map.begin ())
-	pp_string (pp, ", ");
-      const mem_region *reg = (*iter).first;
-      const sval *val = (*iter).second;
-      reg->dump_to_pp (pp);
-      pp_string (pp, ": ");
-      val->dump_to_pp (pp);
-    }
-#endif
-  pp_character (pp, '}');
-}
-
-hashval_t
-store::hash () const
-{
-  inchash::hash hstate;
-#if 0
-  for (map_t::iterator iter = m_map.begin ();
-       iter != m_map.end ();
-       ++iter)
-    {
-      const mem_region *key = (*iter).first;
-      const sval *val = (*iter).second;
-      hstate.add_ptr (key);
-      hstate.add_ptr (val);
-    }
-#endif
-  return hstate.end ();
-}
-
-bool
-store::operator== (const store &other) const
-{
-  if (m_map->elements () != other.m_map->elements ())
-    return false;
-#if 0
-  for (map_t::iterator iter = m_map.begin ();
-       iter != m_map.end ();
-       ++iter)
-    {
-      const mem_region *key = (*iter).first;
-      const sval *val = (*iter).second;
-      const sval **other_slot = const_cast <map_t &> (other.m_map).get (key);
-      if (other_slot == NULL)
-	return false;
-      if (val != *other_slot)
-	return false;
-    }
-#endif
-  return true;
-}
-
-/* class revamp_state.  */
-
-revamp_state::revamp_state (const extrinsic_state &ext_state)
-: m_store (new store ()) // FIXME
-{
-}
-
-revamp_state::revamp_state (const extrinsic_state &ext_state,
-			    const revamp_state &other)
-: m_store (new store (*other.m_store))
-{
-}
-
-bool
-revamp_state::on_stmt (const extrinsic_state &ext_state,
-		       const supernode *snode,
-		       const gimple *stmt)
-{
-  switch (stmt->code)
-    {
-    case GIMPLE_COND:
-      /* This is a no-op; the condition is handled by the true/false
-	 superedges.  */
-      return true;
-
-    case GIMPLE_LABEL:
-      /* No-op.  */
-      return true;
-
-    case GIMPLE_ASSIGN:
-      return on_gassign (ext_state, snode, as_a <const gassign *> (stmt));
-
-    case GIMPLE_RETURN:
-      return on_greturn (ext_state, snode, as_a <const greturn *> (stmt));
-
-    default:
-      sorry_at (stmt->location, "unhandled stmt: %qs",
-		gimple_code_name[stmt->code]);
-      return false;
-    }
-}
-
-bool
-revamp_state::on_gassign (const extrinsic_state &ext_state,
-			  const supernode *snode,
-			  const gassign *stmt)
-{
-  tree lhs = gimple_assign_lhs (stmt);
-  tree rhs1 = gimple_assign_rhs1 (stmt);
-
-  enum tree_code op = gimple_assign_rhs_code (stmt);
-  switch (op)
-    {
-    case ARRAY_REF:
-    case INTEGER_CST:
-      bind (ext_state, lhs, rhs1);
-      break;
-
-    default:
-      sorry_at (stmt->location, "unhandled assignment op: %qs",
-		get_tree_code_name (op));
-      break;
-    }
-
-  return true;
-}
-
-bool
-revamp_state::on_greturn (const extrinsic_state &ext_state,
-			  const supernode *snode,
-			  const greturn *stmt)
-{
-  return true;
-}
-
-bool
-revamp_state::maybe_update_for_edge (const superedge &edge,
-				     const gimple *last_stmt)
-{
-  /* Handle frame updates for interprocedural edges.  */
-  switch (edge.m_kind)
-    {
-    default:
-      break;
-
-    case SUPEREDGE_CALL:
-      {
-	const call_superedge *call_edge = as_a <const call_superedge *> (&edge);
-	update_for_call_superedge (*call_edge);
-      }
-      break;
-
-    case SUPEREDGE_RETURN:
-      {
-	const return_superedge *return_edge
-	  = as_a <const return_superedge *> (&edge);
-	update_for_return_superedge (*return_edge);
-      }
-      break;
-
-    case SUPEREDGE_INTRAPROCEDURAL_CALL:
-      {
-	const callgraph_superedge *cg_sedge
-	  = as_a <const callgraph_superedge *> (&edge);
-	update_for_call_summary (*cg_sedge);
-      }
-      break;
-    }
-
-  if (last_stmt == NULL)
-    return true;
-
-  /* Apply any constraints for conditionals/switch statements.  */
-
-  if (const gcond *cond_stmt = dyn_cast <const gcond *> (last_stmt))
-    {
-      const cfg_superedge *cfg_sedge = as_a <const cfg_superedge *> (&edge);
-      return apply_constraints_for_gcond (*cfg_sedge, cond_stmt);
-    }
-
-  if (const gswitch *switch_stmt = dyn_cast <const gswitch *> (last_stmt))
-    {
-      const switch_cfg_superedge *switch_sedge
-	= as_a <const switch_cfg_superedge *> (&edge);
-      return apply_constraints_for_gswitch (*switch_sedge, switch_stmt);
-    }
-
-  return true;
-}
-
-void
-revamp_state::update_for_call_superedge (const call_superedge &call_edge)
-{
-  // TODO
-}
-
-void
-revamp_state::update_for_return_superedge (const return_superedge &return_edge)
-{
-  // TODO
-}
-
-void
-revamp_state::update_for_call_summary (const callgraph_superedge &cg_sedge)
-{
-  // TODO
-}
-
-bool
-revamp_state::apply_constraints_for_gcond (const cfg_superedge &sedge,
-					   const gcond *cond_stmt)
-{
-  ::edge cfg_edge = sedge.get_cfg_edge ();
-  gcc_assert (cfg_edge != NULL);
-  gcc_assert (cfg_edge->flags & (EDGE_TRUE_VALUE | EDGE_FALSE_VALUE));
-
-  enum tree_code op = gimple_cond_code (cond_stmt);
-  tree lhs = gimple_cond_lhs (cond_stmt);
-  tree rhs = gimple_cond_rhs (cond_stmt);
-  if (cfg_edge->flags & EDGE_FALSE_VALUE)
-    op = invert_tree_comparison (op, false /* honor_nans */);
-  return add_constraint (lhs, op, rhs);
-}
-
-bool
-revamp_state::apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
-					     const gswitch *switch_stmt)
-{
-  return true; // TODO
-}
-
-bool
-revamp_state::add_constraint (tree lhs, enum tree_code op, tree rhs)
-{
-  // TODO:
-#if 0
-  sval *get_sval (lhs);
-  sval *get_sval (rhs);
-#endif
-  return true;
-}
-
-void
-revamp_state::bind (const extrinsic_state &ext_state,
-		    tree lhs, tree rhs)
-{
-  const loc_val *dst = get_lvalue (ext_state, lhs);
-  const sval *src = get_rvalue (ext_state, rhs);
-  const mem_region *reg = dst->get_mem_region ();
-  m_store->bind (ext_state, reg, src);
-#if 0
-  else
-    gcc_unreachable (); // unknown loc_val; what could be clobbered?
-#endif
-}
-
-const loc_val *
-revamp_state::get_lvalue (const extrinsic_state &ext_state, tree expr)
-{
-  engine *eng = ext_state.get_engine ();
-  switch (TREE_CODE (expr))
-    {
-    case ARRAY_REF:
-      {
-	const loc_val *arr_loc = get_lvalue (ext_state, TREE_OPERAND (expr, 0));
-	element_region *reg
-	  = new element_region (arr_loc->get_mem_region (),
-				get_rvalue (ext_state, TREE_OPERAND (expr, 1)));
-	return eng->get_loc_val_for_region (reg);
-      }
-    case COMPONENT_REF:
-      {
-	const loc_val *struct_loc
-	  = get_lvalue (ext_state, TREE_OPERAND (expr, 0));
-	field_region *reg
-	  = new field_region (struct_loc->get_mem_region (),
-			      TREE_OPERAND (expr, 1));
-	return eng->get_loc_val_for_region (reg);
-      }
-    case MEM_REF:
-      {
-	tree ptr = TREE_OPERAND (expr, 0);
-	tree offset = TREE_OPERAND (expr, 1);
-	gcc_assert (zerop (offset)); // FIXME; for now
-	return as_a <const loc_val *> (get_rvalue (ext_state, ptr));
-      }
-
-    case PARM_DECL:
-    case VAR_DECL:
-      {
-	const mem_region *reg = make_var_decl_region (ext_state, expr);
-	return eng->get_loc_val_for_region (reg);
-      }
-    case SSA_NAME:
-      {
-	const mem_region *reg = make_ssa_name_region (ext_state, expr);
-	return eng->get_loc_val_for_region (reg);
-      }
-    default:
-      gcc_unreachable ();
-      //return ext_state::new_unknown_sval (expr);
-    }
-}
-
-const sval *
-revamp_state::get_rvalue (const extrinsic_state &ext_state, tree expr)
-{
-  engine *eng = ext_state.get_engine ();
-  switch (TREE_CODE (expr))
-    {
-    case ARRAY_REF:
-      return m_store->get_val_for_loc (ext_state,
-				       get_lvalue (ext_state, expr));
-
-    case MEM_REF:
-      {
-	tree ptr = TREE_OPERAND (expr, 0);
-	tree offset = TREE_OPERAND (expr, 1);
-	const sval *ptr_val = get_rvalue (ext_state, ptr);
-	const sval *offset_val = get_rvalue (ext_state, offset);
-	//return m_store->
-	gcc_unreachable ();
-      }
-
-    case VAR_DECL:
-    case PARM_DECL:
-    case SSA_NAME:
-      {
-	const loc_val *lval = get_lvalue (ext_state, expr);
-	return m_store->get_val_for_loc (ext_state, lval);
-      }
-
-    case INTEGER_CST:
-      return eng->consolidate_sval (new cst_sval (expr));
-    default:
-      gcc_unreachable ();
-      //return ext_state::new_unknown_sval (expr);
-    }
-}
-
-json::value *
-revamp_state::to_json () const
-{
-  json::object *state_obj = make_obj_with_address (this);
-  state_obj->set ("store", m_store->to_json ());
-  return state_obj;
-}
-
-/* Make this object non-modifiable, in preparation for being consolidated.  */
-
-void
-revamp_state::seal (engine *eng)
-{
-  m_store = const_cast <store *> (eng->consolidate_store (m_store));
-}
-
-hashval_t
-revamp_state::hash () const
-{
-  // FIXME: must have been sealed
-  inchash::hash hstate;
-  hstate.add_ptr (m_store);
-  return hstate.end ();
-}
-
-bool
-revamp_state::operator== (const revamp_state &other) const
-{
-  // FIXME: must have been sealed
-  return m_store == other.m_store;
-}
-
-const mem_region *
-revamp_state::make_var_decl_region (const extrinsic_state &ext_state,
-				    tree decl) const
-{
-  engine *eng = ext_state.get_engine ();
-  const mem_region *super_region = get_super_region_for_decl (ext_state, decl);
-  mem_region *new_reg = new var_decl_region (super_region, decl);
-  return eng->consolidate_mem_region (new_reg);
-}
-
-const mem_region *
-revamp_state::make_ssa_name_region (const extrinsic_state &ext_state,
-				    tree name) const
-{
-  engine *eng = ext_state.get_engine ();
-  const mem_region *super_region = get_super_region_for_decl (ext_state, name);
-  mem_region *new_reg = new ssa_name_region (super_region, name);
-  return eng->consolidate_mem_region (new_reg);
-}
-
-/* FIXME: locals vs globals.  */
-
-const mem_region *
-revamp_state::get_super_region_for_decl (const extrinsic_state &ext_state,
-					 tree decl) const
-{
-  engine *eng = ext_state.get_engine ();
-  mem_region *reg;
-  gcc_assert (TREE_CODE (decl) == VAR_DECL
-	      || TREE_CODE (decl) == PARM_DECL
-	      || TREE_CODE (decl) == SSA_NAME);
-  if (TREE_CODE (decl) == VAR_DECL && is_global_var (decl))
-    reg = new globals_mem_region ();
-  else
-    reg = new frame_mem_region (); // TODO: which frame
-  return eng->consolidate_mem_region (reg);
-}
-
-/* class engine.  */
-
-engine::engine ()
-: m_next_sym_id (0)
-{
-  m_sval_mgr = new uniq_manager<sval> ();
-  m_mem_region_mgr = new uniq_manager<mem_region> ();
-  m_store_mgr = new uniq_manager<store> ();
-  m_state_mgr = new uniq_manager<revamp_state> ();
-}
-
-engine::~engine ()
-{
-  delete m_sval_mgr;
-  delete m_mem_region_mgr;
-  delete m_store_mgr;
-  delete m_state_mgr;
-}
-
-const loc_val *
-engine::get_loc_val_for_region (const mem_region *reg)
-{
-  loc_val *val = new mem_region_val (reg);
-  return consolidate_sval (val);
-}
-
-size_t
-engine::get_num_svals () const
-{
-  return m_sval_mgr->get_count ();
-}
-
-size_t
-engine::get_num_mem_regions () const
-{
-  return m_mem_region_mgr->get_count ();
-}
-
-size_t
-engine::get_num_stores () const
-{
-  return m_store_mgr->get_count ();
-}
-
-const revamp_state *
-engine::consolidate_state (revamp_state *rs)
-{
-  rs->seal (this);
-  return m_state_mgr->consolidate (rs);
-}
-
-size_t
-engine::get_num_states () const
-{
-  return m_state_mgr->get_count ();
-}
-
-#if CHECKING_P
-
-namespace selftest {
-
-static void
-test_consolidation ()
-{
-  engine eng;
-  ASSERT_EQ (eng.get_num_svals (), 0);
-
-  /* Create and consolidate some svals.  */
-  tree int_17 = build_int_cst (integer_type_node, 17);
-  const sval *cst17_0 = eng.consolidate_sval (new cst_sval (int_17));
-  ASSERT_EQ (eng.get_num_svals (), 1);
-  const sval *cst17_1 = eng.consolidate_sval (new cst_sval (int_17));
-  ASSERT_EQ (eng.get_num_svals (), 1);
-  ASSERT_EQ (cst17_0, cst17_1);
-
-  tree int_42 = build_int_cst (integer_type_node, 42);
-  const sval *cst42_0 = eng.consolidate_sval (new cst_sval (int_42));
-  ASSERT_EQ (eng.get_num_svals (), 2);
-  const sval *cst42_1 = eng.consolidate_sval (new cst_sval (int_42));
-  ASSERT_EQ (eng.get_num_svals (), 2);
-  ASSERT_EQ (cst42_0, cst42_1);
-  ASSERT_NE (cst17_0, cst42_0);
-
-#if 0
-  tree x = build_global_decl ("x", integer_type_node);
-  tree y = build_global_decl ("y", integer_type_node);
-  const mem_region *x_decl
-    = eng.consolidate_mem_region (new var_decl_region (NULL, x));
-  const mem_region *y_decl
-    = eng.consolidate_mem_region (new var_decl_region (NULL, y));
-  ASSERT_EQ (eng.get_num_svals (), 4);
-  ASSERT_NE (x_decl, y_decl);
-
-  auto_delete_vec <state_machine> checkers;
-  extrinsic_state ext_state (checkers, NULL, &eng);
-
-  revamp_state s (ext_state);
-  ASSERT_EQ (s.get_lvalue (ext_state, x), x_decl);
-  ASSERT_EQ (s.get_lvalue (ext_state, y), y_decl);
-  ASSERT_EQ (s.get_rvalue (ext_state, int_17), cst17_0);
-  ASSERT_EQ (s.get_rvalue (ext_state, int_42), cst42_0);
-
-  /* Create and consolidate some stores.  */
-  ASSERT_EQ (eng.get_num_stores (), 0);
-  store *st0_mut = new store ();
-  st0_mut->bind (x_decl, cst17_0);
-  st0_mut->bind (y_decl, cst42_0);
-  const store *st0_cons = eng.consolidate_store (st0_mut);
-  ASSERT_EQ (eng.get_num_stores (), 1);
-
-  store *st1_mut = new store ();
-  st1_mut->bind (y_decl, cst42_0);
-  st1_mut->bind (x_decl, cst17_0);
-  const store *st1_cons = eng.consolidate_store (st1_mut);
-  ASSERT_EQ (st0_cons, st1_cons);
-  ASSERT_EQ (eng.get_num_stores (), 1);
-
-  /* Create and consolidate some revamp_states.  */
-  revamp_state *state0_mut = new revamp_state (ext_state);
-  const revamp_state *state0_cons = eng.consolidate_state (state0_mut);
-  ASSERT_EQ (eng.get_num_states (), 1);
-
-  revamp_state *state1_mut = new revamp_state (ext_state);
-  state1_mut->bind (ext_state, x, int_17);
-  const revamp_state *state1_cons = eng.consolidate_state (state1_mut);
-  ASSERT_EQ (eng.get_num_states (), 2);
-  ASSERT_NE (state1_cons, state0_cons);
-
-  /* "x = 17; y = 42;" */
-  revamp_state *state2_mut = new revamp_state (ext_state);
-  state2_mut->bind (ext_state, x, int_17);
-  state2_mut->bind (ext_state, y, int_42);
-  const revamp_state *state2_cons = eng.consolidate_state (state2_mut);
-  ASSERT_EQ (eng.get_num_states (), 3);
-
-  /* "y = 42; x = 17;" should be consolidated into the same state within
-     the engine.  */
-  revamp_state *state3_mut = new revamp_state (ext_state);
-  state3_mut->bind (ext_state, y, int_42);
-  state3_mut->bind (ext_state, x, int_17);
-  const revamp_state *state3_cons = eng.consolidate_state (state3_mut);
-  ASSERT_EQ (state3_cons, state2_cons);
-  ASSERT_EQ (eng.get_num_states (), 3);
-#endif
-}
-
-/* Run all of the selftests within this file.  */
-
-void
-analyzer_revamp_state_cc_tests ()
-{
-  test_consolidation ();
-}
-
-} // namespace selftest
-
-#endif /* CHECKING_P */
-
-} // namespace ana
-
-#endif /* #if ENABLE_ANALYZER */
diff --git a/gcc/analyzer/revamp-state.h b/gcc/analyzer/revamp-state.h
deleted file mode 100644
index a06634445f3..00000000000
--- a/gcc/analyzer/revamp-state.h
+++ /dev/null
@@ -1,593 +0,0 @@
-/* Classes for representing the state of interest at a given path of analysis.
-   Copyright (C) 2019-2020 Free Software Foundation, Inc.
-   Contributed by David Malcolm <dmalcolm@redhat.com>.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3.  If not see
-<http://www.gnu.org/licenses/>.  */
-
-#ifndef GCC_ANALYZER_REVAMP_STATE_H
-#define GCC_ANALYZER_REVAMP_STATE_H
-
-#include "json.h"
-#include "uniq-manager.h"
-#include "immutable-hash-map.h"
-
-namespace ana {
-
-class mem_region_val;
-class mem_region;
-
-// TODO:
-class sval
-{
-public:
-  enum kind
-  {
-   SK_cst_sval,
-   SK_unknown_sval,
-   SK_mem_region_val,
-   SK_conjured_sval
-  };
-  virtual ~sval () {}
-
-  virtual kind get_kind () const = 0;
-
-  virtual bool loc_val_p () const { return false; }
-
-  /* For use with uniq_manager.  */
-  hashval_t hash () const;
-  bool operator== (const sval &other) const;
-
-  void dump () const;
-  virtual void dump_to_pp (pretty_printer *pp) const = 0;
-  json::value *to_json () const;
-
-  virtual const mem_region_val *dyn_cast_mem_region_val () const
-  { return NULL; }
-
- protected:
-  virtual void add_to_hash (inchash::hash &hstate) const = 0;
-  virtual bool cmp_fields (const sval &other) const = 0;
-
- private:
-#if 0
-  /* For implementing operator==.  */
-  bool template <typename Subclass>
-  compare_fields (const Subclass &other) const;
-#endif
-};
-
-class nonloc_val : public sval
-{
-};
-
-class cst_sval : public nonloc_val
-{
-public:
-  cst_sval (tree cst) : m_cst (cst)
-  {
-    gcc_assert (CONSTANT_CLASS_P (cst));
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return SK_cst_sval; }
-
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const sval &other) const FINAL OVERRIDE;
-
-private:
-  tree m_cst;
-};
-
-class unknown_sval : public sval
-{
-public:
-  kind get_kind () const FINAL OVERRIDE { return SK_cst_sval; }
-
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const sval &other) const FINAL OVERRIDE;
-
-private:
-  // FIXME: is there a single unknown_sval, or multiple ones?
-  // FIXME: perhaps there's just one, and equality
-  // is recorded in constraint manager?  (but how?)
-  // There's a single unknown_sval, but multiple conjured_sval
-};
-
-class loc_val : public sval
-{
- public:
-  bool loc_val_p () const FINAL OVERRIDE { return true; }
-
-  virtual const mem_region *get_mem_region () const = 0;
-};
-
-/* A symbolic val, with a unique ID.  */
-
-class symbolic_sval : public sval
-{
-public:
-  typedef unsigned id_t;
-
-  id_t get_id () const { return m_id; }
-
-protected:
-  symbolic_sval (id_t id) : m_id (id) {}
-
-  void add_to_hash (inchash::hash &hstate) const OVERRIDE;
-  bool cmp_fields (const sval &other) const OVERRIDE;
-
-private:
-  id_t m_id;
-};
-
-class conjured_sval : public symbolic_sval
-{
-public:
-  conjured_sval (id_t id, const gimple *stmt)
-  : symbolic_sval (id), m_stmt (stmt) {}
-
-  kind get_kind () const FINAL OVERRIDE { return SK_conjured_sval; }
-
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const sval &other) const FINAL OVERRIDE;
-
-private:
-  const gimple *m_stmt;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const loc_val *>::test (const sval *val)
-{
-  return val->loc_val_p ();
-}
-
-namespace ana {
-
-class unknown_loc_val : public loc_val
-{
- public:
-  const mem_region *get_mem_region () const FINAL OVERRIDE;
-};
-
-class mem_region_val : public loc_val
-{
- public:
-  mem_region_val (const mem_region *region) : m_region (region) {}
-
-  const mem_region_val *dyn_cast_mem_region_val () const FINAL OVERRIDE
-  { return this; }
-
-  const mem_region *get_mem_region () const
-  {
-    return m_region;
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return SK_mem_region_val; }
-
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const sval &other) const FINAL OVERRIDE;
-
- private:
-  const mem_region *m_region;
-};
-
-/* Memory regions.  */
-
-class mem_region
-{
- public:
-  enum kind
-  {
-   RK_globals_mem_region,
-   RK_frame_mem_region,
-   RK_var_decl_region,
-   RK_ssa_name_region,
-   RK_element_region,
-   RK_field_region
-  };
-  virtual ~mem_region () {}
-
-  virtual kind get_kind () const = 0;
-
-  /* For use with uniq_manager.  */
-  hashval_t hash () const;
-  bool operator== (const mem_region &other) const;
-
-  void dump () const;
-  virtual void dump_to_pp (pretty_printer *pp) const = 0;
-  json::value *to_json () const;
-
-  virtual bool sub_region_p () const { return false; }
-  const mem_region *get_base_region () const;
-
- protected:
-  virtual void add_to_hash (inchash::hash &hstate) const = 0;
-  virtual bool cmp_fields (const mem_region &other) const = 0;
-};
-
-class globals_mem_region : public mem_region
-{
- public:
-  kind get_kind () const FINAL OVERRIDE { return RK_globals_mem_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-};
-
-class frame_mem_region : public mem_region
-{
- public:
-  kind get_kind () const FINAL OVERRIDE { return RK_frame_mem_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-};
-
-class sub_region : public mem_region
-{
-public:
-  const mem_region *get_super_region () const { return m_super_region; }
-
-  bool sub_region_p () const FINAL OVERRIDE { return true; }
-
- protected:
-  sub_region (const mem_region *super_region)
-  : m_super_region (super_region)
-  {
-  }
-
-  void add_to_hash (inchash::hash &hstate) const OVERRIDE;
-  bool cmp_fields (const mem_region &other) const OVERRIDE;
-
- private:
-  const mem_region *m_super_region;
-};
-
-} // namespace ana
-
-template <>
-template <>
-inline bool
-is_a_helper <const sub_region *>::test (const mem_region *reg)
-{
-  return reg->sub_region_p ();
-}
-
-namespace ana {
-
-class var_decl_region : public sub_region
-{
-public:
-  var_decl_region (const mem_region *super_region, tree decl)
-  : sub_region (super_region), m_decl (decl)
-  {
-    gcc_assert (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL);
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return RK_var_decl_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-
-private:
-  tree m_decl;
-};
-
-class ssa_name_region : public sub_region
-{
-public:
-  ssa_name_region (const mem_region *super_region, tree name)
-  : sub_region (super_region),  m_name (name)
-  {
-    gcc_assert (TREE_CODE (name) == SSA_NAME);
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return RK_ssa_name_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-
- private:
-  tree m_name;
-};
-
-class element_region : public sub_region
-{
-public:
-  element_region (const mem_region *arr_region,
-		  const sval *element)
-  : sub_region (arr_region), m_element (element)
-  {
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return RK_element_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-
-private:
-  const sval *m_element;
-};
-
-class field_region : public sub_region
-{
-public:
-  field_region (const mem_region *struct_region, tree field)
-  : sub_region (struct_region), m_field (field)
-  {
-  }
-
-  kind get_kind () const FINAL OVERRIDE { return RK_field_region; }
-  void dump_to_pp (pretty_printer *pp) const FINAL OVERRIDE;
-
- protected:
-  void add_to_hash (inchash::hash &hstate) const FINAL OVERRIDE;
-  bool cmp_fields (const mem_region &other) const FINAL OVERRIDE;
-
-private:
-  tree m_field;
-};
-
-/* A binding within a store.  */
-
-class binding_key
-{
-protected:
-  binding_key (mem_region *region, bool direct)
-  : m_region (region), m_direct (direct) {}
-
-  mem_region *get_region () const { return m_region; }
-
-  bool direct_p () const { return m_direct; }
-  bool default_p () const { return !m_direct; }
-
-private:
-  mem_region *m_region;
-  bool m_direct; /* vs default.  */
-};
-
-class concrete_binding : public binding_key
-{
-public:
-  typedef unsigned offset_t;
-
-  concrete_binding (mem_region *region, bool direct, offset_t offset)
-  : binding_key (region, direct), m_offset (offset)
-  {}
-
-private:
-  offset_t m_offset;
-};
-
-class symbolic_binding : public binding_key
-{
-public:
-  symbolic_binding (sub_region *region, bool direct,
-		    sub_region *concrete_offset_region)
-  : binding_key (region, direct),
-    m_concrete_offset_region (concrete_offset_region)
-  {}
-private:
-  sub_region *m_concrete_offset_region;
-};
-
-/* All of the bindings within a store for regions that share the same
-   base region.  */
-
-class binding_cluster
-{
-public:
-  typedef immutable_hash_map <const binding_key *, const sval *> map_t;
-  //typedef typename map_t::iterator iterator_t;
-
-#if 0
-  binding_cluster ();
-  binding_cluster (const binding_cluster &other);
-#endif
-
-  const binding_cluster *bind (const extrinsic_state &ext_state,
-			       const mem_region *, const sval *) const;
-
-private:
-  map_t m_map;
-};
-
-class store_manager
-{
-  uniq_manager<binding_key> *m_binding_key_mgr;
-  uniq_manager<binding_cluster> *m_cluster_mgr;
-};
-
-/* A mapping from mem_region to sval.  */
-
-class store
-{
- public:
-#if 0
-  typedef hash_map <const mem_region *, const sval *> map_t;
-  typedef map_t::iterator iterator_t;
-#else
-  typedef immutable_hash_map <const mem_region *,
-			      const binding_cluster *> cluster_map_t;
-#endif
-
-  store ();
-  store (const store &other);
-
-  void bind (const extrinsic_state &ext_state,
-	     const mem_region *dst, const sval *val);
-
-  const sval *get_val_for_loc (const extrinsic_state &ext_state,
-			       const loc_val *val);
-
-  json::value *to_json () const;
-  void dump ();
-  void dump_to_pp (pretty_printer *pp) const;
-
-  /* For use with uniq_manager.  */
-  hashval_t hash () const;
-  bool operator== (const store &other) const;
-
- private:
-#if 0
-  map_t m_map;
-#else
-  const cluster_map_t *m_map;
-#endif
-};
-
-// TODO:
-class revamp_state
-{
-public:
-  revamp_state (const extrinsic_state &ext_state);
-  revamp_state (const extrinsic_state &ext_state,
-		const revamp_state &other);
-
-  json::value *to_json () const;
-
-  bool on_stmt (const extrinsic_state &ext_state,
-		const supernode *snode,
-		const gimple *stmt);
-  bool maybe_update_for_edge (const superedge &succ, const gimple *last_stmt);
-
-  bool add_constraint (tree lhs, enum tree_code op, tree rhs);
-
-  void bind (const extrinsic_state &ext_state,
-	     tree lhs, tree rhs);
-
-  const loc_val *get_lvalue (const extrinsic_state &ext_state, tree expr);
-  const sval *get_rvalue (const extrinsic_state &ext_state, tree expr);
-
-  void seal (engine *eng);
-
-  /* For use with uniq_manager.  */
-  hashval_t hash () const;
-  bool operator== (const revamp_state &other) const;
-
-private:
-  bool on_gassign (const extrinsic_state &ext_state,
-		   const supernode *snode,
-		   const gassign *stmt);
-  bool on_greturn (const extrinsic_state &ext_state,
-		   const supernode *snode,
-		   const greturn *stmt);
-
-  void update_for_call_superedge (const call_superedge &call_edge);
-  void update_for_return_superedge (const return_superedge &return_edge);
-  void update_for_call_summary (const callgraph_superedge &cg_sedge);
-  bool apply_constraints_for_gcond (const cfg_superedge &edge,
-				    const gcond *cond_stmt);
-  bool apply_constraints_for_gswitch (const switch_cfg_superedge &edge,
-				      const gswitch *switch_stmt);
-
-  const mem_region *make_var_decl_region (const extrinsic_state &ext_state,
-					  tree decl) const;
-  const mem_region *make_ssa_name_region (const extrinsic_state &ext_state,
-					  tree name) const;
-  const mem_region *get_super_region_for_decl (const extrinsic_state &ext_state,
-					       tree decl) const;
-
-  // TODO
-  store *m_store;
-};
-
-class engine
-{
- public:
-  engine ();
-  ~engine ();
-
-  const loc_val *get_loc_val_for_region (const mem_region *);
-
-  /* Instance consolidation.  */
-
-  template <typename SvalSubclass>
-  const SvalSubclass *consolidate_sval (SvalSubclass *s)
-  {
-    return m_sval_mgr->consolidate (s);
-  }
-  size_t get_num_svals () const;
-
-  template <typename MemregionSubclass>
-  const MemregionSubclass *consolidate_mem_region (MemregionSubclass *s)
-  {
-    return m_mem_region_mgr->consolidate (s);
-  }
-  size_t get_num_mem_regions () const;
-
-  const store *consolidate_store (store *s)
-  {
-    return m_store_mgr->consolidate (s);
-  }
-  size_t get_num_stores () const;
-
-  const revamp_state *consolidate_state (revamp_state *rs);
-  size_t get_num_states () const;
-
-  uniq_manager<binding_cluster> *get_binding_cluster_manager ()
-  {
-    return &m_binding_cluster_mgr;
-  }
-
-  uniq_manager<store::cluster_map_t> *get_store_map_manager ()
-  {
-    return &m_store_map_mgr;
-  }
-
-  /* Symbolic value IDs.  */
-  symbolic_sval::id_t alloc_sym_id () { return m_next_sym_id++; }
-
- private:
-  uniq_manager<sval> *m_sval_mgr;
-  uniq_manager<mem_region> *m_mem_region_mgr;
-  uniq_manager<store> *m_store_mgr;
-  uniq_manager<revamp_state> *m_state_mgr;
-  uniq_manager<binding_cluster> m_binding_cluster_mgr;
-  uniq_manager<store::cluster_map_t> m_store_map_mgr;
-
-  symbolic_sval::id_t m_next_sym_id;
-};
-
-} // namespace ana
-
-#endif /* GCC_ANALYZER_REVAMP_STATE_H */
-- 
2.21.0

