summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c79
1 files changed, 41 insertions, 38 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9dabfabcec8..99655a1df9c 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -56,7 +56,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "intl.h"
#include "ggc.h"
-#include "hashtab.h"
+#include "hash-table.h"
#include "langhooks.h"
#include "md5.h"
#include "gimple.h"
@@ -14320,7 +14320,8 @@ fold (tree expr)
#ifdef ENABLE_FOLD_CHECKING
#undef fold
-static void fold_checksum_tree (const_tree, struct md5_ctx *, htab_t);
+static void fold_checksum_tree (const_tree, struct md5_ctx *,
+ hash_table <pointer_hash <tree_node> >);
static void fold_check_failed (const_tree, const_tree);
void print_fold_checksum (const_tree);
@@ -14334,20 +14335,20 @@ fold (tree expr)
tree ret;
struct md5_ctx ctx;
unsigned char checksum_before[16], checksum_after[16];
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (expr, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before);
- htab_empty (ht);
+ ht.empty ();
ret = fold_1 (expr);
md5_init_ctx (&ctx);
fold_checksum_tree (expr, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after);
- htab_delete (ht);
+ ht.dispose ();
if (memcmp (checksum_before, checksum_after, 16))
fold_check_failed (expr, ret);
@@ -14360,13 +14361,13 @@ print_fold_checksum (const_tree expr)
{
struct md5_ctx ctx;
unsigned char checksum[16], cnt;
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (expr, &ctx, ht);
md5_finish_ctx (&ctx, checksum);
- htab_delete (ht);
+ ht.dispose ();
for (cnt = 0; cnt < 16; ++cnt)
fprintf (stderr, "%02x", checksum[cnt]);
putc ('\n', stderr);
@@ -14379,9 +14380,10 @@ 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, htab_t ht)
+fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
+ hash_table <pointer_hash <tree_node> > ht)
{
- void **slot;
+ tree_node **slot;
enum tree_code code;
union tree_node buf;
int i, len;
@@ -14389,7 +14391,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, htab_t ht)
recursive_label:
if (expr == NULL)
return;
- slot = (void **) htab_find_slot (ht, expr, INSERT);
+ slot = ht.find_slot (expr, INSERT);
if (*slot != NULL)
return;
*slot = CONST_CAST_TREE (expr);
@@ -14538,12 +14540,13 @@ debug_fold_checksum (const_tree t)
int i;
unsigned char checksum[16];
struct md5_ctx ctx;
- htab_t ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ hash_table <pointer_hash <tree_node> > ht;
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (t, &ctx, ht);
md5_finish_ctx (&ctx, checksum);
- htab_empty (ht);
+ ht.empty ();
for (i = 0; i < 16; i++)
fprintf (stderr, "%d ", checksum[i]);
@@ -14566,13 +14569,13 @@ fold_build1_stat_loc (location_t loc,
#ifdef ENABLE_FOLD_CHECKING
unsigned char checksum_before[16], checksum_after[16];
struct md5_ctx ctx;
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before);
- htab_empty (ht);
+ ht.empty ();
#endif
tem = fold_unary_loc (loc, code, type, op0);
@@ -14583,7 +14586,7 @@ fold_build1_stat_loc (location_t loc,
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after);
- htab_delete (ht);
+ ht.dispose ();
if (memcmp (checksum_before, checksum_after, 16))
fold_check_failed (op0, tem);
@@ -14609,18 +14612,18 @@ fold_build2_stat_loc (location_t loc,
checksum_after_op0[16],
checksum_after_op1[16];
struct md5_ctx ctx;
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_op0);
- htab_empty (ht);
+ ht.empty ();
md5_init_ctx (&ctx);
fold_checksum_tree (op1, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_op1);
- htab_empty (ht);
+ ht.empty ();
#endif
tem = fold_binary_loc (loc, code, type, op0, op1);
@@ -14631,7 +14634,7 @@ fold_build2_stat_loc (location_t loc,
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_op0);
- htab_empty (ht);
+ ht.empty ();
if (memcmp (checksum_before_op0, checksum_after_op0, 16))
fold_check_failed (op0, tem);
@@ -14639,7 +14642,7 @@ fold_build2_stat_loc (location_t loc,
md5_init_ctx (&ctx);
fold_checksum_tree (op1, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_op1);
- htab_delete (ht);
+ ht.dispose ();
if (memcmp (checksum_before_op1, checksum_after_op1, 16))
fold_check_failed (op1, tem);
@@ -14665,23 +14668,23 @@ 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;
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_op0);
- htab_empty (ht);
+ ht.empty ();
md5_init_ctx (&ctx);
fold_checksum_tree (op1, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_op1);
- htab_empty (ht);
+ ht.empty ();
md5_init_ctx (&ctx);
fold_checksum_tree (op2, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_op2);
- htab_empty (ht);
+ ht.empty ();
#endif
gcc_assert (TREE_CODE_CLASS (code) != tcc_vl_exp);
@@ -14693,7 +14696,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
md5_init_ctx (&ctx);
fold_checksum_tree (op0, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_op0);
- htab_empty (ht);
+ ht.empty ();
if (memcmp (checksum_before_op0, checksum_after_op0, 16))
fold_check_failed (op0, tem);
@@ -14701,7 +14704,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
md5_init_ctx (&ctx);
fold_checksum_tree (op1, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_op1);
- htab_empty (ht);
+ ht.empty ();
if (memcmp (checksum_before_op1, checksum_after_op1, 16))
fold_check_failed (op1, tem);
@@ -14709,7 +14712,7 @@ fold_build3_stat_loc (location_t loc, enum tree_code code, tree type,
md5_init_ctx (&ctx);
fold_checksum_tree (op2, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_op2);
- htab_delete (ht);
+ ht.dispose ();
if (memcmp (checksum_before_op2, checksum_after_op2, 16))
fold_check_failed (op2, tem);
@@ -14733,20 +14736,20 @@ fold_build_call_array_loc (location_t loc, tree type, tree fn,
checksum_after_fn[16],
checksum_after_arglist[16];
struct md5_ctx ctx;
- htab_t ht;
+ hash_table <pointer_hash <tree_node> > ht;
int i;
- ht = htab_create (32, htab_hash_pointer, htab_eq_pointer, NULL);
+ ht.create (32);
md5_init_ctx (&ctx);
fold_checksum_tree (fn, &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_fn);
- htab_empty (ht);
+ ht.empty ();
md5_init_ctx (&ctx);
for (i = 0; i < nargs; i++)
fold_checksum_tree (argarray[i], &ctx, ht);
md5_finish_ctx (&ctx, checksum_before_arglist);
- htab_empty (ht);
+ ht.empty ();
#endif
tem = fold_builtin_call_array (loc, type, fn, nargs, argarray);
@@ -14755,7 +14758,7 @@ fold_build_call_array_loc (location_t loc, tree type, tree fn,
md5_init_ctx (&ctx);
fold_checksum_tree (fn, &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_fn);
- htab_empty (ht);
+ ht.empty ();
if (memcmp (checksum_before_fn, checksum_after_fn, 16))
fold_check_failed (fn, tem);
@@ -14764,7 +14767,7 @@ fold_build_call_array_loc (location_t loc, tree type, tree fn,
for (i = 0; i < nargs; i++)
fold_checksum_tree (argarray[i], &ctx, ht);
md5_finish_ctx (&ctx, checksum_after_arglist);
- htab_delete (ht);
+ ht.dispose ();
if (memcmp (checksum_before_arglist, checksum_after_arglist, 16))
fold_check_failed (NULL_TREE, tem);