This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v2] PR bootstrap/61598


From: tbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>

Hi,

Actually we can just store const tre_node * in the hash table, and actually
remove a const cast.

bootstrapped with --enable-checking=fold on top of my original series on
x86_64-unknown-linux-gnu, and aprovied by richi on IRC, commited.

Trev

gcc/

        PR bootstrap/61598
        * fold-const.c (fold_checksum_tree): Use a hash_table of const
        tree_node * instead of tree_node *.
        (fold): Adjust.
        (print_fold_checksum): Likewise.
        (fold_check_failed): Likewise.
        (debug_fold_checksum): Likewise.
        (fold_build1_stat_loc): Likewise.
        (fold_build2_stat_loc): Likewise.
        (fold_build3_stat_loc): Likewise.
        (fold_build_call_array_loc): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211985 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog    | 14 ++++++++++++++
 gcc/fold-const.c | 22 +++++++++++-----------
 2 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c518c0e..9eb0524 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2014-06-25  Trevor Saunders  <tsaunders@mozilla.com>
+
+	PR bootstrap/61598
+	* fold-const.c (fold_checksum_tree): Use a hash_table of const
+	tree_node * instead of tree_node *.
+	(fold): Adjust.
+	(print_fold_checksum): Likewise.
+	(fold_check_failed): Likewise.
+	(debug_fold_checksum): Likewise.
+	(fold_build1_stat_loc): Likewise.
+	(fold_build2_stat_loc): Likewise.
+	(fold_build3_stat_loc): Likewise.
+	(fold_build_call_array_loc): Likewise.
+
 2014-06-25  David Edelsohn  <dje.gcc@gmail.com>
 
 	* config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Replace
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f6b72b7..d22eac1 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -14686,7 +14686,7 @@ fold (tree expr)
 #undef fold
 
 static void fold_checksum_tree (const_tree, struct md5_ctx *,
-				hash_table<pointer_hash<tree_node> > *);
+				hash_table<pointer_hash<const tree_node> > *);
 static void fold_check_failed (const_tree, const_tree);
 void print_fold_checksum (const_tree);
 
@@ -14700,7 +14700,7 @@ fold (tree expr)
   tree ret;
   struct md5_ctx ctx;
   unsigned char checksum_before[16], checksum_after[16];
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (expr, &ctx, &ht);
@@ -14724,7 +14724,7 @@ print_fold_checksum (const_tree expr)
 {
   struct md5_ctx ctx;
   unsigned char checksum[16], cnt;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (expr, &ctx, &ht);
@@ -14742,9 +14742,9 @@ fold_check_failed (const_tree expr ATTRIBUTE_UNUSED, const_tree ret ATTRIBUTE_UN
 
 static void
 fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
-		    hash_table<pointer_hash <tree_node> > *ht)
+		    hash_table<pointer_hash <const tree_node> > *ht)
 {
-  tree_node **slot;
+  const tree_node **slot;
   enum tree_code code;
   union tree_node buf;
   int i, len;
@@ -14755,7 +14755,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
   slot = ht->find_slot (expr, INSERT);
   if (*slot != NULL)
     return;
-  *slot = CONST_CAST_TREE (expr);
+  *slot = expr;
   code = TREE_CODE (expr);
   if (TREE_CODE_CLASS (code) == tcc_declaration
       && DECL_ASSEMBLER_NAME_SET_P (expr))
@@ -14899,7 +14899,7 @@ debug_fold_checksum (const_tree t)
   int i;
   unsigned char checksum[16];
   struct md5_ctx ctx;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (t, &ctx, &ht);
@@ -14927,7 +14927,7 @@ fold_build1_stat_loc (location_t loc,
 #ifdef ENABLE_FOLD_CHECKING
   unsigned char checksum_before[16], checksum_after[16];
   struct md5_ctx ctx;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (op0, &ctx, &ht);
@@ -14968,7 +14968,7 @@ fold_build2_stat_loc (location_t loc,
 		checksum_after_op0[16],
 		checksum_after_op1[16];
   struct md5_ctx ctx;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (op0, &ctx, &ht);
@@ -15022,7 +15022,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
 		checksum_after_op1[16],
 		checksum_after_op2[16];
   struct md5_ctx ctx;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
 
   md5_init_ctx (&ctx);
   fold_checksum_tree (op0, &ctx, &ht);
@@ -15088,7 +15088,7 @@ fold_build_call_array_loc (location_t loc, tree type, tree fn,
 		checksum_after_fn[16],
 		checksum_after_arglist[16];
   struct md5_ctx ctx;
-  hash_table<pointer_hash<tree_node> > ht (32);
+  hash_table<pointer_hash<const tree_node> > ht (32);
   int i;
 
   md5_init_ctx (&ctx);
-- 
2.0.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]