diff options
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r-- | gcc/tree-nested.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 45c5cf7..7d5c039 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -93,8 +93,8 @@ struct nesting_info struct nesting_info *inner; struct nesting_info *next; - struct pointer_map_t *field_map; - struct pointer_map_t *var_map; + hash_map<tree, tree> *field_map; + hash_map<tree, tree> *var_map; hash_set<tree *> *mem_refs; bitmap suppress_expansion; @@ -286,15 +286,13 @@ static tree lookup_field_for_decl (struct nesting_info *info, tree decl, enum insert_option insert) { - void **slot; - if (insert == NO_INSERT) { - slot = pointer_map_contains (info->field_map, decl); - return slot ? (tree) *slot : NULL_TREE; + tree *slot = info->field_map->get (decl); + return slot ? *slot : NULL_TREE; } - slot = pointer_map_insert (info->field_map, decl); + tree *slot = &info->field_map->get_or_insert (decl); if (!*slot) { tree field = make_node (FIELD_DECL); @@ -324,7 +322,7 @@ lookup_field_for_decl (struct nesting_info *info, tree decl, info->any_parm_remapped = true; } - return (tree) *slot; + return *slot; } /* Build or return the variable that holds the static chain within @@ -521,15 +519,13 @@ static tree lookup_tramp_for_decl (struct nesting_info *info, tree decl, enum insert_option insert) { - void **slot; - if (insert == NO_INSERT) { - slot = pointer_map_contains (info->var_map, decl); - return slot ? (tree) *slot : NULL_TREE; + tree *slot = info->var_map->get (decl); + return slot ? *slot : NULL_TREE; } - slot = pointer_map_insert (info->var_map, decl); + tree *slot = &info->var_map->get_or_insert (decl); if (!*slot) { tree field = make_node (FIELD_DECL); @@ -543,7 +539,7 @@ lookup_tramp_for_decl (struct nesting_info *info, tree decl, info->any_tramp_created = true; } - return (tree) *slot; + return *slot; } /* Build or return the field within the non-local frame state that holds @@ -730,8 +726,8 @@ static struct nesting_info * create_nesting_tree (struct cgraph_node *cgn) { struct nesting_info *info = XCNEW (struct nesting_info); - info->field_map = pointer_map_create (); - info->var_map = pointer_map_create (); + info->field_map = new hash_map<tree, tree>; + info->var_map = new hash_map<tree, tree>; info->mem_refs = new hash_set<tree *>; info->suppress_expansion = BITMAP_ALLOC (&nesting_info_bitmap_obstack); info->context = cgn->decl; @@ -834,12 +830,11 @@ get_nonlocal_debug_decl (struct nesting_info *info, tree decl) tree target_context; struct nesting_info *i; tree x, field, new_decl; - void **slot; - slot = pointer_map_insert (info->var_map, decl); + tree *slot = &info->var_map->get_or_insert (decl); if (*slot) - return (tree) *slot; + return *slot; target_context = decl_function_context (decl); @@ -1483,11 +1478,10 @@ static tree get_local_debug_decl (struct nesting_info *info, tree decl, tree field) { tree x, new_decl; - void **slot; - slot = pointer_map_insert (info->var_map, decl); + tree *slot = &info->var_map->get_or_insert (decl); if (*slot) - return (tree) *slot; + return *slot; /* Make sure frame_decl gets created. */ (void) get_frame_type (info); @@ -2064,7 +2058,6 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p, { struct nesting_info *const info = (struct nesting_info *) wi->info, *i; tree label, new_label, target_context, x, field; - void **slot; gimple call; gimple stmt = gsi_stmt (*gsi); @@ -2098,7 +2091,7 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p, (hairy target-specific) non-local goto receiver code to be generated when we expand rtl. Enter this association into var_map so that we can insert the new label into the IL during a second pass. */ - slot = pointer_map_insert (i->var_map, label); + tree *slot = &i->var_map->get_or_insert (label); if (*slot == NULL) { new_label = create_artificial_label (UNKNOWN_LOCATION); @@ -2106,7 +2099,7 @@ convert_nl_goto_reference (gimple_stmt_iterator *gsi, bool *handled_ops_p, *slot = new_label; } else - new_label = (tree) *slot; + new_label = *slot; /* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */ field = get_nl_goto_field (i); @@ -2136,7 +2129,6 @@ convert_nl_goto_receiver (gimple_stmt_iterator *gsi, bool *handled_ops_p, struct nesting_info *const info = (struct nesting_info *) wi->info; tree label, new_label; gimple_stmt_iterator tmp_gsi; - void **slot; gimple stmt = gsi_stmt (*gsi); if (gimple_code (stmt) != GIMPLE_LABEL) @@ -2147,7 +2139,7 @@ convert_nl_goto_receiver (gimple_stmt_iterator *gsi, bool *handled_ops_p, label = gimple_label_label (stmt); - slot = pointer_map_contains (info->var_map, label); + tree *slot = info->var_map->get (label); if (!slot) { *handled_ops_p = false; @@ -2513,7 +2505,7 @@ static tree nesting_copy_decl (tree decl, copy_body_data *id) { struct nesting_copy_body_data *nid = (struct nesting_copy_body_data *) id; - void **slot = pointer_map_contains (nid->root->var_map, decl); + tree *slot = nid->root->var_map->get (decl); if (slot) return (tree) *slot; @@ -2542,15 +2534,14 @@ contains_remapped_vars (tree *tp, int *walk_subtrees, void *data) { struct nesting_info *root = (struct nesting_info *) data; tree t = *tp; - void **slot; if (DECL_P (t)) { *walk_subtrees = 0; - slot = pointer_map_contains (root->var_map, t); + tree *slot = root->var_map->get (t); if (slot) - return (tree) *slot; + return *slot; } return NULL; } @@ -2580,7 +2571,7 @@ remap_vla_decls (tree block, struct nesting_info *root) && variably_modified_type_p (type, NULL))) continue; - if (pointer_map_contains (root->var_map, TREE_OPERAND (val, 0)) + if (root->var_map->get (TREE_OPERAND (val, 0)) || walk_tree (&type, contains_remapped_vars, root, NULL)) break; } @@ -2590,7 +2581,7 @@ remap_vla_decls (tree block, struct nesting_info *root) memset (&id, 0, sizeof (id)); id.cb.copy_decl = nesting_copy_decl; - id.cb.decl_map = pointer_map_create (); + id.cb.decl_map = new hash_map<tree, tree>; id.root = root; for (; var; var = DECL_CHAIN (var)) @@ -2598,7 +2589,6 @@ remap_vla_decls (tree block, struct nesting_info *root) { struct nesting_info *i; tree newt, context; - void **slot; val = DECL_VALUE_EXPR (var); type = TREE_TYPE (var); @@ -2608,7 +2598,7 @@ remap_vla_decls (tree block, struct nesting_info *root) && variably_modified_type_p (type, NULL))) continue; - slot = pointer_map_contains (root->var_map, TREE_OPERAND (val, 0)); + tree *slot = root->var_map->get (TREE_OPERAND (val, 0)); if (!slot && !walk_tree (&type, contains_remapped_vars, root, NULL)) continue; @@ -2651,7 +2641,7 @@ remap_vla_decls (tree block, struct nesting_info *root) SET_DECL_VALUE_EXPR (var, val); } - pointer_map_destroy (id.cb.decl_map); + delete id.cb.decl_map; } /* Fold the MEM_REF *E. */ @@ -2830,7 +2820,7 @@ finalize_nesting_tree_1 (struct nesting_info *root) memset (&id, 0, sizeof (id)); id.cb.copy_decl = nesting_copy_decl; - id.cb.decl_map = pointer_map_create (); + id.cb.decl_map = new hash_map<tree, tree>; id.root = root; for (; debug_var; debug_var = DECL_CHAIN (debug_var)) @@ -2865,7 +2855,7 @@ finalize_nesting_tree_1 (struct nesting_info *root) TYPE_NAME (newt) = remap_decl (TYPE_NAME (newt), &id.cb); } - pointer_map_destroy (id.cb.decl_map); + delete id.cb.decl_map; } scope = gimple_seq_first_stmt (gimple_body (root->context)); @@ -2931,8 +2921,8 @@ free_nesting_tree (struct nesting_info *root) do { next = iter_nestinfo_next (node); - pointer_map_destroy (node->var_map); - pointer_map_destroy (node->field_map); + delete node->var_map; + delete node->field_map; delete node->mem_refs; free (node); node = next; |