[7/7] LTO Dead field elimination and field reordering

Erick Ochoa erick.ochoa@theobroma-systems.com
Wed Nov 4 13:28:31 GMT 2020


 From 747b13bf2c6f5b17bc46316998f01483f8039548 Mon Sep 17 00:00:00 2001
From: Erick Ochoa <erick.ochoa@theobroma-systems.com>
Date: Wed, 4 Nov 2020 13:42:35 +0100
Subject: [PATCH 7/7] Getting rid of warnings


2020-11-04  Erick Ochoa  <erick.ochoa@theobroma-systems.com>

	* gcc/ipa-dfe.c : Change const_tree to tree
	* gcc/ipa-dfe.h : same
	* gcc/ipa-field-reorder.h : same
	* gcc/ipa-type-escape-analysis.c : same, add unused attribute
	* gcc/ipa-type-escape-analysis.h : same, add unused attribute

---
  gcc/ipa-dfe.c                  | 164 ++++-----
  gcc/ipa-dfe.h                  |  80 ++---
  gcc/ipa-field-reorder.c        |  72 ++--
  gcc/ipa-type-escape-analysis.c | 612 ++++++++++++++++-----------------
  gcc/ipa-type-escape-analysis.h | 312 ++++++++---------
  5 files changed, 621 insertions(+), 619 deletions(-)

diff --git a/gcc/ipa-dfe.c b/gcc/ipa-dfe.c
index 16f594a36b9..e163a32617c 100644
--- a/gcc/ipa-dfe.c
+++ b/gcc/ipa-dfe.c
@@ -126,22 +126,22 @@ along with GCC; see the file COPYING3.  If not see
   * Find all non_escaping types which point to RECORD_TYPEs in
   * record_field_offset_map.
   */
-std::set<const_tree>
+std::set<tree>
  get_all_types_pointing_to (record_field_offset_map_t 
record_field_offset_map,
  			   tpartitions_t casting)
  {
    const tset_t &non_escaping = casting.non_escaping;

-  std::set<const_tree> specific_types;
+  std::set<tree> specific_types;
    TypeStringifier stringifier;

    // Here we are just placing the types of interest in a set.
-  for (std::map<const_tree, field_offsets_t>::const_iterator i
+  for (std::map<tree, field_offsets_t>::const_iterator i
         = record_field_offset_map.begin (),
         e = record_field_offset_map.end ();
         i != e; ++i)
      {
-      const_tree record = i->first;
+      tree record = i->first;
        std::string name = stringifier.stringify (record);
        specific_types.insert (record);
      }
@@ -150,16 +150,16 @@ get_all_types_pointing_to 
(record_field_offset_map_t record_field_offset_map,

    // SpecificTypeCollector will collect all types which point to the 
types in
    // the set.
-  for (std::set<const_tree>::const_iterator i = non_escaping.begin (),
+  for (std::set<tree>::const_iterator i = non_escaping.begin (),
  					    e = non_escaping.end ();
         i != e; ++i)
      {
-      const_tree type = *i;
+      tree type = *i;
        specifier.walk (type);
      }

    // These are all the types which need modifications.
-  std::set<const_tree> to_modify = specifier.get_set ();
+  std::set<tree> to_modify = specifier.get_set ();
    return to_modify;
  }

@@ -178,24 +178,24 @@ get_all_types_pointing_to 
(record_field_offset_map_t record_field_offset_map,
   */
  reorg_maps_t
  get_types_replacement (record_field_offset_map_t record_field_offset_map,
-		       std::set<const_tree> to_modify)
+		       std::set<tree> to_modify)
  {
    TypeStringifier stringifier;

    TypeReconstructor reconstructor (record_field_offset_map, "reorg");
-  for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+  for (std::set<tree>::const_iterator i = to_modify.begin (),
  					    e = to_modify.end ();
         i != e; ++i)
      {
-      const_tree record = *i;
+      tree record = *i;
        reconstructor.walk (TYPE_MAIN_VARIANT (record));
      }

-  for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+  for (std::set<tree>::const_iterator i = to_modify.begin (),
  					    e = to_modify.end ();
         i != e; ++i)
      {
-      const_tree record = *i;
+      tree record = *i;
        reconstructor.walk (record);
      }

@@ -205,11 +205,11 @@ get_types_replacement (record_field_offset_map_t 
record_field_offset_map,
    // Here, we are just making sure that we are not doing anything too 
crazy.
    // Also, we found some types for which TYPE_CACHED_VALUES_P is not being
    // rewritten.  This is probably indicative of a bug in 
TypeReconstructor.
-  for (std::map<const_tree, tree>::const_iterator i = map.begin (),
+  for (std::map<tree, tree>::const_iterator i = map.begin (),
  						  e = map.end ();
         i != e; ++i)
      {
-      const_tree o_record = i->first;
+      tree o_record = i->first;
        std::string o_name = stringifier.stringify (o_record);
        log ("original: %s\n", o_name.c_str ());
        tree r_record = i->second;
@@ -220,7 +220,7 @@ get_types_replacement (record_field_offset_map_t 
record_field_offset_map,
  	continue;
        tree m_record = TYPE_MAIN_VARIANT (r_record);
        // Info: We had a bug where some TYPED_CACHED_VALUES were preserved?
-      tree _o_record = const_tree_to_tree (o_record);
+      tree _o_record = tree_to_tree (o_record);
        TYPE_CACHED_VALUES_P (_o_record) = false;
        TYPE_CACHED_VALUES_P (m_record) = false;

@@ -252,44 +252,44 @@ substitute_types_in_program (reorg_record_map_t map,
  /* Return a set of trees which point to the set of trees
   * that can be modified.
   */
-std::set<const_tree>
+std::set<tree>
  SpecificTypeCollector::get_set ()
  {
    return to_return;
  }

  void
-SpecificTypeCollector::_walk_POINTER_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_POINTER_TYPE_pre (tree t)
  {
    path.insert (t);
  }

  void
-SpecificTypeCollector::_walk_POINTER_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_POINTER_TYPE_post (tree t)
  {
    path.erase (t);
  }

  void
-SpecificTypeCollector::_walk_ARRAY_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_ARRAY_TYPE_pre (tree t)
  {
    path.insert (t);
  }

  void
-SpecificTypeCollector::_walk_ARRAY_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_ARRAY_TYPE_post (tree t)
  {
    path.erase (t);
  }

  void
-SpecificTypeCollector::_walk_UNION_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_UNION_TYPE_pre (tree t)
  {
    path.insert (t);
  }

  void
-SpecificTypeCollector::_walk_UNION_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_UNION_TYPE_post (tree t)
  {
    path.erase (t);
  }
@@ -298,7 +298,7 @@ SpecificTypeCollector::_walk_UNION_TYPE_post 
(const_tree t)
   * all types which we are currently keeping track of in TO_RETURN.
   */
  void
-SpecificTypeCollector::_walk_RECORD_TYPE_pre (const_tree t)
+SpecificTypeCollector::_walk_RECORD_TYPE_pre (tree t)
  {
    const bool in_set
      = _collect_these_types.find (t) != _collect_these_types.end ();
@@ -307,17 +307,17 @@ SpecificTypeCollector::_walk_RECORD_TYPE_pre 
(const_tree t)
    if (!must_collect)
      return;

-  for (std::set<const_tree>::const_iterator i = path.begin (),
+  for (std::set<tree>::const_iterator i = path.begin (),
  					    e = path.end ();
         i != e; ++i)
      {
-      const_tree type = *i;
+      tree type = *i;
        to_return.insert (type);
      }
  }

  void
-SpecificTypeCollector::_walk_RECORD_TYPE_post (const_tree t)
+SpecificTypeCollector::_walk_RECORD_TYPE_post (tree t)
  {
    path.erase (t);
  }
@@ -341,7 +341,7 @@ TypeReconstructor::get_field_map ()
  }

  void
-TypeReconstructor::set_is_not_modified_yet (const_tree t)
+TypeReconstructor::set_is_not_modified_yet (tree t)
  {
    gcc_assert (t);
    const bool is_in_reorg_map = _reorg_map.find (t) != _reorg_map.end ();
@@ -349,7 +349,7 @@ TypeReconstructor::set_is_not_modified_yet 
(const_tree t)
    if (is_in_reorg_map)
      mark_all_pointing_here_as_modified ();

-  const_tree tt = TREE_TYPE (t);
+  tree tt = TREE_TYPE (t);
    if (!tt)
      return;

@@ -380,7 +380,7 @@ TypeReconstructor::mark_all_pointing_here_as_modified ()
  }

  bool
-TypeReconstructor::get_is_modified (const_tree t)
+TypeReconstructor::get_is_modified (tree t)
  {
    gcc_assert (t);
    const bool in_map = modified_map.find (t) != modified_map.end ();
@@ -389,7 +389,7 @@ TypeReconstructor::get_is_modified (const_tree t)
    modified_map.erase (t);

    bool points_to_record = false;
-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree tt = _t;
    while (TREE_TYPE (tt))
      {
@@ -401,7 +401,7 @@ TypeReconstructor::get_is_modified (const_tree t)
  }

  bool
-TypeReconstructor::is_memoized (const_tree t)
+TypeReconstructor::is_memoized (tree t)
  {
    const bool already_changed = _reorg_map.find (t) != _reorg_map.end ();
    mark_all_pointing_here_as_modified ();
@@ -415,7 +415,7 @@ TypeReconstructor::get_new_suffix ()
  }

  tree
-get_new_identifier (const_tree type, const char *suffix)
+get_new_identifier (tree type, const char *suffix)
  {
    const char *identifier = TypeStringifier::get_type_identifier 
(type).c_str ();
    const bool is_new_type = strstr (identifier, suffix);
@@ -444,12 +444,12 @@ get_new_identifier (const_tree type, const char 
*suffix)
  //
  //
  void
-TypeReconstructor::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_ARRAY_TYPE_pre (tree t)
  {
    for_reference.push (t);
    set_is_not_modified_yet (t);

-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree copy = build_variant_type_copy (_t);
    tree domain = TYPE_DOMAIN (t);
    if (domain)
@@ -464,9 +464,9 @@ TypeReconstructor::_walk_ARRAY_TYPE_pre (const_tree t)
  }

  void
-TypeReconstructor::_walk_ARRAY_TYPE_post (const_tree t)
+TypeReconstructor::_walk_ARRAY_TYPE_post (tree t)
  {
-  const_tree t2 = for_reference.top ();
+  tree t2 = for_reference.top ();
    gcc_assert (t2 == t);
    for_reference.pop ();
    tree copy = in_progress.top ();
@@ -494,7 +494,7 @@ TypeReconstructor::_walk_ARRAY_TYPE_post (const_tree t)
    if (is_modified)
      layout_type (copy);
    TYPE_CACHED_VALUES_P (copy) = false;
-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree tt = _t;
    while (TREE_TYPE (tt))
      {
@@ -509,20 +509,20 @@ TypeReconstructor::_walk_ARRAY_TYPE_post 
(const_tree t)
  }

  void
-TypeReconstructor::_walk_POINTER_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_POINTER_TYPE_pre (tree t)
  {
    for_reference.push (t);
    set_is_not_modified_yet (t);

-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree copy = build_variant_type_copy (_t);
    in_progress.push (copy);
  }

  void
-TypeReconstructor::_walk_POINTER_TYPE_post (const_tree t)
+TypeReconstructor::_walk_POINTER_TYPE_post (tree t)
  {
-  const_tree t2 = for_reference.top ();
+  tree t2 = for_reference.top ();
    gcc_assert (t2 == t);
    for_reference.pop ();
    tree copy = in_progress.top ();
@@ -537,7 +537,7 @@ TypeReconstructor::_walk_POINTER_TYPE_post 
(const_tree t)
  		       : TYPE_NAME (copy);
    TYPE_CACHED_VALUES_P (copy) = false;

-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree tt = _t;
    while (TREE_TYPE (tt))
      {
@@ -551,12 +551,12 @@ TypeReconstructor::_walk_POINTER_TYPE_post 
(const_tree t)
  }

  void
-TypeReconstructor::_walk_RECORD_TYPE_pre (const_tree t)
+TypeReconstructor::_walk_RECORD_TYPE_pre (tree t)
  {
    const bool is_main_variant = TYPE_MAIN_VARIANT (t) == t;
    if (!is_main_variant)
      {
-      const_tree main_variant = TYPE_MAIN_VARIANT (t);
+      tree main_variant = TYPE_MAIN_VARIANT (t);
        _walk_RECORD_TYPE_pre (main_variant);
        TypeWalker::_walk_RECORD_TYPE (main_variant);
        _walk_RECORD_TYPE_post (main_variant);
@@ -566,16 +566,16 @@ TypeReconstructor::_walk_RECORD_TYPE_pre 
(const_tree t)
    for_reference.push (t);
    // We don't know if we will modify this type t
    // So, let's make a copy.  Just in case.
-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree copy = build_variant_type_copy (_t);
    in_progress.push (copy);
    field_list_stack.push (field_tuple_list_t ());
  }

  void
-TypeReconstructor::_walk_RECORD_TYPE_post (const_tree t)
+TypeReconstructor::_walk_RECORD_TYPE_post (tree t)
  {
-  const_tree t2 = for_reference.top ();
+  tree t2 = for_reference.top ();
    gcc_assert (t2 == t);
    for_reference.pop ();

@@ -650,7 +650,7 @@ TypeReconstructor::_walk_RECORD_TYPE_post (const_tree t)
        TYPE_MAIN_VARIANT (copy) = is_modified ? copy : 
TYPE_MAIN_VARIANT (copy);
        if (is_modified)
  	layout_type (copy);
-      tree _t = const_tree_to_tree (t);
+      tree _t = tree_to_tree (t);
        _reorg_map[t] = is_modified ? copy : _t;
      }

@@ -662,13 +662,13 @@ TypeReconstructor::_walk_RECORD_TYPE_post 
(const_tree t)
  }

  void
-TypeReconstructor::_walk_field_pre (const_tree t)
+TypeReconstructor::_walk_field_pre (tree t)
  {
    for_reference.push (t);
    // We don't know if we will rewrite the field
    // that we are working on.  So proactively, let's make
    // a copy.
-  tree _t = const_tree_to_tree (t);
+  tree _t = tree_to_tree (t);
    tree copy = copy_node (_t);
    tree type_copy = build_variant_type_copy ((TREE_TYPE (_t)));
    TREE_TYPE (copy) = type_copy;
@@ -678,9 +678,9 @@ TypeReconstructor::_walk_field_pre (const_tree t)
  }

  void
-TypeReconstructor::_walk_field_post (const_tree t)
+TypeReconstructor::_walk_field_post (tree t)
  {
-  const_tree t2 = for_reference.top ();
+  tree t2 = for_reference.top ();
    gcc_assert (t2 == t);
    for_reference.pop ();

@@ -690,7 +690,7 @@ TypeReconstructor::_walk_field_post (const_tree t)
    in_progress.pop ();

    // What record does this field belongs to?
-  const_tree record = for_reference.top ();
+  tree record = for_reference.top ();

    field_offsets_t field_offsets = _records[record];
    // What's the field offset?
@@ -702,7 +702,7 @@ TypeReconstructor::_walk_field_post (const_tree t)
      = field_offsets.find (f_offset) != field_offsets.end ();
    if (can_field_be_deleted)
      mark_all_pointing_here_as_modified ();
-  const_tree original_type = TREE_TYPE (t);
+  tree original_type = TREE_TYPE (t);
    const bool type_memoized = is_memoized (original_type);

    TREE_TYPE (copy)
@@ -721,9 +721,9 @@ TypeReconstructor::_walk_field_post (const_tree t)

  // Relayout parameters
  void
-ExprTypeRewriter::_walk_PARM_DECL_post (const_tree t)
+ExprTypeRewriter::_walk_PARM_DECL_post (tree t)
  {
-  tree temp = const_tree_to_tree (t);
+  tree temp = tree_to_tree (t);
    tree ttemp = TREE_TYPE (temp);
    TypeStringifier stringifier;
    const char *name = stringifier.stringify (ttemp).c_str ();
@@ -736,7 +736,7 @@ ExprTypeRewriter::_walk_PARM_DECL_post (const_tree t)

  // Update return types
  void
-ExprTypeRewriter::_walk_FUNCTION_DECL_post (const_tree t)
+ExprTypeRewriter::_walk_FUNCTION_DECL_post (tree t)
  {
    tree fn_type = TREE_TYPE (t);
    // This is saying that we cannot have indirect functions
@@ -762,7 +762,7 @@ ExprTypeRewriter::_walk_FUNCTION_DECL_post 
(const_tree t)

  // Rewrite MEM_REF operand 1
  void
-ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
+ExprTypeRewriter::_walk_MEM_REF_post (tree e)
  {
    tree op0 = TREE_OPERAND (e, 0);
    tree t2 = TREE_TYPE (op0);
@@ -776,7 +776,7 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
      {
        log ("success\n");
        tree r_t = _map[t2];
-      tree _e = const_tree_to_tree (op0);
+      tree _e = tree_to_tree (op0);
        TREE_TYPE (_e) = r_t;
      }
    // The second operand is a pointer constant.
@@ -791,9 +791,9 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
    if (!already_rewritten)
      return;

-  const_tree old_type = _imap[t];
+  tree old_type = _imap[t];
    assert_is_type (old_type, POINTER_TYPE);
-  const_tree old_base_type = TREE_TYPE (old_type);
+  tree old_base_type = TREE_TYPE (old_type);
    tree old_type_size_tree = TYPE_SIZE_UNIT (old_base_type);
    int old_type_size_int = tree_to_shwi (old_type_size_tree);

@@ -811,7 +811,7 @@ ExprTypeRewriter::_walk_MEM_REF_post (const_tree e)
      = old_offset / old_type_size_int * reorg_type_size_int + remainder;

    tree new_offset_tree = build_int_cst (TREE_TYPE (op1), new_offset);
-  tree _e = const_tree_to_tree (e);
+  tree _e = tree_to_tree (e);
    TREE_OPERAND (_e, 1) = new_offset_tree;
  }

@@ -825,8 +825,8 @@ ExprTypeRewriter::is_interesting_type (tree t)
    if (!interesting)
      return false;

-  const_tree const_possibly_copy = _imap[t];
-  tree possibly_copy = const_tree_to_tree (const_possibly_copy);
+  tree const_possibly_copy = _imap[t];
+  tree possibly_copy = tree_to_tree (const_possibly_copy);
    const bool is_copy = possibly_copy == t;
    interesting = !is_copy;
    if (!interesting)
@@ -867,8 +867,8 @@ ExprTypeRewriter::handle_pointer_arithmetic_diff 
(gimple *s, tree op_0)
    tree reorg_type_size_tree = TYPE_SIZE_UNIT (inner_reorg_type);
    int reorg_type_size_int = tree_to_shwi (reorg_type_size_tree);

-  const_tree const_old_type = _imap[reorg_type];
-  tree old_type = const_tree_to_tree (const_old_type);
+  tree const_old_type = _imap[reorg_type];
+  tree old_type = tree_to_tree (const_old_type);
    tree inner_old_type = TREE_TYPE (old_type);
    gcc_assert (old_type);
    tree old_type_size_tree = TYPE_SIZE_UNIT (inner_old_type);
@@ -982,8 +982,8 @@ 
ExprTypeRewriter::handle_pointer_arithmetic_nonconstant (gimple *s, tree 
op_0,
    tree reorg_type_size_tree = TYPE_SIZE_UNIT (reorg_inner_type);
    int reorg_type_size_int = tree_to_shwi (reorg_type_size_tree);
    // That means that the old type is
-  const_tree const_old_type_tree = _imap[reorg_type_tree];
-  tree old_type_tree = const_tree_to_tree (const_old_type_tree);
+  tree const_old_type_tree = _imap[reorg_type_tree];
+  tree old_type_tree = tree_to_tree (const_old_type_tree);
    tree old_inner_type = TREE_TYPE (old_type_tree);
    tree old_type_size_tree = TYPE_SIZE_UNIT (old_inner_type);
    int old_type_size_int = tree_to_shwi (old_type_size_tree);
@@ -1058,7 +1058,7 @@ 
ExprTypeRewriter::handle_pointer_arithmetic_constants (gimple *s, tree p,
      return;

    tree reorg_type = possibly_reorged_type; // this is the type of the 
variable
-  const_tree original_type = _imap[reorg_type];
+  tree original_type = _imap[reorg_type];
    // If we are here, that means that our type has the ".reorg" suffix
    // Let's add a sanity check
    bool has_suffix
@@ -1102,7 +1102,7 @@ 
ExprTypeRewriter::handle_pointer_arithmetic_constants (gimple *s, tree p,

  /* substitute types in post-order visit.  */
  void
-ExprTypeRewriter::_walk_post (const_tree e)
+ExprTypeRewriter::_walk_post (tree e)
  {
    gcc_assert (e);
    tree t = TREE_TYPE (e);
@@ -1111,17 +1111,17 @@ ExprTypeRewriter::_walk_post (const_tree e)
      return;

    tree r_t = _map[t];
-  tree _e = const_tree_to_tree (e);
+  tree _e = tree_to_tree (e);
    TREE_TYPE (_e) = r_t;
  }

  /* Rewrite Field.  */
  void
-ExprTypeRewriter::_walk_COMPONENT_REF_post (const_tree e)
+ExprTypeRewriter::_walk_COMPONENT_REF_post (tree e)
  {
    gcc_assert (e);

-  const_tree f = TREE_OPERAND (e, 1);
+  tree f = TREE_OPERAND (e, 1);
    // So, what we need is a map between this field and the new field
    const bool in_map = _map2.find (f) != _map2.end ();
    if (!in_map)
@@ -1130,7 +1130,7 @@ ExprTypeRewriter::_walk_COMPONENT_REF_post 
(const_tree e)
    std::pair<tree, bool> p = _map2[f];
    tree n_f = p.first;
    bool is_deleted = p.second;
-  tree _e = const_tree_to_tree (e);
+  tree _e = tree_to_tree (e);
    TREE_OPERAND (_e, 1) = n_f;

    if (!is_deleted)
@@ -1141,7 +1141,7 @@ ExprTypeRewriter::_walk_COMPONENT_REF_post 
(const_tree e)
  }

  void
-GimpleTypeRewriter::_walk_pre_tree (const_tree e)
+GimpleTypeRewriter::_walk_pre_tree (tree e)
  {
    // This is for local variables
    // and other declarations
@@ -1157,14 +1157,14 @@ GimpleTypeRewriter::_walk_pre_tree (const_tree e)
    const bool is_valid = is_interesting && is_var_decl;
    if (!is_valid)
      return;
-  tree _e = const_tree_to_tree (e);
+  tree _e = tree_to_tree (e);
    relayout_decl (_e);
  }

  void
  GimpleTypeRewriter::_walk_pre_greturn (greturn *s)
  {
-  const_tree val = gimple_return_retval (s);
+  tree val = gimple_return_retval (s);
    if (!val)
      return;
    exprTypeRewriter.walk (val);
@@ -1225,7 +1225,7 @@ GimpleTypeRewriter::handle_pointer_arithmetic 
(gimple *s)

    tree integer_constant = is_op_0_icst ? op_0 : op_1;
    tree maybe_pointer = is_op_0_icst ? op_1 : op_0;
-  const_tree maybe_pointer_t = TREE_TYPE (maybe_pointer);
+  tree maybe_pointer_t = TREE_TYPE (maybe_pointer);
    assert_is_type (maybe_pointer_t, POINTER_TYPE);
    tree pointer_variable = maybe_pointer;

@@ -1246,22 +1246,22 @@ GimpleTypeRewriter::_walk_pre_gassign (gassign *s)
      {
      case GIMPLE_TERNARY_RHS:
        {
-	const_tree rhs3 = gimple_assign_rhs3 (s);
+	tree rhs3 = gimple_assign_rhs3 (s);
  	exprTypeRewriter.walk (rhs3);
        }
      /* fall-through */
      case GIMPLE_BINARY_RHS:
        {
-	const_tree rhs2 = gimple_assign_rhs2 (s);
+	tree rhs2 = gimple_assign_rhs2 (s);
  	exprTypeRewriter.walk (rhs2);
        }
      /* fall-through */
      case GIMPLE_UNARY_RHS:
      case GIMPLE_SINGLE_RHS:
        {
-	const_tree rhs1 = gimple_assign_rhs1 (s);
+	tree rhs1 = gimple_assign_rhs1 (s);
  	exprTypeRewriter.walk (rhs1);
-	const_tree lhs = gimple_assign_lhs (s);
+	tree lhs = gimple_assign_lhs (s);
  	if (!lhs)
  	  break;
  	// Here is the only place where we likely can delete a statement.
diff --git a/gcc/ipa-dfe.h b/gcc/ipa-dfe.h
index 2b43bc5763a..ae7c4cd3e42 100644
--- a/gcc/ipa-dfe.h
+++ b/gcc/ipa-dfe.h
@@ -32,40 +32,40 @@ class SpecificTypeCollector : public TypeWalker
  {
  public:
    /* C is the set of types that are to be looked for.  */
-  SpecificTypeCollector (std::set<const_tree> &c) : 
_collect_these_types (c)
+  SpecificTypeCollector (std::set<tree> &c) : _collect_these_types (c)
    {};

    /* Get final result of all types which point to types in C.  */
-  std::set<const_tree> get_set ();
+  std::set<tree> get_set ();

  private:
    /* _collect_these_types holds the input.  */
-  const std::set<const_tree> &_collect_these_types;
+  const std::set<tree> &_collect_these_types;

    /* Working set that holds final result.  */
-  std::set<const_tree> to_return;
+  std::set<tree> to_return;

    /* Sets which reach current subtype.  */
-  std::set<const_tree> path;
+  std::set<tree> path;

    /* Push or pop from path.  */
-  virtual void _walk_ARRAY_TYPE_pre (const_tree t);
-  virtual void _walk_ARRAY_TYPE_post (const_tree t);
-  virtual void _walk_UNION_TYPE_pre (const_tree t);
-  virtual void _walk_UNION_TYPE_post (const_tree t);
-  virtual void _walk_POINTER_TYPE_pre (const_tree t);
-  virtual void _walk_POINTER_TYPE_post (const_tree t);
+  virtual void _walk_ARRAY_TYPE_pre (tree t);
+  virtual void _walk_ARRAY_TYPE_post (tree t);
+  virtual void _walk_UNION_TYPE_pre (tree t);
+  virtual void _walk_UNION_TYPE_post (tree t);
+  virtual void _walk_POINTER_TYPE_pre (tree t);
+  virtual void _walk_POINTER_TYPE_post (tree t);

    /* If in input, place all parent types in to_return.  */
-  virtual void _walk_RECORD_TYPE_pre (const_tree t);
-  virtual void _walk_RECORD_TYPE_post (const_tree t);
+  virtual void _walk_RECORD_TYPE_pre (tree t);
+  virtual void _walk_RECORD_TYPE_post (tree t);
  };

  /* Map old RECORD_TYPE -> new RECORD_TYPE.  */
-typedef std::map<const_tree, tree> reorg_record_map_t;
+typedef std::map<tree, tree> reorg_record_map_t;

  /* Map RECORD_TYPE -> (FIELD_DECL -> delete).  */
-typedef std::map<const_tree, std::pair<tree, bool> > reorg_field_map_t;
+typedef std::map<tree, std::pair<tree, bool> > reorg_field_map_t;

  /* Class used to create new types derived from types that have fields
   * that can be deleted.  */
@@ -77,7 +77,7 @@ public:
    {};

    /* Whether a type has already been modified.  */
-  virtual bool is_memoized (const_tree t);
+  virtual bool is_memoized (tree t);

    // Final result for record map.
    reorg_record_map_t get_map ();
@@ -86,7 +86,7 @@ public:
    reorg_field_map_t get_field_map ();

    /* Map RECORD_TYPE -> is_modified.  */
-  typedef std::map<const_tree, bool> is_modified_map_t;
+  typedef std::map<tree, bool> is_modified_map_t;

  protected:
    const char *get_new_suffix ();
@@ -95,10 +95,10 @@ protected:
    std::stack<tree> in_progress;

    // Path to current subtype
-  std::stack<const_tree> for_reference;
+  std::stack<tree> for_reference;

    // OLD FIELD -> new FIELD
-  typedef std::pair<const_tree, tree> field_tuple_t;
+  typedef std::pair<tree, tree> field_tuple_t;

    // list of fields for new type
    typedef std::vector<field_tuple_t> field_tuple_list_t;
@@ -127,28 +127,28 @@ protected:

    // Keep track of which types may need to be modified
    // defaults to not modified.
-  void set_is_not_modified_yet (const_tree);
+  void set_is_not_modified_yet (tree);

    // Mark all types reaching here will need to be modified.
    void mark_all_pointing_here_as_modified ();

    // If the type has been modified.
-  bool get_is_modified (const_tree);
+  bool get_is_modified (tree);

  private:
    // Compute new FIELD_DECL list.
-  virtual void _walk_field_pre (const_tree);
-  virtual void _walk_field_post (const_tree);
+  virtual void _walk_field_pre (tree);
+  virtual void _walk_field_post (tree);

    // Compute new RECORD_TYPE.
-  virtual void _walk_RECORD_TYPE_pre (const_tree);
-  virtual void _walk_RECORD_TYPE_post (const_tree);
+  virtual void _walk_RECORD_TYPE_pre (tree);
+  virtual void _walk_RECORD_TYPE_post (tree);

    // Compute new type which points to new record type.
-  virtual void _walk_ARRAY_TYPE_pre (const_tree);
-  virtual void _walk_ARRAY_TYPE_post (const_tree);
-  virtual void _walk_POINTER_TYPE_pre (const_tree);
-  virtual void _walk_POINTER_TYPE_post (const_tree);
+  virtual void _walk_ARRAY_TYPE_pre (tree);
+  virtual void _walk_ARRAY_TYPE_post (tree);
+  virtual void _walk_POINTER_TYPE_pre (tree);
+  virtual void _walk_POINTER_TYPE_post (tree);
  };

  /* Modify expressions to match the new types.
@@ -167,7 +167,7 @@ public:
      for (reorg_record_map_t::iterator i = map.begin (),
  	e = map.end (); i != e; ++i)
        {
-	const_tree original = i->first;
+	tree original = i->first;
  	tree modified = i->second;
  	_imap[modified] = original;
        }
@@ -198,20 +198,20 @@ private:
    reorg_field_map_t _map2;

    // New RECORD_TYPE -> old RECORD_TYPE.
-  std::map<tree, const_tree> _imap;
-  void _walk_post (const_tree e);
+  std::map<tree, tree> _imap;
+  void _walk_post (tree e);

    // Substitute types and create new offset.
-  void _walk_MEM_REF_post (const_tree e);
+  void _walk_MEM_REF_post (tree e);

    // Substitute fields referred.
-  void _walk_COMPONENT_REF_post (const_tree e);
+  void _walk_COMPONENT_REF_post (tree e);

    // Relayout parameters which are rewritten.
-  void _walk_PARM_DECL_post (const_tree e);
+  void _walk_PARM_DECL_post (tree e);

    // Substitute return type.
-  void _walk_FUNCTION_DECL_post (const_tree e);
+  void _walk_FUNCTION_DECL_post (tree e);
  };

  // Walk all gimple and substitute types.
@@ -234,13 +234,13 @@ private:

    // rewrite types in these statements
    virtual void _walk_pre_gphi (gphi *);
-  virtual void _walk_pre_tree (const_tree);
+  virtual void _walk_pre_tree (tree);
    virtual void _walk_pre_greturn (greturn *s);
    virtual void _walk_pre_gassign (gassign *s);
  };

  // Get a set of all types pointing to types in RECORD_FIELD_OFFSET_MAP.
-std::set<const_tree>
+std::set<tree>
  get_all_types_pointing_to (record_field_offset_map_t 
record_field_offset_map,
  			   tpartitions_t casting);

@@ -249,7 +249,7 @@ typedef std::pair<reorg_record_map_t, 
reorg_field_map_t> reorg_maps_t;
  // Compute the replacement types.
  reorg_maps_t
  get_types_replacement (record_field_offset_map_t record_field_offset_map,
-		       std::set<const_tree> to_modify);
+		       std::set<tree> to_modify);

  // Substitute types.
  void
@@ -257,6 +257,6 @@ substitute_types_in_program (reorg_record_map_t map,
  			     reorg_field_map_t field_map, bool _delete);

  tree
-get_new_identifier (const_tree type, const char *suffix);
+get_new_identifier (tree type, const char *suffix);

  #endif /* GCC_IPA_DFE */
diff --git a/gcc/ipa-field-reorder.c b/gcc/ipa-field-reorder.c
index 5dcc5a38958..5337ad5d58c 100644
--- a/gcc/ipa-field-reorder.c
+++ b/gcc/ipa-field-reorder.c
@@ -176,17 +176,17 @@ public:

  private:
    // Compute new RECORD_TYPE.
-  virtual void _walk_RECORD_TYPE_post (const_tree);
+  virtual void _walk_RECORD_TYPE_post (tree);
  };

  /* Compare FIELD_DECL tree based on TYPE_SIZE unit. */
  static bool
-compare_FIELD_DECLs_TYPE_SIZE (const_tree _l, const_tree _r)
+compare_FIELD_DECLs_TYPE_SIZE (tree _l, tree _r)
  {
    gcc_assert (_l && _r);

-  tree l = const_tree_to_tree (_l);
-  tree r = const_tree_to_tree (_r);
+  tree l = tree_to_tree (_l);
+  tree r = tree_to_tree (_r);

    const enum tree_code code_l = TREE_CODE (l);
    const enum tree_code code_r = TREE_CODE (r);
@@ -218,9 +218,9 @@ compare_FIELD_DECLs_TYPE_SIZE (const_tree _l, 
const_tree _r)
  }

  void
-TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
+TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (tree t)
  {
-  const_tree t2 = for_reference.top ();
+  tree t2 = for_reference.top ();
    gcc_assert (t2 == t);
    for_reference.pop ();

@@ -236,7 +236,7 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
    // So, now we want to do a couple of things.
    // First, collect all fields in a struct and make a copy of them
    bool is_modified = get_is_modified (t);
-  std::vector<const_tree> to_reorder;
+  std::vector<tree> to_reorder;
    is_modified = true;
    for (field_tuple_list_t::iterator i = field_tuple_list.begin (),
  	e = field_tuple_list.end ();
@@ -255,7 +255,7 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
  	   TypeStringifier::get_field_identifier (field_tuple.first).c_str (),
  	   !modified_field ? "true" : "false");
        to_reorder.push_back (
-	(const_tree) copy_node (const_tree_to_tree (field_tuple.first)));
+	(tree) copy_node (tree_to_tree (field_tuple.first)));
      }

    if (is_modified)
@@ -289,22 +289,22 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)

  	  gcc_assert (!modified_field && is_modified);
  	  // Create new TYPE_FIELDS with the order we want
-	  for (std::vector<const_tree>::iterator j = to_reorder.begin (),
+	  for (std::vector<tree>::iterator j = to_reorder.begin (),
  		f = to_reorder.end (); j != f; ++j)
  	    {
  	      entered_loop = true;
-	      const_tree current_field_inner = *j;
+	      tree current_field_inner = *j;
  	      if (!prev_field)
  		{
-		  TYPE_FIELDS (copy) = const_tree_to_tree (current_field_inner);
+		  TYPE_FIELDS (copy) = tree_to_tree (current_field_inner);
  		}
  	      else
  		{
  		  DECL_CHAIN (prev_field)
-		    = const_tree_to_tree (current_field_inner);
+		    = tree_to_tree (current_field_inner);
  		}

-	      prev_field = const_tree_to_tree (current_field_inner);
+	      prev_field = tree_to_tree (current_field_inner);
  	    }

  	  if (entered_loop)
@@ -312,11 +312,11 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
  	}

        // Modify _reorg_fields map
-      for (std::vector<const_tree>::iterator i = to_reorder.begin (),
+      for (std::vector<tree>::iterator i = to_reorder.begin (),
  		e = to_reorder.end (); i != e; ++i)
  	{
-	  const_tree to_find = *i;
-	  unsigned to_find_i = bitpos_of_field (const_tree_to_tree (to_find));
+	  tree to_find = *i;
+	  unsigned to_find_i = bitpos_of_field (tree_to_tree (to_find));
  	  const char *to_find_str
  	    = TypeStringifier::get_field_identifier (to_find).c_str ();
  	  // O^2 for now but an improvement can be to change this
@@ -329,7 +329,7 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
  	      if (haystack_i == to_find_i)
  		{
  		  _reorg_fields[field]
-		    = std::make_pair (const_tree_to_tree (to_find), false);
+		    = std::make_pair (tree_to_tree (to_find), false);
  		  log ("substituting %s for %s\n", to_find_str, haystack);
  		}
  	    }
@@ -364,7 +364,7 @@ 
TypeReconstructorFieldReordering::_walk_RECORD_TYPE_post (const_tree t)
        TYPE_MAIN_VARIANT (copy) = is_modified ? copy : 
TYPE_MAIN_VARIANT (copy);
        if (is_modified)
  	layout_type (copy);
-      tree _t = const_tree_to_tree (t);
+      tree _t = tree_to_tree (t);
        _reorg_map[t] = is_modified ? copy : _t;
      }

@@ -388,14 +388,14 @@ GimpleAccesserFieldReordering::_walk_pre_gassign 
(gassign *s)
      {
      case GIMPLE_TERNARY_RHS:
        {
-	const_tree rhs3 = gimple_assign_rhs3 (s);
+	tree rhs3 = gimple_assign_rhs3 (s);
  	gcc_assert (rhs3);
  	exprAccessor.update (rhs3, Empty);
        }
      /* fall-through */
      case GIMPLE_BINARY_RHS:
        {
-	const_tree rhs2 = gimple_assign_rhs2 (s);
+	tree rhs2 = gimple_assign_rhs2 (s);
  	gcc_assert (rhs2);
  	exprAccessor.update (rhs2, Empty);
        }
@@ -403,9 +403,9 @@ GimpleAccesserFieldReordering::_walk_pre_gassign 
(gassign *s)
      case GIMPLE_UNARY_RHS:
      case GIMPLE_SINGLE_RHS:
        {
-	const_tree rhs1 = gimple_assign_rhs1 (s);
+	tree rhs1 = gimple_assign_rhs1 (s);
  	exprAccessor.update (rhs1, Empty);
-	const_tree lhs = gimple_assign_lhs (s);
+	tree lhs = gimple_assign_lhs (s);
  	if (!lhs)
  	  break;
  	exprAccessor.update (lhs, Empty);
@@ -424,12 +424,12 @@ GimpleAccesserFieldReordering::_walk_pre_gcall 
(gcall *s)
    unsigned n = gimple_call_num_args (s);
    for (unsigned i = 0; i < n; i++)
      {
-      const_tree a = gimple_call_arg (s, i);
+      tree a = gimple_call_arg (s, i);
        gcc_assert (a);
        exprAccessor.update (a, Empty);
      }

-  const_tree lhs = gimple_call_lhs (s);
+  tree lhs = gimple_call_lhs (s);
    if (!lhs)
      return;
    exprAccessor.update (lhs, Empty);
@@ -439,7 +439,7 @@ GimpleAccesserFieldReordering::_walk_pre_gcall 
(gcall *s)
  void
  GimpleAccesserFieldReordering::_walk_pre_greturn (greturn *s)
  {
-  const_tree val = gimple_return_retval (s);
+  tree val = gimple_return_retval (s);
    if (!val)
      return;
    exprAccessor.update (val, Empty);
@@ -449,8 +449,8 @@ GimpleAccesserFieldReordering::_walk_pre_greturn 
(greturn *s)
  void
  GimpleAccesserFieldReordering::_walk_pre_gcond (gcond *s)
  {
-  const_tree lhs = gimple_cond_lhs (s);
-  const_tree rhs = gimple_cond_rhs (s);
+  tree lhs = gimple_cond_lhs (s);
+  tree rhs = gimple_cond_rhs (s);
    gcc_assert (lhs && rhs);
    exprAccessor.update (lhs, Empty);
    exprAccessor.update (rhs, Empty);
@@ -524,25 +524,25 @@ record_field_map_t static find_fields_accessed ()
   */
  reorg_maps_t
  get_reordered_field_maps (record_field_offset_map_t 
record_field_offset_map,
-			  std::set<const_tree> to_modify)
+			  std::set<tree> to_modify)
  {
    TypeStringifier stringifier;

    TypeReconstructorFieldReordering reconstructor (record_field_offset_map,
  						  "reorder");
-  for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+  for (std::set<tree>::const_iterator i = to_modify.begin (),
  					    e = to_modify.end ();
         i != e; ++i)
      {
-      const_tree record = *i;
+      tree record = *i;
        reconstructor.walk (TYPE_MAIN_VARIANT (record));
      }

-  for (std::set<const_tree>::const_iterator i = to_modify.begin (),
+  for (std::set<tree>::const_iterator i = to_modify.begin (),
  					    e = to_modify.end ();
         i != e; ++i)
      {
-      const_tree record = *i;
+      tree record = *i;
        reconstructor.walk (record);
      }

@@ -553,11 +553,11 @@ get_reordered_field_maps 
(record_field_offset_map_t record_field_offset_map,
    // Also, we found some types for which TYPE_CACHED_VALUES_P is not being
    // rewritten.  This is probably indicative of a bug in
    // TypeReconstructorFieldReordering.
-  for (std::map<const_tree, tree>::const_iterator i = map.begin (),
+  for (std::map<tree, tree>::const_iterator i = map.begin (),
  						  e = map.end ();
         i != e; ++i)
      {
-      const_tree o_record = i->first;
+      tree o_record = i->first;
        std::string o_name = stringifier.stringify (o_record);
        log ("original: %s\n", o_name.c_str ());
        tree r_record = i->second;
@@ -568,7 +568,7 @@ get_reordered_field_maps (record_field_offset_map_t 
record_field_offset_map,
  	continue;
        tree m_record = TYPE_MAIN_VARIANT (r_record);
        // Info: We had a bug where some TYPED_CACHED_VALUES were preserved?
-      tree _o_record = const_tree_to_tree (o_record);
+      tree _o_record = tree_to_tree (o_record);
        TYPE_CACHED_VALUES_P (_o_record) = false;
        TYPE_CACHED_VALUES_P (m_record) = false;

@@ -603,7 +603,7 @@ lto_fr_execute ()
      return 0;

    // Prepare for transformation.
-  std::set<const_tree> to_modify
+  std::set<tree> to_modify
      = get_all_types_pointing_to (record_field_offset_map,
  				 escaping_nonescaping_sets);

diff --git a/gcc/ipa-type-escape-analysis.c b/gcc/ipa-type-escape-analysis.c
index fe68eaf70c7..b9e9f698da2 100644
--- a/gcc/ipa-type-escape-analysis.c
+++ b/gcc/ipa-type-escape-analysis.c
@@ -309,7 +309,7 @@ get_whitelisted_nodes ()
      if (detected_incompatible_syntax) return map;
      cgraph_node *i = worklist.front ();
      worklist.pop ();
-    if (dump_file) fprintf (dump_file, "analyzing %s %p\n", i->name (), i);
+    if (dump_file) fprintf (dump_file, "analyzing %s %p\n", i->name (), 
(void*)i);
      GimpleWhiteLister whitelister;
      whitelister._walk_cnode (i);
      bool no_external = whitelister.does_not_call_external_functions 
(i, map);
@@ -368,7 +368,7 @@ lto_dead_field_elimination ()
      return;

      // Prepare for transformation.
-  std::set<const_tree> to_modify
+  std::set<tree> to_modify
      = get_all_types_pointing_to (record_field_offset_map,
  				 escaping_nonescaping_sets);
    reorg_maps_t replacements
@@ -436,7 +436,7 @@ record_field_map_t static find_fields_accessed ()
    return record_field_map;
  }

-/* Find equivalent RECORD_TYPE trees to const_tree r_i.
+/* Find equivalent RECORD_TYPE trees to tree r_i.
   * This equivalence will be used for merging the results of field accesses
   * across all equivalent RECORD_TYPE trees.

@@ -444,22 +444,22 @@ record_field_map_t static find_fields_accessed ()
   * and it is a tree for which this method is going to find the rest of
   * equivalent trees found in record_field_map.
   */
-static std::vector<const_tree>
-find_equivalent_trees (const_tree r_i, record_field_map_t record_field_map,
+static std::vector<tree>
+find_equivalent_trees (tree r_i, record_field_map_t record_field_map,
  		       tpartitions_t casting)
  {
    TypeIncompleteEquality equality;
-  std::vector<const_tree> equivalence;
+  std::vector<tree> equivalence;
    bool is_rin_record = casting.in_points_to_record (r_i);
    if (!is_rin_record)
      return equivalence;

-  for (std::map<const_tree, field_access_map_t>::const_iterator j
+  for (std::map<tree, field_access_map_t>::const_iterator j
         = record_field_map.begin (),
         f = record_field_map.end ();
         j != f; j++)
      {
-      const_tree r_j = j->first;
+      tree r_j = j->first;
        const bool pointer_equal = r_i == r_j;
        if (pointer_equal)
  	continue;
@@ -484,7 +484,7 @@ find_equivalent_trees (const_tree r_i, 
record_field_map_t record_field_map,
   * tree (RECORD_TYPE) -> unsigned (bitpos_of_field for read fields).
   */
  static void
-add_offset_only_if_read (const_tree field, unsigned access,
+add_offset_only_if_read (tree field, unsigned access,
  			 field_offsets_t &field_offset)
  {
    assert_is_type (field, FIELD_DECL);
@@ -492,7 +492,7 @@ add_offset_only_if_read (const_tree field, unsigned 
access,
    if (!is_read)
      return;

-  tree _field = const_tree_to_tree (field);
+  tree _field = tree_to_tree (field);
    unsigned f_offset = bitpos_of_field (_field);
    field_offset.insert (f_offset);
  }
@@ -508,7 +508,7 @@ static void
  keep_only_read_fields_from_field_map (field_access_map_t &field_map,
  				      field_offsets_t &field_offset)
  {
-  for (std::map<const_tree, unsigned>::iterator j = field_map.begin (),
+  for (std::map<tree, unsigned>::iterator j = field_map.begin (),
  						f = field_map.end ();
         j != f; ++j)
      {
@@ -522,14 +522,14 @@ keep_only_read_fields_from_field_map 
(field_access_map_t &field_map,
   */
  static void
  keep_only_read_fields_from_equivalent_field_maps (
-  std::vector<const_tree> equivalent, record_field_map_t &record_field_map,
+  std::vector<tree> equivalent, record_field_map_t &record_field_map,
    field_offsets_t &field_offset)
  {
-  for (std::vector<const_tree>::iterator j = equivalent.begin (),
+  for (std::vector<tree>::iterator j = equivalent.begin (),
  					 f = equivalent.end ();
         j != f; j++)
      {
-      const_tree r_j = *j;
+      tree r_j = *j;
        field_access_map_t equivalent_field_map = record_field_map[r_j];
        keep_only_read_fields_from_field_map (equivalent_field_map, 
field_offset);
      }
@@ -542,14 +542,14 @@ keep_only_read_fields_from_equivalent_field_maps (
  static void
  erase_if_no_fields_can_be_deleted (
    record_field_offset_map_t &record_field_offset_map,
-  std::set<const_tree> &to_keep, std::set<const_tree> &to_erase)
+  std::set<tree> &to_keep, std::set<tree> &to_erase)
  {
-  for (std::map<const_tree, field_offsets_t>::iterator i
+  for (std::map<tree, field_offsets_t>::iterator i
         = record_field_offset_map.begin (),
         e = record_field_offset_map.end ();
         i != e; ++i)
      {
-      const_tree record = i->first;
+      tree record = i->first;
        const bool keep = to_keep.find (record) != to_keep.end ();
        if (keep)
  	continue;
@@ -557,11 +557,11 @@ erase_if_no_fields_can_be_deleted (
        to_erase.insert (record);
      }

-  for (std::set<const_tree>::iterator i = to_erase.begin (),
+  for (std::set<tree>::iterator i = to_erase.begin (),
  				      e = to_erase.end ();
         i != e; ++i)
      {
-      const_tree record = *i;
+      tree record = *i;
        record_field_offset_map.erase (record);
      }
  }
@@ -573,15 +573,15 @@ erase_if_no_fields_can_be_deleted (
  static void
  mark_escaping_types_to_be_deleted (
    record_field_offset_map_t &record_field_offset_map,
-  std::set<const_tree> &to_erase, tpartitions_t casting)
+  std::set<tree> &to_erase, tpartitions_t casting)
  {
    const tset_t &non_escaping = casting.non_escaping;
-  for (std::map<const_tree, field_offsets_t>::iterator i
+  for (std::map<tree, field_offsets_t>::iterator i
         = record_field_offset_map.begin (),
         e = record_field_offset_map.end ();
         i != e; ++i)
      {
-      const_tree record = i->first;
+      tree record = i->first;
        const bool in_set = non_escaping.find (record) != 
non_escaping.end ();
        if (in_set)
  	continue;
@@ -598,13 +598,13 @@ obtain_nonescaping_unaccessed_fields 
(tpartitions_t casting,
  {
    bool has_fields_that_can_be_deleted = false;
    record_field_offset_map_t record_field_offset_map;
-  for (std::map<const_tree, field_access_map_t>::iterator i
+  for (std::map<tree, field_access_map_t>::iterator i
         = record_field_map.begin (),
         e = record_field_map.end ();
         i != e; ++i)
      {
-      const_tree r_i = i->first;
-      std::vector<const_tree> equivalence
+      tree r_i = i->first;
+      std::vector<tree> equivalence
  	= find_equivalent_trees (r_i, record_field_map, casting);
        field_offsets_t field_offset;
        field_access_map_t original_field_map = record_field_map[r_i];
@@ -621,16 +621,16 @@ obtain_nonescaping_unaccessed_fields 
(tpartitions_t casting,
    // we need to compute the complement...

    // Improve: This is tightly coupled, I need to decouple it...
-  std::set<const_tree> to_erase;
-  std::set<const_tree> to_keep;
+  std::set<tree> to_erase;
+  std::set<tree> to_keep;
    mark_escaping_types_to_be_deleted (record_field_offset_map, to_erase,
  				     casting);
-  for (std::map<const_tree, field_offsets_t>::iterator i
+  for (std::map<tree, field_offsets_t>::iterator i
         = record_field_offset_map.begin (),
         e = record_field_offset_map.end ();
         i != e; ++i)
      {
-      const_tree record = i->first;
+      tree record = i->first;
        const bool will_be_erased = to_erase.find (record) != 
to_erase.end ();
        // No need to compute which fields can be deleted if type is 
escaping
        if (will_be_erased)
@@ -679,7 +679,7 @@ obtain_nonescaping_unaccessed_fields (tpartitions_t 
casting,
  // Main interface to TypeWalker
  // Start recursive walk
  void
-TypeWalker::walk (const_tree t)
+TypeWalker::walk (tree t)
  {
    gcc_assert (t);
    this->tset.clear ();
@@ -687,7 +687,7 @@ TypeWalker::walk (const_tree t)
  }

  void
-TypeWalker::_walk (const_tree type)
+TypeWalker::_walk (tree type)
  {
    // Improve, verify that having a type is an invariant.
    // I think there was a specific example which didn't
@@ -788,7 +788,7 @@ TypeWalker::_walk (const_tree type)
  // and after we need to
  // call the post-order callback.
  #define TypeWalkerFuncDef(code)						\
-  void TypeWalker::walk_##code (const_tree t)				\
+  void TypeWalker::walk_##code (tree t)				\
    {									\
      assert_is_type (t, code);						\
      _walk_##code##_pre (t);						\
@@ -797,7 +797,7 @@ TypeWalker::_walk (const_tree type)
    }

  #define TypeWalkerFuncDefInternal(code)					\
-  void TypeWalker::_walk_##code (__attribute__ ((unused)) const_tree t) \
+  void TypeWalker::_walk_##code (__attribute__ ((unused)) tree t) \
    {}

  TypeWalkerFuncDef (VOID_TYPE)
@@ -820,9 +820,9 @@ TypeWalkerFuncDefInternal (ENUMERAL_TYPE)
  /* walk wrapper is used for unwrapping
   * REFERENCE_TYPE, POINTER_TYPE, ARRAY_TYPE.
   */
-void TypeWalker::_walk_wrapper (const_tree t)
+void TypeWalker::_walk_wrapper (tree t)
  {
-  const_tree inner_type = TREE_TYPE (t);
+  tree inner_type = TREE_TYPE (t);
    // I think I encountered this code:
    // FIXME: Do we really need this?
    if (!inner_type)
@@ -833,7 +833,7 @@ void TypeWalker::_walk_wrapper (const_tree t)
  }

  #define TypeWalkerFuncDefWrapper(code)		\
-  void TypeWalker::_walk_##code (const_tree t)  \
+  void TypeWalker::_walk_##code (tree t)  \
    { _walk_wrapper (t); }

  TypeWalkerFuncDef (POINTER_TYPE)
@@ -845,7 +845,7 @@ TypeWalkerFuncDefWrapper (ARRAY_TYPE)
  TypeWalkerFuncDef (RECORD_TYPE)

  void
-TypeWalker::_walk_RECORD_TYPE (const_tree t)
+TypeWalker::_walk_RECORD_TYPE (tree t)
  {
    _walk_record_or_union (t);
  }
@@ -853,13 +853,13 @@ TypeWalker::_walk_RECORD_TYPE (const_tree t)
  TypeWalkerFuncDef (UNION_TYPE)

  void
-TypeWalker::_walk_UNION_TYPE (const_tree t)
+TypeWalker::_walk_UNION_TYPE (tree t)
  {
    _walk_record_or_union (t);
  }

  void
-TypeWalker::_walk_record_or_union (const_tree t)
+TypeWalker::_walk_record_or_union (tree t)
  {
    for (tree field = TYPE_FIELDS (t); field; field = DECL_CHAIN (field))
      {
@@ -869,7 +869,7 @@ TypeWalker::_walk_record_or_union (const_tree t)
  }

  void
-TypeWalker::walk_field (const_tree t)
+TypeWalker::walk_field (tree t)
  {
    _walk_field_pre (t);
    _walk_field (t);
@@ -877,37 +877,37 @@ TypeWalker::walk_field (const_tree t)
  }

  void
-TypeWalker::_walk_field (const_tree t)
+TypeWalker::_walk_field (tree t)
  {
-  const_tree inner_type = TREE_TYPE (t);
+  tree inner_type = TREE_TYPE (t);
    gcc_assert (inner_type);
    _walk (inner_type);
  }

  TypeWalkerFuncDef (FUNCTION_TYPE)

-  void TypeWalker::_walk_FUNCTION_TYPE (const_tree t)
+  void TypeWalker::_walk_FUNCTION_TYPE (tree t)
  {
    _walk_function_or_method (t);
  }

  TypeWalkerFuncDef (METHOD_TYPE)

-  void TypeWalker::_walk_METHOD_TYPE (const_tree t)
+  void TypeWalker::_walk_METHOD_TYPE (tree t)
  {
    _walk_function_or_method (t);
  }

  void
-TypeWalker::_walk_function_or_method (const_tree t)
+TypeWalker::_walk_function_or_method (tree t)
  {
-  const_tree ret_type = TREE_TYPE (t);
+  tree ret_type = TREE_TYPE (t);
    walk_return (ret_type);
    walk_args (t);
  }

  void
-TypeWalker::walk_return (const_tree t)
+TypeWalker::walk_return (tree t)
  {
    _walk_return_pre (t);
    _walk_return (t);
@@ -915,13 +915,13 @@ TypeWalker::walk_return (const_tree t)
  }

  void
-TypeWalker::_walk_return (const_tree t)
+TypeWalker::_walk_return (tree t)
  {
    _walk (t);
  }

  void
-TypeWalker::walk_args (const_tree t)
+TypeWalker::walk_args (tree t)
  {
    _walk_args_pre (t);
    _walk_args (t);
@@ -929,19 +929,19 @@ TypeWalker::walk_args (const_tree t)
  }

  void
-TypeWalker::_walk_args (const_tree t)
+TypeWalker::_walk_args (tree t)
  {
    for (tree arg_node = TYPE_ARG_TYPES (t); NULL_TREE != arg_node;
         arg_node = TREE_CHAIN (arg_node))
      {
-      const_tree arg_node_type = TREE_VALUE (arg_node);
+      tree arg_node_type = TREE_VALUE (arg_node);
        gcc_assert (arg_node_type);
        walk_arg (arg_node_type);
      }
  }

  void
-TypeWalker::walk_arg (const_tree t)
+TypeWalker::walk_arg (tree t)
  {
    _walk_arg_pre (t);
    _walk_arg (t);
@@ -949,14 +949,14 @@ TypeWalker::walk_arg (const_tree t)
  }

  void
-TypeWalker::_walk_arg (const_tree t)
+TypeWalker::_walk_arg (tree t)
  {
    _walk (t);
  }

  /* Main interface for the ExprWalker... */
  void
-ExprWalker::walk (const_tree e)
+ExprWalker::walk (tree e)
  {
    if (detected_incompatible_syntax) return;
    _walk_pre (e);
@@ -965,7 +965,7 @@ ExprWalker::walk (const_tree e)
  }

  void
-ExprWalker::_walk (const_tree e)
+ExprWalker::_walk (tree e)
  {
    gcc_assert (e);
    const enum tree_code code = TREE_CODE (e);
@@ -1060,7 +1060,7 @@ ExprWalker::_walk (const_tree e)
   * call post-order callback for everything.
   */
  #define ExprWalkerFuncDef(code) 			\
-  void ExprWalker::walk_##code (const_tree e)		\
+  void ExprWalker::walk_##code (tree e)		\
    {							\
      assert_is_type (e, code);				\
      _walk_pre (e);					\
@@ -1094,29 +1094,29 @@ ExprWalkerFuncDef (GT_EXPR)
  ExprWalkerFuncDef (GE_EXPR)
  ExprWalkerFuncDef (NE_EXPR)

-void ExprWalker::_walk_leaf (const_tree e, const enum tree_code c)
+void ExprWalker::_walk_leaf (tree e, const enum tree_code c)
  {
    assert_is_type (e, c);
  }

  void
-ExprWalker::_walk_op_n (const_tree e, unsigned n)
+ExprWalker::_walk_op_n (tree e, unsigned n)
  {
    gcc_assert (e);
-  const_tree op_n = TREE_OPERAND (e, n);
+  tree op_n = TREE_OPERAND (e, n);
    gcc_assert (op_n);
    walk (op_n);
  }

  void
-ExprWalker::_walk_op_0 (const_tree e, const enum tree_code c)
+ExprWalker::_walk_op_0 (tree e, const enum tree_code c)
  {
    assert_is_type (e, c);
    _walk_op_n (e, 0);
  }

  void
-ExprWalker::_walk_op_1 (const_tree e, const enum tree_code c)
+ExprWalker::_walk_op_1 (tree e, const enum tree_code c)
  {
    assert_is_type (e, c);
    _walk_op_n (e, 0);
@@ -1124,68 +1124,68 @@ ExprWalker::_walk_op_1 (const_tree e, const enum 
tree_code c)
  }

  void
-ExprWalker::_walk_CONSTRUCTOR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_CONSTRUCTOR (__attribute__ ((unused)) tree e)
  {
    // Future-work: If we want to support rewriting CONSTRUCTORs
    // we will have to walk them
  }

  void
-ExprWalker::_walk_LE_EXPR (const_tree e)
+ExprWalker::_walk_LE_EXPR (tree e)
  {
    _walk_op_1 (e, LE_EXPR);
  }

  void
-ExprWalker::_walk_LT_EXPR (const_tree e)
+ExprWalker::_walk_LT_EXPR (tree e)
  {
    _walk_op_1 (e, LT_EXPR);
  }

  void
-ExprWalker::_walk_EQ_EXPR (const_tree e)
+ExprWalker::_walk_EQ_EXPR (tree e)
  {
    _walk_op_1 (e, EQ_EXPR);
  }

  void
-ExprWalker::_walk_GT_EXPR (const_tree e)
+ExprWalker::_walk_GT_EXPR (tree e)
  {
    _walk_op_1 (e, GT_EXPR);
  }

  void
-ExprWalker::_walk_GE_EXPR (const_tree e)
+ExprWalker::_walk_GE_EXPR (tree e)
  {
    _walk_op_1 (e, GE_EXPR);
  }

  void
-ExprWalker::_walk_NE_EXPR (const_tree e)
+ExprWalker::_walk_NE_EXPR (tree e)
  {
    _walk_op_1 (e, NE_EXPR);
  }

  void
-ExprWalker::_walk_INTEGER_CST (const_tree e)
+ExprWalker::_walk_INTEGER_CST (tree e)
  {
    _walk_leaf (e, INTEGER_CST);
  }

  void
-ExprWalker::_walk_REAL_CST (const_tree e)
+ExprWalker::_walk_REAL_CST (tree e)
  {
    _walk_leaf (e, REAL_CST);
  }

  void
-ExprWalker::_walk_STRING_CST (const_tree e)
+ExprWalker::_walk_STRING_CST (tree e)
  {
    _walk_leaf (e, STRING_CST);
  }

  void
-ExprWalker::_walk_BIT_FIELD_REF (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_BIT_FIELD_REF (__attribute__ ((unused)) tree e)
  {
    // TODO:
    // We currently don't support bit_field_ref
@@ -1193,73 +1193,73 @@ ExprWalker::_walk_BIT_FIELD_REF (__attribute__ 
((unused)) const_tree e)
  }

  void
-ExprWalker::_walk_ARRAY_REF (const_tree e)
+ExprWalker::_walk_ARRAY_REF (tree e)
  {
    _walk_op_1 (e, ARRAY_REF);
  }

  void
-ExprWalker::_walk_MEM_REF (const_tree e)
+ExprWalker::_walk_MEM_REF (tree e)
  {
    _walk_op_1 (e, MEM_REF);
  }

  void
-ExprWalker::_walk_COMPONENT_REF (const_tree e)
+ExprWalker::_walk_COMPONENT_REF (tree e)
  {
    _walk_op_1 (e, COMPONENT_REF);
  }

  void
-ExprWalker::_walk_SSA_NAME (const_tree e)
+ExprWalker::_walk_SSA_NAME (tree e)
  {
    _walk_leaf (e, SSA_NAME);
  }

  void
-ExprWalker::_walk_ADDR_EXPR (const_tree e)
+ExprWalker::_walk_ADDR_EXPR (tree e)
  {
    _walk_op_0 (e, ADDR_EXPR);
  }

  void
-ExprWalker::_walk_VIEW_CONVERT_EXPR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_VIEW_CONVERT_EXPR (__attribute__ ((unused)) tree e)
  {
    // TODO: I don't think we need to do anything here
  }

  void
-ExprWalker::_walk_IMAGPART_EXPR (__attribute__ ((unused)) const_tree e)
+ExprWalker::_walk_IMAGPART_EXPR (__attribute__ ((unused)) tree e)
  {
    // TODO: I don't think we need to do anything here
  }

  void
-ExprWalker::_walk_FIELD_DECL (const_tree e)
+ExprWalker::_walk_FIELD_DECL (tree e)
  {
    _walk_leaf (e, FIELD_DECL);
  }

  void
-ExprWalker::_walk_VAR_DECL (const_tree e)
+ExprWalker::_walk_VAR_DECL (tree e)
  {
    _walk_leaf (e, VAR_DECL);
  }

  void
-ExprWalker::_walk_RESULT_DECL (const_tree e)
+ExprWalker::_walk_RESULT_DECL (tree e)
  {
    _walk_leaf (e, RESULT_DECL);
  }

  void
-ExprWalker::_walk_PARM_DECL (const_tree e)
+ExprWalker::_walk_PARM_DECL (tree e)
  {
    _walk_leaf (e, PARM_DECL);
  }

  void
-ExprWalker::_walk_FUNCTION_DECL (const_tree e)
+ExprWalker::_walk_FUNCTION_DECL (tree e)
  {
    _walk_leaf (e, FUNCTION_DECL);
    for (tree parm = DECL_ARGUMENTS (e); parm; parm = DECL_CHAIN (parm))
@@ -1326,7 +1326,7 @@ GimpleWalker::_walk_global (varpool_node *vnode)
  void
  GimpleWalker::_walk_ssa_names (cgraph_node *cnode)
  {
-  const_tree decl = cnode->decl;
+  tree decl = cnode->decl;
    gcc_assert (decl);
    function *func = DECL_STRUCT_FUNCTION (decl);
    gcc_assert (func);
@@ -1362,7 +1362,7 @@ GimpleWalker::_walk_cnode (cgraph_node *cnode)
  void
  GimpleWalker::_walk_locals (cgraph_node *cnode)
  {
-  const_tree decl = cnode->decl;
+  tree decl = cnode->decl;
    gcc_assert (decl);
    function *func = DECL_STRUCT_FUNCTION (decl);
    gcc_assert (func);
@@ -1381,7 +1381,7 @@ GimpleWalker::_walk_bb (cgraph_node *cnode)
  {
    gcc_assert (cnode);
    cnode->get_untransformed_body ();
-  const_tree decl = cnode->decl;
+  tree decl = cnode->decl;
    gcc_assert (decl);
    function *func = DECL_STRUCT_FUNCTION (decl);
    gcc_assert (func);
@@ -1398,7 +1398,7 @@ GimpleWalker::_walk_bb (cgraph_node *cnode)
  void
  GimpleWalker::_walk_decl (cgraph_node *cnode)
  {
-  const_tree decl = cnode->decl;
+  tree decl = cnode->decl;
    gcc_assert (decl);
    walk_tree2 (decl);
  }
@@ -1537,7 +1537,7 @@ GimpleWalker::_walk_gimple (gimple *stmt)
  }

  void
-GimpleWalker::walk_tree2 (const_tree t)
+GimpleWalker::walk_tree2 (tree t)
  {
    _walk_pre_tree (t);
    _walk_tree (t);
@@ -1545,7 +1545,7 @@ GimpleWalker::walk_tree2 (const_tree t)
  }

  void
-GimpleWalker::_walk_tree (const_tree t)
+GimpleWalker::_walk_tree (__attribute__((unused)) tree t)
  {}

  void
@@ -1557,7 +1557,7 @@ GimpleWalker::walk_gassign (gassign *g)
  }

  void
-GimpleWalker::_walk_gassign (gassign *g)
+GimpleWalker::_walk_gassign (__attribute__((unused)) gassign *g)
  {}

  void
@@ -1569,7 +1569,7 @@ GimpleWalker::walk_greturn (greturn *g)
  }

  void
-GimpleWalker::_walk_greturn (greturn *g)
+GimpleWalker::_walk_greturn (__attribute__((unused)) greturn *g)
  {}

  void
@@ -1581,7 +1581,7 @@ GimpleWalker::walk_gcond (gcond *g)
  }

  void
-GimpleWalker::_walk_gcond (gcond *g)
+GimpleWalker::_walk_gcond (__attribute__((unused)) gcond *g)
  {}

  void
@@ -1593,7 +1593,7 @@ GimpleWalker::walk_gcall (gcall *g)
  }

  void
-GimpleWalker::_walk_gcall (gcall *g)
+GimpleWalker::_walk_gcall (__attribute__((unused)) gcall *g)
  {}

  void
@@ -1605,7 +1605,7 @@ GimpleWalker::walk_glabel (glabel *g)
  }

  void
-GimpleWalker::_walk_glabel (glabel *g)
+GimpleWalker::_walk_glabel (__attribute__((unused))glabel *g)
  {}

  void
@@ -1617,7 +1617,7 @@ GimpleWalker::walk_gswitch (gswitch *g)
  }

  void
-GimpleWalker::_walk_gswitch (gswitch *g)
+GimpleWalker::_walk_gswitch (__attribute__((unused)) gswitch *g)
  {
  }

@@ -1630,12 +1630,12 @@ GimpleWalker::walk_gphi (gphi *g)
  }

  void
-GimpleWalker::_walk_gphi (gphi *g)
+GimpleWalker::_walk_gphi (__attribute__((unused)) gphi *g)
  {
  }

  void
-TypeCollector::collect (const_tree t)
+TypeCollector::collect (tree t)
  {
    const bool in_set = ptrset.in_universe (t);
    // Early memoization...
@@ -1670,9 +1670,9 @@ TypeCollector::_sanity_check ()
  	    f = ptrset.complement.end ();
  	   j != f; ++j)
  	{
-	  const_tree type_ptr = *i;
+	  tree type_ptr = *i;
  	  gcc_assert (type_ptr);
-	  const_tree type_com = *j;
+	  tree type_com = *j;
  	  gcc_assert (type_com);
  	  const bool valid_sets = type_ptr != type_com;
  	  if (valid_sets)
@@ -1690,7 +1690,7 @@ TypeCollector::_sanity_check ()

  /* Determine if T is already memoized in the TypeCollector.  */
  bool
-TypeCollector::is_memoized (const_tree t)
+TypeCollector::is_memoized (tree t)
  {
    /* If we haven't seen it then no.  */
    const bool in_set = ptrset.in_universe (t);
@@ -1701,7 +1701,7 @@ TypeCollector::is_memoized (const_tree t)
    // we must update all types that can refer
    // to memoized type.
    const bool points_to_record = ptrset.in_points_to_record (t);
-  for (std::map<const_tree, bool>::iterator i = ptr.begin (),
+  for (std::map<tree, bool>::iterator i = ptr.begin (),
  	e = ptr.end (); i != e; ++i)
      {
        i->second |= points_to_record;
@@ -1710,91 +1710,91 @@ TypeCollector::is_memoized (const_tree t)
  }

  void
-TypeCollector::_walk_VOID_TYPE_pre (const_tree t)
+TypeCollector::_walk_VOID_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_VOID_TYPE_post (const_tree t)
+TypeCollector::_walk_VOID_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_INTEGER_TYPE_pre (const_tree t)
+TypeCollector::_walk_INTEGER_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_INTEGER_TYPE_post (const_tree t)
+TypeCollector::_walk_INTEGER_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_REAL_TYPE_pre (const_tree t)
+TypeCollector::_walk_REAL_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_REAL_TYPE_post (const_tree t)
+TypeCollector::_walk_REAL_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_FIXED_POINT_TYPE_pre (const_tree t)
+TypeCollector::_walk_FIXED_POINT_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_FIXED_POINT_TYPE_post (const_tree t)
+TypeCollector::_walk_FIXED_POINT_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_COMPLEX_TYPE_pre (const_tree t)
+TypeCollector::_walk_COMPLEX_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_COMPLEX_TYPE_post (const_tree t)
+TypeCollector::_walk_COMPLEX_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_ENUMERAL_TYPE_pre (const_tree t)
+TypeCollector::_walk_ENUMERAL_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_ENUMERAL_TYPE_post (const_tree t)
+TypeCollector::_walk_ENUMERAL_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_BOOLEAN_TYPE_pre (const_tree t)
+TypeCollector::_walk_BOOLEAN_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_BOOLEAN_TYPE_post (const_tree t)
+TypeCollector::_walk_BOOLEAN_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_collect_simple (const_tree t)
+TypeCollector::_collect_simple (tree t)
  {
    // Insert into persistent set.
    ptrset.insert (t, ptr[t]);
@@ -1803,46 +1803,46 @@ TypeCollector::_collect_simple (const_tree t)
  }

  void
-TypeCollector::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeCollector::_walk_ARRAY_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_ARRAY_TYPE_post (const_tree t)
+TypeCollector::_walk_ARRAY_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_POINTER_TYPE_pre (const_tree t)
+TypeCollector::_walk_POINTER_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_POINTER_TYPE_post (const_tree t)
+TypeCollector::_walk_POINTER_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_REFERENCE_TYPE_pre (const_tree t)
+TypeCollector::_walk_REFERENCE_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_REFERENCE_TYPE_post (const_tree t)
+TypeCollector::_walk_REFERENCE_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_RECORD_TYPE_post (const_tree t)
+TypeCollector::_walk_RECORD_TYPE_post (tree t)
  {
    // All in ptr point to record
-  for (std::map<const_tree, bool>::iterator i = ptr.begin (),
+  for (std::map<tree, bool>::iterator i = ptr.begin (),
  	e = ptr.end (); i != e; ++i)
      {
        i->second = true;
@@ -1852,52 +1852,52 @@ TypeCollector::_walk_RECORD_TYPE_post (const_tree t)
  }

  void
-TypeCollector::_walk_RECORD_TYPE_pre (const_tree t)
+TypeCollector::_walk_RECORD_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_UNION_TYPE_pre (const_tree t)
+TypeCollector::_walk_UNION_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_UNION_TYPE_post (const_tree t)
+TypeCollector::_walk_UNION_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_FUNCTION_TYPE_post (const_tree t)
+TypeCollector::_walk_FUNCTION_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_FUNCTION_TYPE_pre (const_tree t)
+TypeCollector::_walk_FUNCTION_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  void
-TypeCollector::_walk_METHOD_TYPE_post (const_tree t)
+TypeCollector::_walk_METHOD_TYPE_post (tree t)
  {
    _collect_simple (t);
  }

  void
-TypeCollector::_walk_METHOD_TYPE_pre (const_tree t)
+TypeCollector::_walk_METHOD_TYPE_pre (tree t)
  {
    ptr[t] = false;
  }

  inline void
-ExprCollector::_walk_pre (const_tree e)
+ExprCollector::_walk_pre (tree e)
  {
    if (!e) return;
-  const_tree t = TREE_TYPE (e);
+  tree t = TREE_TYPE (e);
    gcc_assert (t);
    typeCollector.collect (t);

@@ -1908,11 +1908,11 @@ ExprCollector::_walk_pre (const_tree e)
      return;
    }

-  for (std::set<const_tree>::iterator
+  for (std::set<tree>::iterator
  	i = typeCollector.ptrset.records.begin (),
  	e = typeCollector.ptrset.records.end (); i != e; ++i)
    {
-    const_tree r = *i;
+    tree r = *i;
      TypeIncompleteEquality structuralEquality;
      bool is_same = structuralEquality.equal (TYPE_MAIN_VARIANT (r), 
TYPE_MAIN_VARIANT (t));
      if (is_same) continue;
@@ -1931,7 +1931,7 @@ ExprCollector::_walk_pre (const_tree e)
   * * does not reach a RECORD_TYPE.
   */
  void
-GimpleTypeCollector::_walk_pre_tree (const_tree t)
+GimpleTypeCollector::_walk_pre_tree (tree t)
  {
    if (!t) return;
    exprCollector.walk (t);
@@ -1950,7 +1950,7 @@ GimpleTypeCollector::_walk_pre_tree (const_tree t)
  void
  GimpleTypeCollector::_walk_pre_gassign (gassign *s)
  {
-  const_tree lhs = gimple_assign_lhs (s);
+  tree lhs = gimple_assign_lhs (s);
    exprCollector.walk (lhs);

    const enum gimple_rhs_class gclass = gimple_assign_rhs_class (s);
@@ -1958,20 +1958,20 @@ GimpleTypeCollector::_walk_pre_gassign (gassign *s)
      {
      case GIMPLE_TERNARY_RHS:
        {
-	const_tree rhs = gimple_assign_rhs3 (s);
+	tree rhs = gimple_assign_rhs3 (s);
  	exprCollector.walk (rhs);
        }
      /* fall-through */
      case GIMPLE_BINARY_RHS:
        {
-	const_tree rhs = gimple_assign_rhs2 (s);
+	tree rhs = gimple_assign_rhs2 (s);
  	exprCollector.walk (rhs);
        }
      /* fall-through */
      case GIMPLE_UNARY_RHS:
      case GIMPLE_SINGLE_RHS:
        {
-	const_tree rhs = gimple_assign_rhs1 (s);
+	tree rhs = gimple_assign_rhs1 (s);
  	exprCollector.walk (rhs);
        }
        break;
@@ -1984,7 +1984,7 @@ GimpleTypeCollector::_walk_pre_gassign (gassign *s)
  void
  GimpleTypeCollector::_walk_pre_greturn (greturn *s)
  {
-  const_tree retval = gimple_return_retval (s);
+  tree retval = gimple_return_retval (s);
    if (!retval)
      return;

@@ -1998,12 +1998,12 @@ GimpleTypeCollector::_walk_pre_gcall (gcall *s)
    unsigned n = gimple_call_num_args (s);
    for (unsigned i = 0; i < n; i++)
      {
-      const_tree a = gimple_call_arg (s, i);
+      tree a = gimple_call_arg (s, i);
        exprCollector.walk (a);
      }

    // Walk over the return type if it exists.
-  const_tree lhs = gimple_call_lhs (s);
+  tree lhs = gimple_call_lhs (s);
    if (!lhs)
      return;

@@ -2032,14 +2032,14 @@ GimpleTypeCollector::print_collected ()
  void
  GimpleTypeCollector::_walk_pre_gcond (gcond *s)
  {
-  const_tree lhs = gimple_cond_lhs (s);
+  tree lhs = gimple_cond_lhs (s);
    exprCollector.walk (lhs);
-  const_tree rhs = gimple_cond_rhs (s);
+  tree rhs = gimple_cond_rhs (s);
    exprCollector.walk (rhs);
  }

  bool
-TypeEscaper::is_memoized (__attribute__ ((unused)) const_tree t)
+TypeEscaper::is_memoized (__attribute__ ((unused)) tree t)
  {
    // Can't memoize here because
    // information is propagated up and down
@@ -2064,7 +2064,7 @@ TypeEscaper::place_escaping_types_in_set ()
    TypeStringifier stringifier;
    for (typemap::iterator i = calc.begin (), e = calc.end (); i != e; ++i)
      {
-      const_tree type = i->first;
+      tree type = i->first;

        // We should only track interesting types
        // Types which are not in points_to_record are the ones
@@ -2080,7 +2080,7 @@ TypeEscaper::place_escaping_types_in_set ()
  }

  void
-TypeEscaper::update (const_tree t, Reason r)
+TypeEscaper::update (tree t, Reason r)
  {
    gcc_assert (t);
    _reason = r;
@@ -2088,7 +2088,7 @@ TypeEscaper::update (const_tree t, Reason r)
  }

  void
-TypeEscaper::_update (const_tree t)
+TypeEscaper::_update (tree t)
  {
    gcc_assert (t);
    const bool already_in_typemap = calc.find (t) != calc.end ();
@@ -2105,37 +2105,37 @@ TypeEscaper::_update (const_tree t)
  }

  void
-TypeEscaper::_walk_ARRAY_TYPE_pre (const_tree t)
+TypeEscaper::_walk_ARRAY_TYPE_pre (tree t)
  {
    _update (t);
  }

  void
-TypeEscaper::_walk_ARRAY_TYPE_post (const_tree t)
+TypeEscaper::_walk_ARRAY_TYPE_post (tree t)
  {
    _update (t);
  }

  void
-TypeEscaper::_walk_POINTER_TYPE_pre (const_tree t)
+TypeEscaper::_walk_POINTER_TYPE_pre (tree t)
  {
    _update (t);
  }

  void
-TypeEscaper::_walk_POINTER_TYPE_post (const_tree t)
+TypeEscaper::_walk_POINTER_TYPE_post (tree t)
  {
    _update (t);
  }

  void
-TypeEscaper::_walk_REFERENCE_TYPE_pre (const_tree t)
+TypeEscaper::_walk_REFERENCE_TYPE_pre (tree t)
  {
    _update (t);
  }

  void
-TypeEscaper::_walk_RECORD_TYPE_pre (const_tree t)
+TypeEscaper::_walk_RECORD_TYPE_pre (tree t)
  {
    // we are entering a record
    _inside_record++;
@@ -2143,7 +2143,7 @@ TypeEscaper::_walk_RECORD_TYPE_pre (const_tree t)
  }

  void
-TypeEscaper::_walk_RECORD_TYPE_post (const_tree t)
+TypeEscaper::_walk_RECORD_TYPE_post (tree t)
  {
    _update (t); // This is in case there was a union
    // we are exiting a record
@@ -2154,7 +2154,7 @@ TypeEscaper::_walk_RECORD_TYPE_post (const_tree t)
   * and propagate up and down.
   */
  void
-TypeEscaper::_walk_UNION_TYPE_pre (const_tree t)
+TypeEscaper::_walk_UNION_TYPE_pre (tree t)
  {
    _inside_union++;
    bool is_escaping = _inside_union > 0;
@@ -2166,13 +2166,13 @@ TypeEscaper::_walk_UNION_TYPE_pre (const_tree t)
   * and down.
   */
  void
-TypeEscaper::_walk_field_pre (const_tree t)
+TypeEscaper::_walk_field_pre (tree t)
  {
    _reason.type_is_in_union |= DECL_BIT_FIELD (t);
  }

  void
-TypeEscaper::_walk_UNION_TYPE_post (const_tree t)
+TypeEscaper::_walk_UNION_TYPE_post (tree t)
  {
    _inside_union--;
    _update (t);
@@ -2182,7 +2182,7 @@ TypeEscaper::_walk_UNION_TYPE_post (const_tree t)
   * propagate up and down.
   */
  void
-TypeEscaper::_walk_FUNCTION_TYPE_pre (__attribute__ ((unused)) 
const_tree t)
+TypeEscaper::_walk_FUNCTION_TYPE_pre (__attribute__ ((unused)) tree t)
  {
    _reason.type_is_in_union |= _inside_record > 0;
  }
@@ -2191,7 +2191,7 @@ TypeEscaper::_walk_FUNCTION_TYPE_pre 
(__attribute__ ((unused)) const_tree t)
   * propagate up and down.
   */
  void
-TypeEscaper::_walk_METHOD_TYPE_pre (__attribute__ ((unused)) const_tree t)
+TypeEscaper::_walk_METHOD_TYPE_pre (__attribute__ ((unused)) tree t)
  {
    _reason.type_is_in_union |= _inside_record > 0;
  }
@@ -2203,7 +2203,7 @@ TypeEscaper::print_reasons ()
    TypeStringifier stringifier;
    for (typemap::iterator i = calc.begin (), e = calc.end (); i != e; ++i)
      {
-      const_tree t = i->first;
+      tree t = i->first;
        std::string name = stringifier.stringify (t);
        Reason r = i->second;
        log ("%s reason: ", name.c_str ());
@@ -2225,7 +2225,7 @@ ExprEscaper::print_reasons ()

  /* Propagate reason to subexpressions.  */
  void
-ExprEscaper::update (const_tree t, Reason r)
+ExprEscaper::update (tree t, Reason r)
  {
    gcc_assert (t);
    _r = r;
@@ -2234,26 +2234,26 @@ ExprEscaper::update (const_tree t, Reason r)

  /* Propagate reason to type of subexpressions.  */
  void
-ExprEscaper::_walk_pre (const_tree e)
+ExprEscaper::_walk_pre (tree e)
  {
    _stack.push (e);
-  const_tree t = TREE_TYPE (e);
+  tree t = TREE_TYPE (e);

    gcc_assert (t);
    typeEscaper.update (t, _r);
  }

  void
-ExprEscaper::_walk_post (__attribute__ ((unused)) const_tree e)
+ExprEscaper::_walk_post (__attribute__ ((unused)) tree e)
  {
    _stack.pop ();
  }

  /* Capture casting on LHS.  */
  void
-ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
+ExprEscaper::_walk_SSA_NAME_pre (tree e)
  {
-  const_tree ssa_type = TREE_TYPE (e);
+  tree ssa_type = TREE_TYPE (e);

    if (_stack.size () < 4)
      return;
@@ -2261,11 +2261,11 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)
    // TODO:
    // It appears that we have a bug, where we are
    // storing expressions twice on the stack
-  const_tree this_expr = _stack.top ();
+  tree this_expr = _stack.top ();
    _stack.pop ();
-  const_tree twice = _stack.top ();
+  tree twice = _stack.top ();
    _stack.pop ();
-  const_tree prev_expr = _stack.top ();
+  tree prev_expr = _stack.top ();
    _stack.push (twice);
    _stack.push (this_expr);
    if (TREE_CODE (prev_expr) != MEM_REF)
@@ -2273,7 +2273,7 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)

    tree op1 = TREE_OPERAND (prev_expr, 1);
    gcc_assert (TREE_CODE (op1) == INTEGER_CST);
-  const_tree mref_type = TREE_TYPE (op1);
+  tree mref_type = TREE_TYPE (op1);

    Reason old_reason = _r;
    TypeIncompleteEquality structuralEquality;
@@ -2289,7 +2289,7 @@ ExprEscaper::_walk_SSA_NAME_pre (const_tree e)

  /* Mark constructors as escaping.  */
  void
-ExprEscaper::_walk_CONSTRUCTOR_pre (const_tree e)
+ExprEscaper::_walk_CONSTRUCTOR_pre (tree e)
  {
    if (TREE_CLOBBER_P (e))
      return;
@@ -2299,7 +2299,7 @@ ExprEscaper::_walk_CONSTRUCTOR_pre (const_tree e)
    // a this has a constructor.
    // Or better yet... modify the constructors!
    _r.global_is_visible = true;
-  const_tree t = TREE_TYPE (e);
+  tree t = TREE_TYPE (e);
    typeEscaper.update (t, _r);
  }

@@ -2327,7 +2327,7 @@ GimpleEscaper::_init ()
        if (filter)
  	continue;

-      const_tree decl = cnode->decl;
+      tree decl = cnode->decl;
        gcc_assert (decl);
        undefined.insert (decl);
      }
@@ -2336,7 +2336,7 @@ GimpleEscaper::_init ()
      {
        gcc_assert (cnode);
        cnode->get_untransformed_body ();
-      const_tree decl = cnode->decl;
+      tree decl = cnode->decl;
        gcc_assert (decl);
        undefined.erase (decl);
      }
@@ -2356,7 +2356,7 @@ GimpleEscaper::is_function_escaping (cgraph_node 
*cnode)
  /* Mark fndecl as escaping is they are externally visible or
   * there is no fndecl.  */
  bool
-GimpleEscaper::is_function_escaping (const_tree fndecl)
+GimpleEscaper::is_function_escaping (tree fndecl)
  {
    if (!fndecl)
      return true;
@@ -2383,7 +2383,7 @@ void
  GimpleEscaper::_walk_global (varpool_node *vnode)
  {
    gcc_assert (vnode);
-  const_tree var_decl = vnode->decl;
+  tree var_decl = vnode->decl;
    Reason reason;
    const bool is_escaping = is_variable_escaping (vnode);
    reason.global_is_visible = is_escaping;
@@ -2405,7 +2405,7 @@ GimpleEscaper::_walk_global (varpool_node *vnode)

  /* Return true if FNDECL is a known function.  */
  bool
-GimpleEscaper::filter_known_function (const_tree fndecl)
+GimpleEscaper::filter_known_function (tree fndecl)
  {
    assert_is_type (fndecl, FUNCTION_DECL);
    if (fndecl_built_in_p (fndecl))
@@ -2438,7 +2438,7 @@ GimpleEscaper::filter_known_function (cgraph_node 
*node)

  /* Mark Variable declaration of unknown location as escaping.  */
  void
-GimpleEscaper::_walk_pre_tree (const_tree t)
+GimpleEscaper::_walk_pre_tree (tree t)
  {
    // Is any global variable escaping?
    Reason reason;
@@ -2463,22 +2463,22 @@ GimpleEscaper::_walk_pre_gassign (gassign *s)
      {
      case GIMPLE_TERNARY_RHS:
        {
-	const_tree rhs3 = gimple_assign_rhs3 (s);
+	tree rhs3 = gimple_assign_rhs3 (s);
  	exprEscaper.update (rhs3, reason);
        }
      /* fall-through */
      case GIMPLE_BINARY_RHS:
        {
-	const_tree rhs2 = gimple_assign_rhs2 (s);
+	tree rhs2 = gimple_assign_rhs2 (s);
  	exprEscaper.update (rhs2, reason);
        }
      /* fall-through */
      case GIMPLE_UNARY_RHS:
      case GIMPLE_SINGLE_RHS:
        {
-	const_tree rhs1 = gimple_assign_rhs1 (s);
+	tree rhs1 = gimple_assign_rhs1 (s);
  	exprEscaper.update (rhs1, reason);
-	const_tree lhs = gimple_assign_lhs (s);
+	tree lhs = gimple_assign_lhs (s);
  	if (!lhs)
  	  break;
  	exprEscaper.update (lhs, reason);
@@ -2494,7 +2494,7 @@ void
  GimpleEscaper::_walk_pre_greturn (greturn *s)
  {
    Reason reason;
-  const_tree val = gimple_return_retval (s);
+  tree val = gimple_return_retval (s);
    if (!val)
      return;
    exprEscaper.update (val, reason);
@@ -2504,8 +2504,8 @@ void
  GimpleEscaper::_walk_pre_gcond (gcond *s)
  {
    Reason reason;
-  const_tree lhs = gimple_cond_lhs (s);
-  const_tree rhs = gimple_cond_rhs (s);
+  tree lhs = gimple_cond_lhs (s);
+  tree rhs = gimple_cond_rhs (s);
    gcc_assert (lhs && rhs);
    exprEscaper.update (lhs, reason);
    exprEscaper.update (rhs, reason);
@@ -2514,7 +2514,7 @@ GimpleEscaper::_walk_pre_gcond (gcond *s)
  void
  GimpleEscaper::_walk_pre_gcall (gcall *s)
  {
-  const_tree fn = gimple_call_fndecl (s);
+  tree fn = gimple_call_fndecl (s);
    // gcc_assert (fn);
    // The above will not always be true
    // It will be false when we have an indirect function
@@ -2532,7 +2532,7 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
    unsigned n = gimple_call_num_args (s);
    for (unsigned i = 0; i < n; i++)
      {
-      const_tree a = gimple_call_arg (s, i);
+      tree a = gimple_call_arg (s, i);
        gcc_assert (a);
        if (arg_reason.is_escaping ())
  	{
@@ -2542,7 +2542,7 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
        exprEscaper.typeEscaper.update (TREE_TYPE (a), arg_reason);
      }

-  const_tree lhs = gimple_call_lhs (s);
+  tree lhs = gimple_call_lhs (s);
    if (!lhs)
      return;
    Reason return_reason;
@@ -2554,14 +2554,14 @@ GimpleEscaper::_walk_pre_gcall (gcall *s)
  /* Determine if cast comes from a known function.
   * Do this by following the use-def chain.  */
  bool
-GimpleCaster::follow_def_to_find_if_really_cast (const_tree rhs)
+GimpleCaster::follow_def_to_find_if_really_cast (tree rhs)
  {
    gimple *def_for_rhs = SSA_NAME_DEF_STMT (rhs);
    gcall *is_call = dyn_cast<gcall *> (def_for_rhs);
    if (!is_call)
      return true;

-  const_tree fn = gimple_call_fndecl (is_call);
+  tree fn = gimple_call_fndecl (is_call);
    if (!fn)
      return true;

@@ -2581,12 +2581,12 @@ GimpleCaster::_walk_pre_gassign (gassign *s)
    // but that proved to be insufficient...
    // So we have to use our equality comparison...
    TypeIncompleteEquality equality;
-  const_tree lhs = gimple_assign_lhs (s);
-  const_tree rhs = gimple_assign_rhs1 (s);
+  tree lhs = gimple_assign_lhs (s);
+  tree rhs = gimple_assign_rhs1 (s);
    gcc_assert (lhs && rhs);
    Reason reason;
-  const_tree t_lhs = TREE_TYPE (lhs);
-  const_tree t_rhs = TREE_TYPE (rhs);
+  tree t_lhs = TREE_TYPE (lhs);
+  tree t_rhs = TREE_TYPE (rhs);
    gcc_assert (t_lhs && t_rhs);
    bool is_cast = !equality.equal (TYPE_MAIN_VARIANT(t_lhs), 
TYPE_MAIN_VARIANT(t_rhs));
    // If it is cast, we might need to look at the definition of rhs
@@ -2639,14 +2639,14 @@ GimpleCaster::_walk_pre_gcall (gcall *s)

    if (!node && currently_walking->inlined_to) return;

-  const_tree f_t = TREE_TYPE (fn);
+  tree f_t = TREE_TYPE (fn);
    TypeIncompleteEquality equality;

    unsigned i = 0;
    TypeStringifier stringifier;
    for (tree a = TYPE_ARG_TYPES (f_t); NULL_TREE != a; a = TREE_CHAIN (a))
      {
-      const_tree formal_t = TREE_VALUE (a);
+      tree formal_t = TREE_VALUE (a);
        //if (formal_t == ptr_type_node) continue;
        //if (formal_t == void_type_node) continue;
        // There seems to be a final VOID_TYPE at the end of some functions?
@@ -2655,8 +2655,8 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
        if (is_void)
  	continue;

-      const_tree real = gimple_call_arg (s, i);
-      const_tree real_t = TREE_TYPE (real);
+      tree real = gimple_call_arg (s, i);
+      tree real_t = TREE_TYPE (real);
        const bool is_casted = !equality.equal (formal_t, real_t);
        log("arg %s is casted: %s\n", 
stringifier.stringify(real_t).c_str(), is_casted ? "T" : "F");
        Reason arg_reason;
@@ -2665,12 +2665,12 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
        i++;
      }

-  const_tree lhs = gimple_call_lhs (s);
+  tree lhs = gimple_call_lhs (s);
    if (!lhs)
      return;

-  const_tree r_t = TREE_TYPE (f_t);
-  const_tree l_t TREE_TYPE (lhs);
+  tree r_t = TREE_TYPE (f_t);
+  tree l_t TREE_TYPE (lhs);
    const bool is_casted = !equality.equal (r_t, l_t);
    Reason ret_reason;
    ret_reason.type_is_casted = is_casted;
@@ -2678,14 +2678,14 @@ GimpleCaster::_walk_pre_gcall (gcall *s)
  }

  bool
-TypeAccessor::is_memoized (const_tree t)
+TypeAccessor::is_memoized (tree t)
  {
    return memoized_map.find (t) != memoized_map.end ();
  }

  /* Add all fields in struct to memoized map.  */
  void
-TypeAccessor::_walk_RECORD_TYPE_pre (const_tree t)
+TypeAccessor::_walk_RECORD_TYPE_pre (tree t)
  {
    add_all_fields_in_struct (t);
    memoized_map.insert (t);
@@ -2693,7 +2693,7 @@ TypeAccessor::_walk_RECORD_TYPE_pre (const_tree t)

  /* Initialize all fields as neither read nor written.  */
  void
-TypeAccessor::add_all_fields_in_struct (const_tree t)
+TypeAccessor::add_all_fields_in_struct (tree t)
  {
    const enum tree_code c = TREE_CODE (t);
    const bool is_record = RECORD_TYPE == c;
@@ -2724,27 +2724,27 @@ ExprAccessor::get_map ()
  }

  void
-ExprAccessor::add_all_fields_in_struct (const_tree t)
+ExprAccessor::add_all_fields_in_struct (tree t)
  {
    _typeAccessor.walk (t);
  }

  void
-ExprAccessor::_walk_pre (const_tree e)
+ExprAccessor::_walk_pre (tree e)
  {
    _stack.push (e);
-  const_tree t = TREE_TYPE (e);
+  tree t = TREE_TYPE (e);
    add_all_fields_in_struct (t);
  }

  void
-ExprAccessor::_walk_post (__attribute__ ((unused)) const_tree e)
+ExprAccessor::_walk_post (__attribute__ ((unused)) tree e)
  {
    _stack.pop ();
  }

  void
-ExprAccessor::update (const_tree e, unsigned access)
+ExprAccessor::update (tree e, unsigned access)
  {
    _access = access;
    walk (e);
@@ -2763,7 +2763,7 @@ ExprAccessor::update (const_tree e, unsigned access)
   * read.
   */
  void
-ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) const_tree e)
+ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ ((unused)) tree e)
  {
    log ("expr accessor mem ref\n");
    log ("stack size = %d\n", _stack.size ());
@@ -2772,11 +2772,11 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ 
((unused)) const_tree e)
      return;

    // TODO: Fix error with double pushing
-  const_tree addr_expr = _stack.top ();
+  tree addr_expr = _stack.top ();
    _stack.pop ();
-  const_tree twice = _stack.top ();
+  tree twice = _stack.top ();
    _stack.pop ();
-  const_tree prev_expr = _stack.top ();
+  tree prev_expr = _stack.top ();
    _stack.push (addr_expr);
    _stack.push (twice);
    log ("prev_expr code = %s\n", get_tree_code_name (TREE_CODE 
(prev_expr)));
@@ -2784,7 +2784,7 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ 
((unused)) const_tree e)
      return;

    tree op_0 = TREE_OPERAND (addr_expr, 0);
-  const_tree addr_expr_t = TREE_TYPE (op_0);
+  tree addr_expr_t = TREE_TYPE (op_0);

    TypeStringifier stringifier;
    std::string name = stringifier.stringify (addr_expr_t);
@@ -2794,7 +2794,7 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ 
((unused)) const_tree e)

    // We are accessing a field of a record through pointer arithmetic...
    // So what field offset are we computing...
-  const_tree mref_expr = prev_expr;
+  tree mref_expr = prev_expr;
    tree offset = TREE_OPERAND (mref_expr, 1);
    gcc_assert (TREE_CODE (offset) == INTEGER_CST);
    tree type_size_tree = TYPE_SIZE_UNIT (addr_expr_t);
@@ -2842,13 +2842,13 @@ ExprAccessor::_walk_ADDR_EXPR_pre (__attribute__ 
((unused)) const_tree e)
   * RECORD_TYPE should be marked as READ for safety.
   */
  void
-ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
+ExprAccessor::_walk_COMPONENT_REF_pre (tree e)
  {
    log ("in component_ref pre\n");
    assert_is_type (e, COMPONENT_REF);
-  const_tree op0 = TREE_OPERAND (e, 0);
+  tree op0 = TREE_OPERAND (e, 0);
    gcc_assert (op0);
-  const_tree op0_t = TREE_TYPE (op0);
+  tree op0_t = TREE_TYPE (op0);
    gcc_assert (op0_t);
    // op0_t can either be a RECORD_TYPE or a UNION_TYPE.
    const enum tree_code code = TREE_CODE (op0_t);
@@ -2857,7 +2857,7 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
    const bool valid = is_record != is_union;
    gcc_assert (valid);

-  const_tree op1 = TREE_OPERAND (e, 1);
+  tree op1 = TREE_OPERAND (e, 1);
    assert_is_type (op1, FIELD_DECL);
    log ("%s.%s\n", TypeStringifier::get_type_identifier (op0_t),
         TypeStringifier::get_field_identifier (op1));
@@ -2876,18 +2876,18 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
    if (_stack.size () < 4)
      return;

-  const_tree this_expr = _stack.top ();
+  tree this_expr = _stack.top ();
    _stack.pop ();
-  const_tree twice = _stack.top ();
+  tree twice = _stack.top ();
    _stack.pop ();
-  const_tree prev_expr = _stack.top ();
+  tree prev_expr = _stack.top ();
    _stack.push (twice);
    _stack.push (this_expr);
    if (TREE_CODE (prev_expr) != ADDR_EXPR)
      return;

    log ("we are taking address of a component?\n");
-  const_tree t = op0_t;
+  tree t = op0_t;
    if (TREE_CODE (t) != RECORD_TYPE)
      return;

@@ -2914,19 +2914,19 @@ ExprAccessor::_walk_COMPONENT_REF_pre (const_tree e)
  void
  ExprAccessor::print_accesses ()
  {
-  for (std::map<const_tree, field_access_map_t>::const_iterator i
+  for (std::map<tree, field_access_map_t>::const_iterator i
         = record_field_map.begin (),
         e = record_field_map.end ();
         i != e; ++i)
      {
-      const_tree record = i->first;
+      tree record = i->first;
        field_access_map_t field_map = i->second;
-      for (std::map<const_tree, unsigned>::const_iterator j
+      for (std::map<tree, unsigned>::const_iterator j
  	   = field_map.begin (),
  	   f = field_map.end ();
  	   j != f; ++j)
  	{
-	  const_tree field = j->first;
+	  tree field = j->first;
  	  const std::string name_r
  	    = TypeStringifier::get_type_identifier (record);
  	  const std::string name_f
@@ -2962,14 +2962,14 @@ GimpleAccesser::_walk_pre_gassign (gassign *s)
      {
      case GIMPLE_TERNARY_RHS:
        {
-	const_tree rhs3 = gimple_assign_rhs3 (s);
+	tree rhs3 = gimple_assign_rhs3 (s);
  	gcc_assert (rhs3);
  	exprAccessor.update (rhs3, Read);
        }
      /* fall-through */
      case GIMPLE_BINARY_RHS:
        {
-	const_tree rhs2 = gimple_assign_rhs2 (s);
+	tree rhs2 = gimple_assign_rhs2 (s);
  	gcc_assert (rhs2);
  	exprAccessor.update (rhs2, Read);
        }
@@ -2977,9 +2977,9 @@ GimpleAccesser::_walk_pre_gassign (gassign *s)
      case GIMPLE_UNARY_RHS:
      case GIMPLE_SINGLE_RHS:
        {
-	const_tree rhs1 = gimple_assign_rhs1 (s);
+	tree rhs1 = gimple_assign_rhs1 (s);
  	exprAccessor.update (rhs1, Read);
-	const_tree lhs = gimple_assign_lhs (s);
+	tree lhs = gimple_assign_lhs (s);
  	if (!lhs)
  	  break;
  	exprAccessor.update (lhs, Write);
@@ -2998,12 +2998,12 @@ GimpleAccesser::_walk_pre_gcall (gcall *s)
    unsigned n = gimple_call_num_args (s);
    for (unsigned i = 0; i < n; i++)
      {
-      const_tree a = gimple_call_arg (s, i);
+      tree a = gimple_call_arg (s, i);
        gcc_assert (a);
        exprAccessor.update (a, Read);
      }

-  const_tree lhs = gimple_call_lhs (s);
+  tree lhs = gimple_call_lhs (s);
    if (!lhs)
      return;
    exprAccessor.update (lhs, Write);
@@ -3013,7 +3013,7 @@ GimpleAccesser::_walk_pre_gcall (gcall *s)
  void
  GimpleAccesser::_walk_pre_greturn (greturn *s)
  {
-  const_tree val = gimple_return_retval (s);
+  tree val = gimple_return_retval (s);
    if (!val)
      return;
    exprAccessor.update (val, Read);
@@ -3023,8 +3023,8 @@ GimpleAccesser::_walk_pre_greturn (greturn *s)
  void
  GimpleAccesser::_walk_pre_gcond (gcond *s)
  {
-  const_tree lhs = gimple_cond_lhs (s);
-  const_tree rhs = gimple_cond_rhs (s);
+  tree lhs = gimple_cond_lhs (s);
+  tree rhs = gimple_cond_rhs (s);
    gcc_assert (lhs && rhs);
    exprAccessor.update (lhs, Read);
    exprAccessor.update (rhs, Read);
@@ -3072,7 +3072,7 @@ Reason::operator|= (const Reason &other)

  /* Insert TYPE into a partition depending on IN_POINTS_TO_RECORD.  */
  void
-type_partitions_s::insert (const_tree type, bool in_points_to_record)
+type_partitions_s::insert (tree type, bool in_points_to_record)
  {
    gcc_assert (type);
    this->universe.insert (type);
@@ -3087,7 +3087,7 @@ type_partitions_s::insert (const_tree type, bool 
in_points_to_record)

  /* Find out whether TYPE is already in universe.  */
  bool
-type_partitions_s::in_universe (const_tree type) const
+type_partitions_s::in_universe (tree type) const
  {
    gcc_assert (type);
    const bool seen_before = this->universe.find (type) != 
this->universe.end ();
@@ -3096,7 +3096,7 @@ type_partitions_s::in_universe (const_tree type) const

  /* Find out whether TYPE is in points_to_record partition.  */
  bool
-type_partitions_s::in_points_to_record (const_tree type) const
+type_partitions_s::in_points_to_record (tree type) const
  {
    gcc_assert (type);
    const bool seen_before
@@ -3106,7 +3106,7 @@ type_partitions_s::in_points_to_record (const_tree 
type) const

  /* Find out whether TYPE is not in points to record partition.  */
  bool
-type_partitions_s::in_complement (const_tree type) const
+type_partitions_s::in_complement (tree type) const
  {
    gcc_assert (type);
    const bool seen_before
@@ -3116,7 +3116,7 @@ type_partitions_s::in_complement (const_tree type) 
const

  /* Stringify a type.  */
  std::string
-TypeStringifier::stringify (const_tree t)
+TypeStringifier::stringify (tree t)
  {
    if (!dump_file)
      return std::string ("");
@@ -3129,49 +3129,49 @@ TypeStringifier::stringify (const_tree t)
  }

  void
-TypeStringifier::_walk_VOID_TYPE_pre (const_tree t)
+TypeStringifier::_walk_VOID_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_INTEGER_TYPE_pre (const_tree t)
+TypeStringifier::_walk_INTEGER_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_REAL_TYPE_pre (const_tree t)
+TypeStringifier::_walk_REAL_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_FIXED_POINT_TYPE_pre (const_tree t)
+TypeStringifier::_walk_FIXED_POINT_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_COMPLEX_TYPE_pre (const_tree t)
+TypeStringifier::_walk_COMPLEX_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_OFFSET_TYPE_pre (const_tree t)
+TypeStringifier::_walk_OFFSET_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_walk_BOOLEAN_TYPE_pre (const_tree t)
+TypeStringifier::_walk_BOOLEAN_TYPE_pre (tree t)
  {
    _stringify_simple (t);
  }

  void
-TypeStringifier::_stringify_simple (const_tree t)
+TypeStringifier::_stringify_simple (tree t)
  {
    gcc_assert (t);
    const enum tree_code code = TREE_CODE (t);
@@ -3179,52 +3179,52 @@ TypeStringifier::_stringify_simple (const_tree t)
  }

  void
-TypeStringifier::_walk_POINTER_TYPE_post (__attribute__ ((unused)) 
const_tree t)
+TypeStringifier::_walk_POINTER_TYPE_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("*");
  }

  void
-TypeStringifier::_walk_ARRAY_TYPE_post (__attribute__ ((unused)) 
const_tree t)
+TypeStringifier::_walk_ARRAY_TYPE_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("[]");
  }

  void
  TypeStringifier::_walk_REFERENCE_TYPE_post (__attribute__ ((unused))
-					    const_tree t)
+					    tree t)
  {
    this->_stringification += std::string ("&");
  }

  void
-TypeStringifier::_walk_UNION_TYPE_pre (const_tree t)
+TypeStringifier::_walk_UNION_TYPE_pre (tree t)
  {
    this->_stringification += std::string (" union ");
    _stringify_aggregate_pre (t);
  }

  void
-TypeStringifier::_walk_UNION_TYPE_post (const_tree t)
+TypeStringifier::_walk_UNION_TYPE_post (tree t)
  {
    _stringify_aggregate_post (t);
  }

  void
-TypeStringifier::_walk_RECORD_TYPE_pre (const_tree t)
+TypeStringifier::_walk_RECORD_TYPE_pre (tree t)
  {
    this->_stringification += std::string (" record ");
    _stringify_aggregate_pre (t);
  }

  void
-TypeStringifier::_walk_RECORD_TYPE_post (const_tree t)
+TypeStringifier::_walk_RECORD_TYPE_post (tree t)
  {
    _stringify_aggregate_post (t);
  }

  void
-TypeStringifier::_stringify_aggregate_pre (const_tree t)
+TypeStringifier::_stringify_aggregate_pre (tree t)
  {
    this->_stringification
      += TypeStringifier::get_type_identifier (t) + std::string (" {");
@@ -3232,13 +3232,13 @@ TypeStringifier::_stringify_aggregate_pre 
(const_tree t)

  void
  TypeStringifier::_stringify_aggregate_post (__attribute__ ((unused))
-					    const_tree t)
+					    tree t)
  {
    this->_stringification += std::string ("}");
  }

  void
-TypeStringifier::_walk_field_post (const_tree t)
+TypeStringifier::_walk_field_post (tree t)
  {
    this->_stringification += std::string (" ")
  			    + TypeStringifier::get_field_identifier (t)
@@ -3246,73 +3246,73 @@ TypeStringifier::_walk_field_post (const_tree t)
  }

  void
-TypeStringifier::_walk_METHOD_TYPE_pre (const_tree t)
+TypeStringifier::_walk_METHOD_TYPE_pre (tree t)
  {
    _stringify_fm_pre (t);
  }

  void
-TypeStringifier::_walk_METHOD_TYPE_post (const_tree t)
+TypeStringifier::_walk_METHOD_TYPE_post (tree t)
  {
    _stringify_fm_post (t);
  }

  void
-TypeStringifier::_walk_FUNCTION_TYPE_pre (const_tree t)
+TypeStringifier::_walk_FUNCTION_TYPE_pre (tree t)
  {
    _stringify_fm_pre (t);
  }

  void
-TypeStringifier::_walk_FUNCTION_TYPE_post (const_tree t)
+TypeStringifier::_walk_FUNCTION_TYPE_post (tree t)
  {
    _stringify_fm_post (t);
  }

  void
-TypeStringifier::_stringify_fm_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_stringify_fm_pre (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("function { ");
  }

  void
-TypeStringifier::_stringify_fm_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_stringify_fm_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("}");
  }

  void
-TypeStringifier::_walk_return_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_return_pre (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("(");
  }

  void
-TypeStringifier::_walk_return_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_return_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string (")");
  }

  void
-TypeStringifier::_walk_args_pre (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_args_pre (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string ("(");
  }

  void
-TypeStringifier::_walk_args_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_args_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string (")");
  }

  void
-TypeStringifier::_walk_arg_post (__attribute__ ((unused)) const_tree t)
+TypeStringifier::_walk_arg_post (__attribute__ ((unused)) tree t)
  {
    this->_stringification += std::string (", ");
  }

  std::string
-TypeStringifier::get_type_identifier (const_tree t)
+TypeStringifier::get_type_identifier (tree t)
  {
    if (detected_incompatible_syntax)
      return std::string ("");
@@ -3333,10 +3333,10 @@ TypeStringifier::get_type_identifier (const_tree t)
  }

  std::string
-TypeStringifier::get_field_identifier (const_tree t)
+TypeStringifier::get_field_identifier (tree t)
  {
    assert_is_type (t, FIELD_DECL);
-  const_tree decl_name = DECL_NAME (t);
+  tree decl_name = DECL_NAME (t);
    if (!decl_name)
      return std::string ("");

@@ -3346,13 +3346,13 @@ TypeStringifier::get_field_identifier (const_tree t)

  /* Return true if L and R have equal structural equalities.  */
  bool
-TypeStructuralEquality::equal (const_tree l, const_tree r)
+TypeStructuralEquality::equal (tree l, tree r)
  {
    return _equal (l, r);
  }

  bool
-TypeStructuralEquality::_equal (const_tree l, const_tree r)
+TypeStructuralEquality::_equal (tree l, tree r)
  {
    bool valid_inputs = l && r;
    if (!valid_inputs)
@@ -3411,7 +3411,7 @@ TypeStructuralEquality::_equal (const_tree l, 
const_tree r)
  }

  bool
-TypeStructuralEquality::_equal_code (const_tree l, const_tree r)
+TypeStructuralEquality::_equal_code (tree l, tree r)
  {
    const enum tree_code code_l = TREE_CODE (l);
    const enum tree_code code_r = TREE_CODE (r);
@@ -3425,7 +3425,7 @@ TypeStructuralEquality::_equal_code (const_tree l, 
const_tree r)
  }

  #define TSE_FUNC_DEF_SIMPLE(code) 					  \
-  bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r)  \
+  bool TypeStructuralEquality::_walk_##code (tree l, tree r)  \
    {									  \
      return _equal_code (l, r);						  \
    }
@@ -3440,15 +3440,15 @@ TSE_FUNC_DEF_SIMPLE (OFFSET_TYPE)
  TSE_FUNC_DEF_SIMPLE (COMPLEX_TYPE)

  bool
-TypeStructuralEquality::_equal_wrapper (const_tree l, const_tree r)
+TypeStructuralEquality::_equal_wrapper (tree l, tree r)
  {
-  const_tree inner_l = TREE_TYPE (l);
+  tree inner_l = TREE_TYPE (l);
    if (TREE_CODE (inner_l) == ARRAY_TYPE
      && TREE_CODE (TREE_TYPE (inner_l)) == POINTER_TYPE )
    {
      inner_l = TREE_TYPE(inner_l);
    }
-  const_tree inner_r = TREE_TYPE (r);
+  tree inner_r = TREE_TYPE (r);
    if (TREE_CODE (inner_r) == ARRAY_TYPE
      && TREE_CODE(TREE_TYPE (inner_r)) == POINTER_TYPE )
    {
@@ -3458,7 +3458,7 @@ TypeStructuralEquality::_equal_wrapper (const_tree 
l, const_tree r)
  }

  #define TSE_FUNC_DEF_WRAPPER(code)					 \
-  bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+  bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
    {									 \
      return _equal_wrapper (l, r);					 \
    }
@@ -3468,10 +3468,10 @@ TSE_FUNC_DEF_WRAPPER (ARRAY_TYPE)
  TSE_FUNC_DEF_WRAPPER (POINTER_TYPE)

  #define TSE_FUNC_DEF_CONTAINER(code)					 \
-  bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+  bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
    {									 \
-    const_tree field_l = TYPE_FIELDS (l);				 \
-    const_tree field_r = TYPE_FIELDS (r);				 \
+    tree field_l = TYPE_FIELDS (l);				 \
+    tree field_r = TYPE_FIELDS (r);				 \
      bool efield_l = field_l;						 \
      bool efield_r = field_r;						 \
      bool still_equal = efield_l == efield_r;				 \
@@ -3480,8 +3480,8 @@ TSE_FUNC_DEF_WRAPPER (POINTER_TYPE)
  									 \
      while (field_l && field_r && still_equal) 				 \
        {									 \
-	const_tree tfield_l = TREE_TYPE (field_l);			 \
-	const_tree tfield_r = TREE_TYPE (field_r);			 \
+	tree tfield_l = TREE_TYPE (field_l);			 \
+	tree tfield_r = TREE_TYPE (field_r);			 \
  	still_equal &= _equal (tfield_l, tfield_r);			 \
  	field_l = DECL_CHAIN (field_l);					 \
  	field_r = DECL_CHAIN (field_r);					 \
@@ -3496,23 +3496,23 @@ TSE_FUNC_DEF_CONTAINER (RECORD_TYPE)
  TSE_FUNC_DEF_CONTAINER (UNION_TYPE)

  #define TSE_FUNC_DEF_FUNC(code)						 \
-  bool TypeStructuralEquality::_walk_##code (const_tree l, const_tree r) \
+  bool TypeStructuralEquality::_walk_##code (tree l, tree r) \
    {									 \
-    const_tree tret_l = TREE_TYPE (l);					 \
-    const_tree tret_r = TREE_TYPE (r);					 \
+    tree tret_l = TREE_TYPE (l);					 \
+    tree tret_r = TREE_TYPE (r);					 \
      bool still_equal = _equal (tret_l, tret_r);				 \
      if (!still_equal)							 \
        return still_equal;						 \
  									 \
-    const_tree arg_l = TYPE_ARG_TYPES (l);				 \
-    const_tree arg_r = TYPE_ARG_TYPES (r);				 \
+    tree arg_l = TYPE_ARG_TYPES (l);				 \
+    tree arg_r = TYPE_ARG_TYPES (r);				 \
      bool earg_l = arg_l;						 \
      bool earg_r = arg_r;						 \
      still_equal &= earg_l == earg_r;					 \
      while (arg_l && arg_r && still_equal)				 \
        {									 \
-	const_tree targ_l = TREE_VALUE (arg_l);				 \
-	const_tree targ_r = TREE_VALUE (arg_r);				 \
+	tree targ_l = TREE_VALUE (arg_l);				 \
+	tree targ_r = TREE_VALUE (arg_r);				 \
  	still_equal &= _equal (targ_l, targ_r);				 \
  	arg_l = TREE_CHAIN (arg_l);					 \
  	arg_r = TREE_CHAIN (arg_r);					 \
@@ -3528,7 +3528,7 @@ TSE_FUNC_DEF_FUNC (METHOD_TYPE)

  /* Used for comparing incomplete types.  */
  bool
-TypeIncompleteEquality::_equal (const_tree l, const_tree r)
+TypeIncompleteEquality::_equal (tree l, tree r)
  {
    bool valid_inputs = l && r;
    if (!valid_inputs)
@@ -3544,8 +3544,8 @@ TypeIncompleteEquality::_equal (const_tree l, 
const_tree r)

    // Before comparing with identifiers
    // make last attempt to compare using main variants.
-  const_tree m_l = TYPE_MAIN_VARIANT (l);
-  const_tree m_r = TYPE_MAIN_VARIANT (r);
+  tree m_l = TYPE_MAIN_VARIANT (l);
+  tree m_r = TYPE_MAIN_VARIANT (r);
    gcc_assert (m_l && m_r);
    can_compare_structurally = m_l == m_r;
    if (can_compare_structurally)
@@ -3568,20 +3568,20 @@ fix_escaping_types_in_set (tpartitions_t &types)
    TypeIncompleteEquality structuralEquality;
    do
      {
-      std::vector<const_tree> fixes;
+      std::vector<tree> fixes;
        fixed_point_reached = true;
-      for (std::set<const_tree>::const_iterator i = 
types.escaping.begin (),
+      for (std::set<tree>::const_iterator i = types.escaping.begin (),
  						e = types.escaping.end ();
  	   i != e; ++i)
  	{
-	  for (std::set<const_tree>::const_iterator j
+	  for (std::set<tree>::const_iterator j
  	       = types.non_escaping.begin (),
  	       f = types.non_escaping.end ();
  	       j != f; ++j)
  	    {
-	      const_tree type_esc = *i;
+	      tree type_esc = *i;
  	      gcc_assert (type_esc);
-	      const_tree type_non = *j;
+	      tree type_non = *j;
  	      gcc_assert (type_non);
  	      // There can be cases where incomplete types are marked as
  	      // non-escaping and complete types counter parts are marked as
@@ -3598,11 +3598,11 @@ fix_escaping_types_in_set (tpartitions_t &types)
  	    }
  	}

-      for (std::vector<const_tree>::const_iterator i = fixes.begin (),
+      for (std::vector<tree>::const_iterator i = fixes.begin (),
  						   e = fixes.end ();
  	   i != e; ++i)
  	{
-	  const_tree escaping_type = *i;
+	  tree escaping_type = *i;
  	  types.escaping.insert (escaping_type);
  	  types.non_escaping.erase (escaping_type);
  	}
diff --git a/gcc/ipa-type-escape-analysis.h b/gcc/ipa-type-escape-analysis.h
index 3a3f6ce168d..e3efcd15a24 100644
--- a/gcc/ipa-type-escape-analysis.h
+++ b/gcc/ipa-type-escape-analysis.h
@@ -27,8 +27,10 @@ along with GCC; see the file COPYING3.  If not see
  #include <set>

  /* Logging function, useful for debugging.  */
+void log (const char *const fmt, ...) __attribute__((format(printf, 1, 
0)));
+
  inline void
-log (const char *const fmt, ...)
+log (const char *const fmt, ...)
  {
    if (!dump_file)
      return;
@@ -52,17 +54,17 @@ is_gimple_code (const gimple *stmt, const enum 
gimple_code ex_code)

  /* Determine if type A is complete.  */
  inline bool
-is_complete (const_tree a)
+is_complete (tree a)
  {
    gcc_assert (a);
-  const_tree type_size = TYPE_SIZE (a);
+  tree type_size = TYPE_SIZE (a);
    const bool _is_complete = NULL_TREE != type_size;
    return _is_complete;
  }

  /* Asserts type A is complete.  */
  inline void
-assert_is_complete (const_tree a)
+assert_is_complete (tree a)
  {
    const bool _is_complete = is_complete (a);
    gcc_assert (_is_complete);
@@ -70,14 +72,14 @@ assert_is_complete (const_tree a)

  /* Determine if type A is incomplete.  */
  inline bool
-is_incomplete (const_tree a)
+is_incomplete (tree a)
  {
    return !is_complete (a);
  }

  /* Assert type A has is EXPECTED_CODE.  */
  inline void
-assert_is_type (const_tree a, const enum tree_code expected_code)
+assert_is_type (tree a, const enum tree_code expected_code)
  {
    gcc_assert (a);
    const enum tree_code observed_code = TREE_CODE (a);
@@ -97,19 +99,19 @@ assert_is_gimple_rhs_class (const gimple *stmt,
    gcc_assert (succeeds);
  }

-/* There are some cases where I need to change a const_tree to a tree.
+/* There are some cases where I need to change a tree to a tree.
   * Some of these are part of the way the API is written.  To avoid
   * warnings, always use this function for casting away const-ness.
   */
  inline static tree
-const_tree_to_tree (const_tree t)
+tree_to_tree (tree t)
  {
    return (tree) t;
  }

  // TODO: Rename?
  // TSET_T stands for type set.
-typedef std::set<const_tree> tset_t;
+typedef std::set<tree> tset_t;

  /* Base class used for visiting tree nodes starting with root T.
   * It can handle recursive cases in the tree graph by holding
@@ -128,7 +130,7 @@ public:
    /* Main interface to type walker.
     * Walk type T.
     */
-  void walk (const_tree t);
+  void walk (tree t);

  protected:

@@ -136,19 +138,19 @@ protected:
    tset_t tset;

    /* Inner walking method, used to recurse.  */
-  void _walk (const_tree t);
+  void _walk (tree t);

    /* Common walking method for REFERENCE_TYPE, ARRAY_TYPE, and 
POINTER_TYPE.  */
-  void _walk_wrapper (const_tree t);
+  void _walk_wrapper (tree t);

    /* Common walking method for RECORD_TYPE and UNION_TYPE.  */
-  void _walk_record_or_union (const_tree t);
+  void _walk_record_or_union (tree t);

    /* Common walking method for FUNCTION_TYPE and METHOD_TYPE.  */
-  virtual void _walk_function_or_method (const_tree t);
+  virtual void _walk_function_or_method (tree t);

    /* If the type is memoized and we don't need to walk further down.  */
-  virtual bool is_memoized (__attribute__ ((unused)) const_tree t)
+  virtual bool is_memoized (__attribute__ ((unused)) tree t)
    {
      return false;
    }
@@ -159,7 +161,7 @@ protected:
       If you want to find a specific type in a specific order,
       (e.g. RECORD_TYPE and preorder)
       you can create a derived class and implement the function
-     void _walk_RECORD_TYPE_pre (const_tree).
+     void _walk_RECORD_TYPE_pre (tree).

       walk_##code is the function that calls
       the preorder callback
@@ -171,12 +173,12 @@ protected:
       specific tree code.
     */
  #define TypeWalkerFuncDecl(code) \
-  virtual void _walk_##code##_pre (__attribute__((unused)) const_tree t) \
+  virtual void _walk_##code##_pre (__attribute__((unused)) tree t) \
    {}; \
-  virtual void _walk_##code (const_tree t); \
-  virtual void _walk_##code##_post (__attribute__((unused)) const_tree t) \
+  virtual void _walk_##code (tree t); \
+  virtual void _walk_##code##_post (__attribute__((unused)) tree t) \
    {}; \
-  virtual void walk_##code (const_tree t)
+  virtual void walk_##code (tree t)

  // NOTE the lack of semicolon here.
  // This is so that when using the macro we can use a semi-colon
@@ -226,19 +228,19 @@ public:
    {};

    /* Walk tree E.  */
-  void walk (const_tree e);
+  void walk (tree e);

  private:

    /* Virtual function to be implemented.  Callback for all E in 
preorder.  */
-  virtual void _walk_pre (__attribute__ ((unused)) const_tree e)
+  virtual void _walk_pre (__attribute__ ((unused)) tree e)
    {};

    /* Inner method that will recurse for walking subtrees in E.  */
-  void _walk (const_tree e);
+  void _walk (tree e);

    /* Virtual function to be implemented.  Callback for all E in 
postorder.  */
-  virtual void _walk_post (__attribute__ ((unused)) const_tree e)
+  virtual void _walk_post (__attribute__ ((unused)) tree e)
    {};

    /* Walking subtrees generically.  Either it is a leaf node,
@@ -249,10 +251,10 @@ private:
       tree_code C is used to assert that we are visiting an operand
       of a specific tree code.
     */
-  inline void _walk_leaf (const_tree e, const enum tree_code c);
-  inline void _walk_op_n (const_tree e, unsigned n);
-  inline void _walk_op_0 (const_tree e, const enum tree_code c);
-  inline void _walk_op_1 (const_tree e, const enum tree_code c);
+  inline void _walk_leaf (tree e, const enum tree_code c);
+  inline void _walk_op_n (tree e, unsigned n);
+  inline void _walk_op_0 (tree e, const enum tree_code c);
+  inline void _walk_op_1 (tree e, const enum tree_code c);

    /* Virtual function declarations for the pre-order and post-order 
callbacks.
     * _walk_##code##_pre is the preorder callback
@@ -261,11 +263,11 @@ private:
     * _walk_##code##_post is the post-order callback.
     */
  #define ExprWalkerFuncDecl(code) 					   \
-  virtual void _walk_##code##_pre (__attribute__ ((unused)) const_tree 
e)  \
+  virtual void _walk_##code##_pre (__attribute__ ((unused)) tree e)  \
    {};									   \
-  void walk_##code (const_tree e);					   \
-  void _walk_##code (const_tree e);					   \
-  virtual void _walk_##code##_post (__attribute__ ((unused)) const_tree 
e) \
+  void walk_##code (tree e);					   \
+  void _walk_##code (tree e);					   \
+  virtual void _walk_##code##_post (__attribute__ ((unused)) tree e) \
    {}

    // Some of these are not "EXPR" codes, but they are reachable
@@ -346,11 +348,11 @@ protected:
     * These include the pre-order callbacks, walk subtrees,
     * and post-order callbacks.
     */
-  virtual void _walk_pre_tree (__attribute__((unused)) const_tree t)
+  virtual void _walk_pre_tree (__attribute__((unused)) tree t)
    {};
-  void walk_tree2 (const_tree t);
-  void _walk_tree (const_tree t);
-  virtual void _walk_post_tree (__attribute__((unused)) const_tree t)
+  void walk_tree2 (tree t);
+  void _walk_tree (tree t);
+  virtual void _walk_post_tree (__attribute__((unused)) tree t)
    {};

    virtual void _walk_pre_gimple (__attribute__((unused)) gimple* g)
@@ -445,16 +447,16 @@ struct type_partitions_s
    tset_t records;

    /* Determine if we have seen this type before.  */
-  bool in_universe (const_tree) const;
+  bool in_universe (tree) const;

    /* Determine if tree points to a record.  */
-  bool in_points_to_record (const_tree) const;
+  bool in_points_to_record (tree) const;

    /* Determine if tree does not point to a record.  */
-  bool in_complement (const_tree) const;
+  bool in_complement (tree) const;

    /* Insert either in points to record or complement.  */
-  void insert (const_tree, bool);
+  void insert (tree, bool);
  };

  typedef struct type_partitions_s tpartitions_t;
@@ -470,7 +472,7 @@ public:
    {};

    /* Main interface.  */
-  void collect (const_tree t);
+  void collect (tree t);

    /* Collect the result after walking all trees.  */
    tpartitions_t get_record_reaching_trees ()
@@ -491,7 +493,7 @@ private:
     * In other words, the contents are reset after every
     * call to collect.
     */
-  std::map<const_tree, bool> ptr;
+  std::map<tree, bool> ptr;

    /* The type partition set that will hold partitions for
     * points to record or does not point to record.
@@ -510,10 +512,10 @@ private:
    void _sanity_check ();

    /* Store T into partition depending on PTR.  */
-  void _collect_simple (const_tree t);
+  void _collect_simple (tree t);

    /* If the value is in PTRSET, no need to visit the lower nodes.  */
-  virtual bool is_memoized (const_tree t);
+  virtual bool is_memoized (tree t);

    /* These functions insert and erase elements in PTR.

@@ -523,36 +525,36 @@ private:
     * for all different type T.  However, we want to avoid
     * collecting FIELD_DECL, ARGS, and some other none-types.
     */
-  virtual void _walk_VOID_TYPE_pre (const_tree t);
-  virtual void _walk_VOID_TYPE_post (const_tree t);
-  virtual void _walk_INTEGER_TYPE_pre (const_tree t);
-  virtual void _walk_INTEGER_TYPE_post (const_tree t);
-  virtual void _walk_REAL_TYPE_pre (const_tree t);
-  virtual void _walk_REAL_TYPE_post (const_tree t);
-  virtual void _walk_FIXED_POINT_TYPE_pre (const_tree t);
-  virtual void _walk_FIXED_POINT_TYPE_post (const_tree t);
-  virtual void _walk_COMPLEX_TYPE_pre (const_tree t);
-  virtual void _walk_COMPLEX_TYPE_post (const_tree t);
-  virtual void _walk_ENUMERAL_TYPE_pre (const_tree t);
-  virtual void _walk_ENUMERAL_TYPE_post (const_tree t);
-  virtual void _walk_BOOLEAN_TYPE_pre (const_tree t);
-  virtual void _walk_BOOLEAN_TYPE_post (const_tree t);
-  virtual void _walk_ARRAY_TYPE_pre (const_tree t);
-  virtual void _walk_ARRAY_TYPE_post (const_tree t);
-  virtual void _walk_POINTER_TYPE_pre (const_tree t);
-  virtual void _walk_POINTER_TYPE_post (const_tree t);
-  virtual void _walk_REFERENCE_TYPE_pre (const_tree t);
-  virtual void _walk_REFERENCE_TYPE_post (const_tree t);
-  virtual void _walk_UNION_TYPE_pre (const_tree t);
-  virtual void _walk_UNION_TYPE_post (const_tree t);
-  virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
-  virtual void _walk_FUNCTION_TYPE_post (const_tree t);
-  virtual void _walk_METHOD_TYPE_pre (const_tree t);
-  virtual void _walk_METHOD_TYPE_post (const_tree t);
+  virtual void _walk_VOID_TYPE_pre (tree t);
+  virtual void _walk_VOID_TYPE_post (tree t);
+  virtual void _walk_INTEGER_TYPE_pre (tree t);
+  virtual void _walk_INTEGER_TYPE_post (tree t);
+  virtual void _walk_REAL_TYPE_pre (tree t);
+  virtual void _walk_REAL_TYPE_post (tree t);
+  virtual void _walk_FIXED_POINT_TYPE_pre (tree t);
+  virtual void _walk_FIXED_POINT_TYPE_post (tree t);
+  virtual void _walk_COMPLEX_TYPE_pre (tree t);
+  virtual void _walk_COMPLEX_TYPE_post (tree t);
+  virtual void _walk_ENUMERAL_TYPE_pre (tree t);
+  virtual void _walk_ENUMERAL_TYPE_post (tree t);
+  virtual void _walk_BOOLEAN_TYPE_pre (tree t);
+  virtual void _walk_BOOLEAN_TYPE_post (tree t);
+  virtual void _walk_ARRAY_TYPE_pre (tree t);
+  virtual void _walk_ARRAY_TYPE_post (tree t);
+  virtual void _walk_POINTER_TYPE_pre (tree t);
+  virtual void _walk_POINTER_TYPE_post (tree t);
+  virtual void _walk_REFERENCE_TYPE_pre (tree t);
+  virtual void _walk_REFERENCE_TYPE_post (tree t);
+  virtual void _walk_UNION_TYPE_pre (tree t);
+  virtual void _walk_UNION_TYPE_post (tree t);
+  virtual void _walk_FUNCTION_TYPE_pre (tree t);
+  virtual void _walk_FUNCTION_TYPE_post (tree t);
+  virtual void _walk_METHOD_TYPE_pre (tree t);
+  virtual void _walk_METHOD_TYPE_post (tree t);

    /* When a RECORD_TYPE is found, update all values in PTR to true.  */
-  virtual void _walk_RECORD_TYPE_pre (const_tree t);
-  virtual void _walk_RECORD_TYPE_post (const_tree t);
+  virtual void _walk_RECORD_TYPE_pre (tree t);
+  virtual void _walk_RECORD_TYPE_post (tree t);
  };

  /* Derived class from TypeWalker.  This class
@@ -568,76 +570,76 @@ public:
    {};

    /* Main method, returns a stringified version of T.  */
-  std::string stringify (const_tree t);
+  std::string stringify (tree t);

    /* Only get type identifier.  */
-  static std::string get_type_identifier (const_tree t);
+  static std::string get_type_identifier (tree t);

    /* If field is not anonymous, return field identifier.  */
-  static std::string get_field_identifier (const_tree t);
+  static std::string get_field_identifier (tree t);

  private:
    /* Working string... will hold result for stringify.  */
    std::string _stringification;

    /* Append get_tree_code_name.  */
-  void _stringify_simple (const_tree t);
+  void _stringify_simple (tree t);

    /* Append identifier and "{".  */
-  void _stringify_aggregate_pre (const_tree t);
+  void _stringify_aggregate_pre (tree t);

    /* Append "}".  */
-  void _stringify_aggregate_post (const_tree t);
+  void _stringify_aggregate_post (tree t);

    /* Append "function {".  */
    // TODO: For C++ we will need to change this for methods.
-  void _stringify_fm_pre (const_tree t);
-  virtual void _walk_METHOD_TYPE_pre (const_tree t);
-  virtual void _walk_METHOD_TYPE_post (const_tree t);
-  virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
-  virtual void _walk_FUNCTION_TYPE_post (const_tree t);
+  void _stringify_fm_pre (tree t);
+  virtual void _walk_METHOD_TYPE_pre (tree t);
+  virtual void _walk_METHOD_TYPE_post (tree t);
+  virtual void _walk_FUNCTION_TYPE_pre (tree t);
+  virtual void _walk_FUNCTION_TYPE_post (tree t);

    /* Append "}".  */
-  void _stringify_fm_post (const_tree t);
+  void _stringify_fm_post (tree t);

    /* Most of the pre-order walk can probably be replaced by
     * a catch all pre-order call back.
     * TODO: implement that...
     */
-  virtual void _walk_VOID_TYPE_pre (const_tree t);
-  virtual void _walk_INTEGER_TYPE_pre (const_tree t);
-  virtual void _walk_REAL_TYPE_pre (const_tree t);
-  virtual void _walk_FIXED_POINT_TYPE_pre (const_tree t);
-  virtual void _walk_COMPLEX_TYPE_pre (const_tree t);
-  virtual void _walk_BOOLEAN_TYPE_pre (const_tree t);
-  virtual void _walk_OFFSET_TYPE_pre (const_tree t);
-  virtual void _walk_return_pre (const_tree t);
-  virtual void _walk_args_pre (const_tree t);
+  virtual void _walk_VOID_TYPE_pre (tree t);
+  virtual void _walk_INTEGER_TYPE_pre (tree t);
+  virtual void _walk_REAL_TYPE_pre (tree t);
+  virtual void _walk_FIXED_POINT_TYPE_pre (tree t);
+  virtual void _walk_COMPLEX_TYPE_pre (tree t);
+  virtual void _walk_BOOLEAN_TYPE_pre (tree t);
+  virtual void _walk_OFFSET_TYPE_pre (tree t);
+  virtual void _walk_return_pre (tree t);
+  virtual void _walk_args_pre (tree t);

    /* Append "*".  */
-  virtual void _walk_POINTER_TYPE_post (const_tree t);
+  virtual void _walk_POINTER_TYPE_post (tree t);

    /* Append "&".  */
-  virtual void _walk_REFERENCE_TYPE_post (const_tree t);
+  virtual void _walk_REFERENCE_TYPE_post (tree t);

    /* Append "[]".  */
-  virtual void _walk_ARRAY_TYPE_post (const_tree t);
+  virtual void _walk_ARRAY_TYPE_post (tree t);

    /* Append "record" */
-  virtual void _walk_RECORD_TYPE_pre (const_tree t);
-  virtual void _walk_RECORD_TYPE_post (const_tree t);
+  virtual void _walk_RECORD_TYPE_pre (tree t);
+  virtual void _walk_RECORD_TYPE_post (tree t);

    /* Append "union" */
-  virtual void _walk_UNION_TYPE_pre (const_tree t);
-  virtual void _walk_UNION_TYPE_post (const_tree t);
+  virtual void _walk_UNION_TYPE_pre (tree t);
+  virtual void _walk_UNION_TYPE_post (tree t);

    /* Append "," */
-  virtual void _walk_field_post (const_tree t);
-  virtual void _walk_return_post (const_tree t);
+  virtual void _walk_field_post (tree t);
+  virtual void _walk_return_post (tree t);

    /* Append "," */
-  virtual void _walk_args_post (const_tree t);
-  virtual void _walk_arg_post (const_tree t);
+  virtual void _walk_args_post (tree t);
+  virtual void _walk_arg_post (tree t);
  };

  /* ExprCollector is an implementation of ExprWalker.  It walks
@@ -660,7 +662,7 @@ public:

  private:
    /* Catch all callback for all nested expressions E.  */
-  virtual void _walk_pre (const_tree e);
+  virtual void _walk_pre (tree e);
  };

  /* Derived from GimpleWalker.  Its purpose is to walk all gimple
@@ -689,7 +691,7 @@ public:
  private:

    /* Call back for global variables.  */
-  virtual void _walk_pre_tree (const_tree);
+  virtual void _walk_pre_tree (tree);

    /* Call back for gassign.  */
    virtual void _walk_pre_gassign (gassign *s);
@@ -747,7 +749,7 @@ public:
    }

  private:
-  virtual void _walk_pre_gcall (gcall *s)
+  virtual void _walk_pre_gcall (__attribute__((unused)) gcall *s)
    {
      this->_no_external = false;
    }
@@ -807,7 +809,7 @@ struct Reason
  {};
  };

-typedef std::map<const_tree, Reason> typemap;
+typedef std::map<tree, Reason> typemap;

  /* Type Escaper propagates information on whether a type escapes
   * to all types reachable by a root type.  It also propagates
@@ -838,29 +840,29 @@ public:
    void print_reasons ();

    // Update type T with escaping reason R.
-  void update (const_tree t, Reason r);
+  void update (tree t, Reason r);

  private:
    // TODO: we can probably reduce the amount of functions
    // by adding a catch all pre-order callback...
-  virtual void _walk_POINTER_TYPE_pre (const_tree t);
-  virtual void _walk_POINTER_TYPE_post (const_tree t);
-  virtual void _walk_REFERENCE_TYPE_pre (const_tree t);
-  virtual void _walk_ARRAY_TYPE_pre (const_tree t);
-  virtual void _walk_ARRAY_TYPE_post (const_tree t);
-  virtual void _walk_RECORD_TYPE_pre (const_tree t);
-  virtual void _walk_RECORD_TYPE_post (const_tree t);
-  virtual void _walk_field_pre (const_tree t);
-  virtual bool is_memoized (const_tree t);
+  virtual void _walk_POINTER_TYPE_pre (tree t);
+  virtual void _walk_POINTER_TYPE_post (tree t);
+  virtual void _walk_REFERENCE_TYPE_pre (tree t);
+  virtual void _walk_ARRAY_TYPE_pre (tree t);
+  virtual void _walk_ARRAY_TYPE_post (tree t);
+  virtual void _walk_RECORD_TYPE_pre (tree t);
+  virtual void _walk_RECORD_TYPE_post (tree t);
+  virtual void _walk_field_pre (tree t);
+  virtual bool is_memoized (tree t);

    /* Mark escaping reason as having a function pointer in a structure,
     * propagate up and down.  */
-  virtual void _walk_METHOD_TYPE_pre (const_tree t);
-  virtual void _walk_FUNCTION_TYPE_pre (const_tree t);
+  virtual void _walk_METHOD_TYPE_pre (tree t);
+  virtual void _walk_FUNCTION_TYPE_pre (tree t);

    /* Mark escaping reason as having a union and propagate up and down.  */
-  virtual void _walk_UNION_TYPE_pre (const_tree t);
-  virtual void _walk_UNION_TYPE_post (const_tree t);
+  virtual void _walk_UNION_TYPE_pre (tree t);
+  virtual void _walk_UNION_TYPE_post (tree t);

    // Record how many nested unions the current context is in.
    unsigned _inside_union;
@@ -873,7 +875,7 @@ private:
    Reason _reason;

    // Recursive inner function.
-  void _update (const_tree t);
+  void _update (tree t);

    // Final method that places types from calc to partitions.
    void place_escaping_types_in_set ();
@@ -887,7 +889,7 @@ public:
    {};

    /* Main interface: T escapes because R.  */
-  void update (const_tree t, Reason r);
+  void update (tree t, Reason r);

    /* Will be used to propagate escaping reasons to Types.  */
    TypeEscaper typeEscaper;
@@ -903,26 +905,26 @@ private:
    // is the subexpression being examined.
    // The bottom of the stack is the expression called on the update
    // function.
-  std::stack<const_tree> _stack;
+  std::stack<tree> _stack;

    // Reason to propagate across all subexpressions.
    Reason _r;

    // push to stack.
-  virtual void _walk_pre (const_tree e);
+  virtual void _walk_pre (tree e);

    // pop to stack.
-  virtual void _walk_post (const_tree e);
+  virtual void _walk_post (tree e);

    // Check if there is a cast between the
    // expression (MEM_REF (SSA_NAME))
    // SSA_NAME is the subexpression of MEM_REF.
-  virtual void _walk_SSA_NAME_pre (const_tree e);
+  virtual void _walk_SSA_NAME_pre (tree e);

    // If the expression E is a constructor then we need
    // to mark these types as escaping because we cannot
    // deal with constructors at the moment.
-  virtual void _walk_CONSTRUCTOR_pre (const_tree e);
+  virtual void _walk_CONSTRUCTOR_pre (tree e);
  };

  // Do a type structural equality for two types.
@@ -933,15 +935,15 @@ public:
    {};

    // Return TRUE if A and B have equal structures
-  bool equal (const_tree a, const_tree b);
+  bool equal (tree a, tree b);

  protected:
    // Recursive _equal
-  virtual bool _equal (const_tree a, const_tree b);
+  virtual bool _equal (tree a, tree b);

  private:
    // Use to limit recursion if we are revisiting a node
-  typedef std::set<const_tree> tset_t;
+  typedef std::set<tree> tset_t;

    // Limit recursion for LHS
    tset_t set_l;
@@ -950,14 +952,14 @@ private:
    tset_t set_r;

    // Determine if the code is equal
-  bool _equal_code (const_tree a, const_tree b);
+  bool _equal_code (tree a, tree b);

    // Wrapper around POINTER_TYPE, ARRAY_TYPE and REFERENCE_TYPE
-  bool _equal_wrapper (const_tree a, const_tree b);
+  bool _equal_wrapper (tree a, tree b);

    // Different types we are comparing
  #define TSE_FUNC_DECL(code)					\
-  virtual bool _walk_##code (const_tree l, const_tree r)
+  virtual bool _walk_##code (tree l, tree r)

    // Current types that can be compared.
    TSE_FUNC_DECL (VOID_TYPE);
@@ -988,7 +990,7 @@ public:
    {};

  protected:
-  virtual bool _equal (const_tree l, const_tree r);
+  virtual bool _equal (tree l, tree r);
  };

  /* Inspect gimple code and find reasons why types might escape given a 
gimple
@@ -1013,7 +1015,7 @@ public:
  protected:
    /* Set of undefined functions, this set is filled with
     * functions obtained via FOR_EACH_FUNCTION_WITH_GIMPLE_BODY.  */
-  typedef std::set<const_tree> undefset;
+  typedef std::set<tree> undefset;
    undefset undefined;

    /* Initializes undefined.  */
@@ -1021,11 +1023,11 @@ protected:

    /* Return true if it is a known builtin function.  */
    static bool filter_known_function (cgraph_node *);
-  static bool filter_known_function (const_tree);
+  static bool filter_known_function (tree);

    /* Return true if function is externally visible.  */
    static bool is_function_escaping (cgraph_node *);
-  static bool is_function_escaping (const_tree);
+  static bool is_function_escaping (tree);

    /* Return true if variable is externally visible.  */
    static bool is_variable_escaping (varpool_node *);
@@ -1051,7 +1053,7 @@ protected:
     * types introduced by profiling and mark them as escaping.
     * TODO: Improve this.
     */
-  virtual void _walk_pre_tree (const_tree t);
+  virtual void _walk_pre_tree (tree t);
  };

  /*
@@ -1070,7 +1072,7 @@ private:
    std::map<tree, bool> &_whitelisted;

    /* Determine if cast comes from a known function.  */
-  static bool follow_def_to_find_if_really_cast (const_tree);
+  static bool follow_def_to_find_if_really_cast (tree);

    /* If arguments are casted, mark them as escaping.
     * Assignments from malloc and other known functions
@@ -1093,10 +1095,10 @@ const unsigned Read = 0x01u;
  const unsigned Write = 0x02u;

  // maps FIELD_DECL -> bitflag.
-typedef std::map<const_tree, unsigned> field_access_map_t;
+typedef std::map<tree, unsigned> field_access_map_t;

  // maps RECORD_TYPE -> (FIELD_DECL -> bitflag).
-typedef std::map<const_tree, field_access_map_t> record_field_map_t;
+typedef std::map<tree, field_access_map_t> record_field_map_t;

  // Class used to determine if a FIELD is read, written or never accessed.
  class TypeAccessor : public TypeWalker
@@ -1110,14 +1112,14 @@ private:
    record_field_map_t &_map;

    // set of trees which are memoized and we don't need to look into them.
-  std::set<const_tree> memoized_map;
+  std::set<tree> memoized_map;

    // If a RECORD_TYPE is walked into, add all fields in struct to
    // record_field_map.
-  virtual void _walk_RECORD_TYPE_pre (const_tree t);
-  void add_all_fields_in_struct (const_tree t);
+  virtual void _walk_RECORD_TYPE_pre (tree t);
+  void add_all_fields_in_struct (tree t);

-  bool is_memoized (const_tree t);
+  bool is_memoized (tree t);
  };

  // Determine if a FIELD is read, written or never accessed from
@@ -1129,13 +1131,13 @@ public:
    {};

    // Expr E is accessed in A manner.
-  void update (const_tree e, unsigned a);
+  void update (tree e, unsigned a);

    // Print results.
    void print_accesses ();

    // Add all fields to map.  Initialize with empty.
-  void add_all_fields_in_struct (const_tree t);
+  void add_all_fields_in_struct (tree t);

    // Get final results.
    record_field_map_t get_map ();
@@ -1145,7 +1147,7 @@ private:
    unsigned _access;

    // Stack to keep track of how current subexpression was reached.
-  std::stack<const_tree> _stack;
+  std::stack<tree> _stack;

    // Holds main results.
    record_field_map_t record_field_map;
@@ -1157,7 +1159,7 @@ private:
    // If ADDR_EXPR is parent expression that means
    // The address of a field is taken.  Mark
    // all fields as possibly read.
-  virtual void _walk_COMPONENT_REF_pre (const_tree e);
+  virtual void _walk_COMPONENT_REF_pre (tree e);

    // Check if parent expression is MEM_REF.
    // This means that an optimization was made
@@ -1167,13 +1169,13 @@ private:
    // TODO: We don't necessarily need to mark them as
    // possibly read if we update these expressions to
    // point to the correct address in the future.
-  virtual void _walk_ADDR_EXPR_pre (const_tree e);
+  virtual void _walk_ADDR_EXPR_pre (tree e);

    // Push to stack.
-  virtual void _walk_pre (const_tree t);
+  virtual void _walk_pre (tree t);

    // Pop from stack.
-  virtual void _walk_post (const_tree t);
+  virtual void _walk_post (tree t);
  };

  /* Walk all gimple and determine if fields were accessed.  */
@@ -1214,7 +1216,7 @@ private:

  typedef std::set<unsigned> field_offsets_t;

-typedef std::map<const_tree, field_offsets_t> record_field_offset_map_t;
+typedef std::map<tree, field_offsets_t> record_field_offset_map_t;

  // Partition types into escaping or non escaping sets.
  tpartitions_t
-- 
2.18.1



More information about the Gcc-patches mailing list