Commit a3648cfc by Daniel Berlin Committed by Daniel Berlin

[multiple changes]

2005-06-29  Daniel Berlin  <dberlin@dberlin.org>

	* tree-complex.c (complex_variable_components): Now a hashtable.
	(cvc_lookup): Ditto.
	(cvc_insert): Ditto.
	(create_components): Use referenced var iterator.
	Initialize hashtable.	Use cvc_insert/lookup.
	(extract_components): Use cvc_insert/lookup.
	(update_complex_components): Ditto.
	(update_complex_components_on_edge): Ditto.
	* tree-dfa.c (referenced_vars): Now a hashtable.
	(dump_referenced_vars): Use iterator.
	(referenced_var_lookup): New function.
	(referenced_var_insert): Ditto.
	(add_referenced_var): Use referenced_var_insert.
	(mark_new_vars_to_rename): Use DECL_UID.
	* tree-flow-inline.h (first_htab_element): New function.
	(end_htab_p): Ditto.
	(next_htab_element): Ditto.
	(first_referenced_var): Ditto.
	(end_referenced_vars_p): Ditto.
	(next_referenced_var): Ditto.
	(is_call_clobbered): Use DECL_UID.
	(mark_call_clobbered): Ditto.
	(clear_call_clobbered): Ditto.
	(mark_non_addressable): Ditto.
	* tree-flow.h (htab_iterator): New struct.
	(FOR_EACH_HTAB_ELEMENT): New macro.
	(struct int_tree_map): New struct.
	(int_tree_map_hash): Prototype.
	(int_tree_map_eq): Ditto.
	(referenced_var_iterator): Ditto.
	(FOR_EACH_REFERENCED_VAR): New macro.
	(referenced_vars): Now a hashtable.
	* tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID.
	(add_new_name_mapping): Ditto.
	(mark_def_sites): Ditto.
	(insert_phi_nodes): Use referenced_var iterator.
	(mark_def_site_blocks): Ditto.
	(mark_sym_for_renaming): Use DECL_UID.
	* tree-sra.c (is_sra_candidate_decl): Use DECL_UID.
	(lookup_element): Ditto.
	(find_candidates_for_sra): Use referenced_vars iterator.
	Use DECL_UID.
	* tree-ssa-alias.c (NUM_REFERENCES): New macro.
	(NUM_REFERENCES_CLEAR): Ditto.
	(NUM_REFERENCES_INC): Ditto.
	(NUM_REFERENCES_SET): Ditto.
	(alias_obstack): New bitmap obstack.
	(struct alias_map_d): Use bitmap, not sbitmap.
	(struct alias_info): Remove num_references.
	(init_alias_info): Use referenced_var iterator.
	Initialize bitmap obstack.
	(delete_alias_info): Use referenced_var iterator.
	Free bitmap obstack.
	(compute_points_to_and_addr_escape): Use DECL_UID.
	Use new NUM_REFERENCES macros.
	(compute_flow_sensitive_aliasing): may_aliases is now a bitmap.
	Use new NUM_REFERENCES macros.
	(group_aliases_into): Update prototype to use bitmap.
	(setup_pointers_and_addressables): Use referenced_vars iterator.
	Use DECL_UID. Use new NUM_REFERENCES macros.
	(add_pointed_to_var): Use DECL_UID.
	(dump_alias_info): Use referenced_var iterator.
	(add_type_alias): Ditto.
	(used_portions): Now a hashtable.
	(used_part_map_eq): New function.
	(used_part_map_hash): Ditto.
	(free_used_part_map): Ditto.
	(up_lookup): Ditto.
	(up_insert): Ditto.
	(get_or_create_used_part_for): Use up_lookup.
	(create_overlap_variables_for): Ditto.
	(find_used_portions): Use up_insert.
	Use DECL_UID.
	(create_structure_vars): Init used_portions hashtable, use
	referenced_vars iterator.
	* tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps.
	Use DECL_UID.
	* tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID.
	* tree-ssa-operands.c (get_asm_expr_operands): Ditto.
	(note_addressable): Ditto.
	* tree-ssa-structalias.c (set_uids_in_ptset): Ditto.
	* tree-ssa.c (verify_flow_insensitive_alias_info): Use
	referenced_var iterator.
	Use DECL_UID.
	(delete_tree_ssa): Ditto.
	(int_tree_map_eq): New function.
	(int_tree_map_hash): Ditto.
	* tree-stdarg.c (find_va_list_reference): Use DECL_UID.
	(va_list_ptr_read): Ditto.
	(va_list_counter_struct_op): Ditto.
	(va_list_ptr_write): Ditto.
	(check_va_list_escapes): Ditto.
	(check_all_va_list_escapes): Ditto.
	(execute_optimize_stdarg): Ditto.
	* tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var
	iterator.
2005-06-30  Daniel Berlin  <dberlin@dberlin.org>

	* hashtab.h (HTAB_DELETED_ENTRY): New macro.
	(HTAB_EMPTY_ENTRY): New macro.

2005-06-30  Daniel Berlin  <dberlin@dberlin.org>

	* hashtab.c (EMPTY_ENTRY): Moved and renamed.
	(DELETED_ENTRY): Ditto.

From-SVN: r101480
parent 114a6b1d
2005-06-29 Daniel Berlin <dberlin@dberlin.org>
* tree-complex.c (complex_variable_components): Now a hashtable.
(cvc_lookup): Ditto.
(cvc_insert): Ditto.
(create_components): Use referenced var iterator.
Initialize hashtable. Use cvc_insert/lookup.
(extract_components): Use cvc_insert/lookup.
(update_complex_components): Ditto.
(update_complex_components_on_edge): Ditto.
* tree-dfa.c (referenced_vars): Now a hashtable.
(dump_referenced_vars): Use iterator.
(referenced_var_lookup): New function.
(referenced_var_insert): Ditto.
(add_referenced_var): Use referenced_var_insert.
(mark_new_vars_to_rename): Use DECL_UID.
* tree-flow-inline.h (first_htab_element): New function.
(end_htab_p): Ditto.
(next_htab_element): Ditto.
(first_referenced_var): Ditto.
(end_referenced_vars_p): Ditto.
(next_referenced_var): Ditto.
(is_call_clobbered): Use DECL_UID.
(mark_call_clobbered): Ditto.
(clear_call_clobbered): Ditto.
(mark_non_addressable): Ditto.
* tree-flow.h (htab_iterator): New struct.
(FOR_EACH_HTAB_ELEMENT): New macro.
(struct int_tree_map): New struct.
(int_tree_map_hash): Prototype.
(int_tree_map_eq): Ditto.
(referenced_var_iterator): Ditto.
(FOR_EACH_REFERENCED_VAR): New macro.
(referenced_vars): Now a hashtable.
* tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID.
(add_new_name_mapping): Ditto.
(mark_def_sites): Ditto.
(insert_phi_nodes): Use referenced_var iterator.
(mark_def_site_blocks): Ditto.
(mark_sym_for_renaming): Use DECL_UID.
* tree-sra.c (is_sra_candidate_decl): Use DECL_UID.
(lookup_element): Ditto.
(find_candidates_for_sra): Use referenced_vars iterator.
Use DECL_UID.
* tree-ssa-alias.c (NUM_REFERENCES): New macro.
(NUM_REFERENCES_CLEAR): Ditto.
(NUM_REFERENCES_INC): Ditto.
(NUM_REFERENCES_SET): Ditto.
(alias_obstack): New bitmap obstack.
(struct alias_map_d): Use bitmap, not sbitmap.
(struct alias_info): Remove num_references.
(init_alias_info): Use referenced_var iterator.
Initialize bitmap obstack.
(delete_alias_info): Use referenced_var iterator.
Free bitmap obstack.
(compute_points_to_and_addr_escape): Use DECL_UID.
Use new NUM_REFERENCES macros.
(compute_flow_sensitive_aliasing): may_aliases is now a bitmap.
Use new NUM_REFERENCES macros.
(group_aliases_into): Update prototype to use bitmap.
(setup_pointers_and_addressables): Use referenced_vars iterator.
Use DECL_UID. Use new NUM_REFERENCES macros.
(add_pointed_to_var): Use DECL_UID.
(dump_alias_info): Use referenced_var iterator.
(add_type_alias): Ditto.
(used_portions): Now a hashtable.
(used_part_map_eq): New function.
(used_part_map_hash): Ditto.
(free_used_part_map): Ditto.
(up_lookup): Ditto.
(up_insert): Ditto.
(get_or_create_used_part_for): Use up_lookup.
(create_overlap_variables_for): Ditto.
(find_used_portions): Use up_insert.
Use DECL_UID.
(create_structure_vars): Init used_portions hashtable, use
referenced_vars iterator.
* tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps.
Use DECL_UID.
* tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID.
* tree-ssa-operands.c (get_asm_expr_operands): Ditto.
(note_addressable): Ditto.
* tree-ssa-structalias.c (set_uids_in_ptset): Ditto.
* tree-ssa.c (verify_flow_insensitive_alias_info): Use
referenced_var iterator.
Use DECL_UID.
(delete_tree_ssa): Ditto.
(int_tree_map_eq): New function.
(int_tree_map_hash): Ditto.
* tree-stdarg.c (find_va_list_reference): Use DECL_UID.
(va_list_ptr_read): Ditto.
(va_list_counter_struct_op): Ditto.
(va_list_ptr_write): Ditto.
(check_va_list_escapes): Ditto.
(check_all_va_list_escapes): Ditto.
(execute_optimize_stdarg): Ditto.
* tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var
iterator.
2005-06-30 Andrew Pinski <pinskia@physics.uc.edu>
* config/rs6000/darwin.h (FRAME_POINTER_REGNUM): Rename to ...
......
......@@ -52,8 +52,37 @@ DEF_VEC_ALLOC_I(complex_lattice_t, heap);
static VEC(complex_lattice_t, heap) *complex_lattice_values;
/* For each complex variable, a pair of variables for the components. */
static VEC(tree, heap) *complex_variable_components;
/* For each complex variable, a pair of variables for the components exists in
the hashtable. */
static htab_t complex_variable_components;
/* Lookup UID in the complex_variable_components hashtable and return the
associated tree. */
static tree
cvc_lookup (unsigned int uid)
{
struct int_tree_map *h, in;
in.uid = uid;
h = htab_find_with_hash (complex_variable_components, &in, uid);
gcc_assert (h);
return h->to;
}
/* Insert the pair UID, TO into the complex_variable_components hashtable. */
static void
cvc_insert (unsigned int uid, tree to)
{
struct int_tree_map *h;
void **loc;
h = xmalloc (sizeof (struct int_tree_map));
h->uid = uid;
h->to = to;
loc = htab_find_slot_with_hash (complex_variable_components, h,
uid, INSERT);
*(struct int_tree_map **) loc = h;
}
/* Return true if T is not a zero constant. In the case of real values,
......@@ -355,18 +384,19 @@ complex_visit_phi (tree phi)
static void
create_components (void)
{
size_t k, n;
size_t n;
tree var;
referenced_var_iterator rvi;
n = num_referenced_vars;
if (n == 0)
return;
complex_variable_components = VEC_alloc (tree, heap, 2*n);
VEC_safe_grow (tree, heap, complex_variable_components, 2*n);
complex_variable_components = htab_create (10, int_tree_map_hash,
int_tree_map_eq, free);
for (k = 0; k < n; ++k)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
tree var = referenced_var (k);
tree r = NULL, i = NULL;
if (var != NULL
......@@ -409,8 +439,8 @@ create_components (void)
}
}
VEC_replace (tree, complex_variable_components, 2*k, r);
VEC_replace (tree, complex_variable_components, 2*k + 1, i);
cvc_insert (2 * DECL_UID (var), r);
cvc_insert (2 * DECL_UID (var) + 1, i);
}
}
......@@ -464,8 +494,7 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
}
}
return VEC_index (tree, complex_variable_components,
var_ann (SSA_NAME_VAR (t))->uid * 2 + imagpart_p);
return cvc_lookup (DECL_UID (SSA_NAME_VAR (t)) * 2 + imagpart_p);
}
default:
......@@ -478,16 +507,16 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p,
static void
update_complex_components (block_stmt_iterator *bsi, tree stmt, tree r, tree i)
{
unsigned int uid = var_ann (SSA_NAME_VAR (TREE_OPERAND (stmt, 0)))->uid;
unsigned int uid = DECL_UID (SSA_NAME_VAR (TREE_OPERAND (stmt, 0)));
tree v, x;
v = VEC_index (tree, complex_variable_components, 2*uid);
v = cvc_lookup (2*uid);
x = build2 (MODIFY_EXPR, TREE_TYPE (v), v, r);
SET_EXPR_LOCUS (x, EXPR_LOCUS (stmt));
TREE_BLOCK (x) = TREE_BLOCK (stmt);
bsi_insert_after (bsi, x, BSI_NEW_STMT);
v = VEC_index (tree, complex_variable_components, 2*uid + 1);
v = cvc_lookup (2*uid + 1);
x = build2 (MODIFY_EXPR, TREE_TYPE (v), v, i);
SET_EXPR_LOCUS (x, EXPR_LOCUS (stmt));
TREE_BLOCK (x) = TREE_BLOCK (stmt);
......@@ -497,10 +526,10 @@ update_complex_components (block_stmt_iterator *bsi, tree stmt, tree r, tree i)
static void
update_complex_components_on_edge (edge e, tree stmt, tree lhs, tree r, tree i)
{
unsigned int uid = var_ann (SSA_NAME_VAR (lhs))->uid;
unsigned int uid = DECL_UID (SSA_NAME_VAR (lhs));
tree v, x;
v = VEC_index (tree, complex_variable_components, 2*uid);
v = cvc_lookup (2*uid);
x = build2 (MODIFY_EXPR, TREE_TYPE (v), v, r);
if (stmt)
{
......@@ -509,7 +538,7 @@ update_complex_components_on_edge (edge e, tree stmt, tree lhs, tree r, tree i)
}
bsi_insert_on_edge (e, x);
v = VEC_index (tree, complex_variable_components, 2*uid + 1);
v = cvc_lookup (2*uid + 1);
x = build2 (MODIFY_EXPR, TREE_TYPE (v), v, i);
if (stmt)
{
......@@ -1406,7 +1435,9 @@ tree_lower_complex (void)
bsi_commit_edge_inserts ();
VEC_free (tree, heap, complex_variable_components);
if (complex_variable_components)
htab_delete (complex_variable_components);
VEC_free (complex_lattice_t, heap, complex_lattice_values);
}
......
......@@ -83,7 +83,7 @@ static void add_referenced_var (tree, struct walk_state *);
/* Global declarations. */
/* Array of all variables referenced in the function. */
VEC(tree,gc) *referenced_vars;
htab_t referenced_vars;
/*---------------------------------------------------------------------------
......@@ -230,14 +230,14 @@ make_rename_temp (tree type, const char *prefix)
void
dump_referenced_vars (FILE *file)
{
size_t i;
tree var;
referenced_var_iterator rvi;
fprintf (file, "\nReferenced variables in %s: %u\n\n",
get_name (current_function_decl), (unsigned) num_referenced_vars);
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
tree var = referenced_var (i);
fprintf (file, "Variable: ");
dump_variable (file, var);
fprintf (file, "\n");
......@@ -278,7 +278,7 @@ dump_variable (FILE *file, tree var)
ann = var_ann (var);
fprintf (file, ", UID %u", (unsigned) ann->uid);
fprintf (file, ", UID %u", (unsigned) DECL_UID (var));
fprintf (file, ", ");
print_generic_expr (file, TREE_TYPE (var), dump_flags);
......@@ -528,6 +528,36 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
}
/* Lookup UID in the referenced_vars hashtable and return the associated
variable. */
tree
referenced_var_lookup (unsigned int uid)
{
struct int_tree_map *h, in;
in.uid = uid;
h = htab_find_with_hash (referenced_vars, &in, uid);
gcc_assert (h || uid == 0);
if (h)
return h->to;
return NULL_TREE;
}
/* Insert the pair UID, TO into the referenced_vars hashtable. */
static void
referenced_var_insert (unsigned int uid, tree to)
{
struct int_tree_map *h;
void **loc;
h = ggc_alloc (sizeof (struct int_tree_map));
h->uid = uid;
h->to = to;
loc = htab_find_slot_with_hash (referenced_vars, h, uid, INSERT);
*(struct int_tree_map **) loc = h;
}
/* Add VAR to the list of dereferenced variables.
WALK_STATE contains a hash table used to avoid adding the same
......@@ -555,8 +585,8 @@ add_referenced_var (tree var, struct walk_state *walk_state)
intrinsic to the variable. */
if (slot)
*slot = (void *) var;
v_ann->uid = num_referenced_vars;
VEC_safe_push (tree, gc, referenced_vars, var);
referenced_var_insert (DECL_UID (var), var);
/* Global variables are always call-clobbered. */
if (is_global_var (var))
......@@ -646,7 +676,7 @@ mark_new_vars_to_rename (tree stmt)
{
if (!DECL_P (val))
val = SSA_NAME_VAR (val);
bitmap_set_bit (vars_in_vops_to_rename, var_ann (val)->uid);
bitmap_set_bit (vars_in_vops_to_rename, DECL_UID (val));
}
/* Now force an operand re-scan on the statement and mark any newly
......
......@@ -25,6 +25,87 @@ Boston, MA 02110-1301, USA. */
/* Inline functions for manipulating various data structures defined in
tree-flow.h. See tree-flow.h for documentation. */
/* Initialize the hashtable iterator HTI to point to hashtable TABLE */
static inline void *
first_htab_element (htab_iterator *hti, htab_t table)
{
hti->htab = table;
hti->slot = table->entries;
hti->limit = hti->slot + htab_size (table);
do
{
PTR x = *(hti->slot);
if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
break;
} while (++(hti->slot) < hti->limit);
if (hti->slot < hti->limit)
return *(hti->slot);
return NULL;
}
/* Return current non-empty/deleted slot of the hashtable pointed to by HTI,
or NULL if we have reached the end. */
static inline bool
end_htab_p (htab_iterator *hti)
{
if (hti->slot >= hti->limit)
return true;
return false;
}
/* Advance the hashtable iterator pointed by HTI to the next element of the
hashtable. */
static inline void *
next_htab_element (htab_iterator *hti)
{
while (++(hti->slot) < hti->limit)
{
PTR x = *(hti->slot);
if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
return x;
};
return NULL;
}
/* Initialize ITER to point to the first referenced variable in the
referenced_vars hashtable, and return that variable. */
static inline tree
first_referenced_var (referenced_var_iterator *iter)
{
struct int_tree_map *itm;
itm = first_htab_element (&iter->hti, referenced_vars);
if (!itm)
return NULL;
return itm->to;
}
/* Return true if we have hit the end of the referenced variables ITER is
iterating through. */
static inline bool
end_referenced_vars_p (referenced_var_iterator *iter)
{
return end_htab_p (&iter->hti);
}
/* Make ITER point to the next referenced_var in the referenced_var hashtable,
and return that variable. */
static inline tree
next_referenced_var (referenced_var_iterator *iter)
{
struct int_tree_map *itm;
itm = next_htab_element (&iter->hti);
if (!itm)
return NULL;
return itm->to;
}
/* Return the variable annotation for T, which must be a _DECL node.
Return NULL if the variable annotation doesn't already exist. */
static inline var_ann_t
......@@ -752,7 +833,7 @@ static inline bool
is_call_clobbered (tree var)
{
return is_global_var (var)
|| bitmap_bit_p (call_clobbered_vars, var_ann (var)->uid);
|| bitmap_bit_p (call_clobbered_vars, DECL_UID (var));
}
/* Mark variable VAR as being clobbered by function calls. */
......@@ -766,7 +847,7 @@ mark_call_clobbered (tree var)
location in global memory. */
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 1;
bitmap_set_bit (call_clobbered_vars, ann->uid);
bitmap_set_bit (call_clobbered_vars, DECL_UID (var));
ssa_call_clobbered_cache_valid = false;
ssa_ro_call_cache_valid = false;
}
......@@ -778,7 +859,7 @@ clear_call_clobbered (tree var)
var_ann_t ann = var_ann (var);
if (ann->mem_tag_kind != NOT_A_TAG && ann->mem_tag_kind != STRUCT_FIELD)
DECL_EXTERNAL (var) = 0;
bitmap_clear_bit (call_clobbered_vars, ann->uid);
bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
ssa_call_clobbered_cache_valid = false;
ssa_ro_call_cache_valid = false;
}
......@@ -787,7 +868,7 @@ clear_call_clobbered (tree var)
static inline void
mark_non_addressable (tree var)
{
bitmap_clear_bit (call_clobbered_vars, var_ann (var)->uid);
bitmap_clear_bit (call_clobbered_vars, DECL_UID (var));
TREE_ADDRESSABLE (var) = 0;
ssa_call_clobbered_cache_valid = false;
ssa_ro_call_cache_valid = false;
......
......@@ -41,6 +41,20 @@ typedef struct basic_block_def *basic_block;
/* True if the code is in ssa form. */
extern bool in_ssa_p;
typedef struct
{
htab_t htab;
PTR *slot;
PTR *limit;
} htab_iterator;
/* Iterate through the elements of hashtable HTAB, using htab_iterator ITER,
storing each element in RESULT, which is of type TYPE. */
#define FOR_EACH_HTAB_ELEMENT(HTAB, RESULT, TYPE, ITER) \
for (RESULT = (TYPE) first_htab_element (&(ITER), (HTAB)); \
!end_htab_p (&(ITER)); \
RESULT = (TYPE) next_htab_element (&(ITER)))
/*---------------------------------------------------------------------------
Attributes for SSA_NAMEs.
......@@ -208,9 +222,6 @@ struct var_ann_d GTY(())
/* Variables that may alias this variable. */
varray_type may_aliases;
/* Unique ID of this variable. */
size_t uid;
/* Used when going out of SSA form to indicate which partition this
variable represents storage for. */
unsigned partition;
......@@ -356,11 +367,33 @@ static inline void set_phi_nodes (basic_block, tree);
/*---------------------------------------------------------------------------
Global declarations
---------------------------------------------------------------------------*/
struct int_tree_map GTY(())
{
unsigned int uid;
tree to;
};
extern unsigned int int_tree_map_hash (const void *);
extern int int_tree_map_eq (const void *, const void *);
typedef struct
{
htab_iterator hti;
} referenced_var_iterator;
#define FOR_EACH_REFERENCED_VAR(VAR, ITER) \
for ((VAR) = first_referenced_var (&(ITER)); \
!end_referenced_vars_p (&(ITER)); \
(VAR) = next_referenced_var (&(ITER)))
/* Array of all variables referenced in the function. */
extern GTY(()) VEC(tree,gc) *referenced_vars;
extern GTY((param_is (struct int_tree_map))) htab_t referenced_vars;
#define num_referenced_vars VEC_length (tree, referenced_vars)
#define referenced_var(i) VEC_index (tree, referenced_vars, i)
extern tree referenced_var_lookup (unsigned int);
#define num_referenced_vars htab_elements (referenced_vars)
#define referenced_var(i) referenced_var_lookup (i)
/* Array of all SSA_NAMEs used in the function. */
extern GTY(()) VEC(tree,gc) *ssa_names;
......
......@@ -454,7 +454,7 @@ static inline bool
symbol_marked_for_renaming (tree sym)
{
gcc_assert (DECL_P (sym));
return bitmap_bit_p (syms_to_rename, var_ann (sym)->uid);
return bitmap_bit_p (syms_to_rename, DECL_UID (sym));
}
......@@ -582,7 +582,7 @@ add_new_name_mapping (tree new, tree old)
Otherwise, the insertion of PHI nodes for each of the old
names in these mappings will be very slow. */
sym = SSA_NAME_VAR (new);
uid = var_ann (sym)->uid;
uid = DECL_UID (sym);
update_ssa_stats.num_virtual_mappings++;
if (!bitmap_bit_p (update_ssa_stats.virtual_symbols, uid))
{
......@@ -651,7 +651,7 @@ mark_def_sites (struct dom_walk_data *walk_data,
{
tree sym = USE_FROM_PTR (use_p);
gcc_assert (DECL_P (sym));
if (!bitmap_bit_p (kills, var_ann (sym)->uid))
if (!bitmap_bit_p (kills, DECL_UID (sym)))
set_livein_block (sym, bb);
REWRITE_THIS_STMT (stmt) = 1;
}
......@@ -676,7 +676,7 @@ mark_def_sites (struct dom_walk_data *walk_data,
{
gcc_assert (DECL_P (def));
set_def_block (def, bb, false);
bitmap_set_bit (kills, var_ann (def)->uid);
bitmap_set_bit (kills, DECL_UID (def));
REGISTER_DEFS_IN_THIS_STMT (stmt) = 1;
}
......@@ -861,15 +861,15 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
static void
insert_phi_nodes (bitmap *dfs)
{
unsigned i;
referenced_var_iterator rvi;
tree var;
timevar_push (TV_TREE_INSERT_PHI_NODES);
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
struct def_blocks_d *def_map;
bitmap idf;
tree var = referenced_var (i);
def_map = find_def_blocks_for (var);
if (def_map == NULL)
......@@ -1662,16 +1662,16 @@ mark_def_sites_initialize_block (struct dom_walk_data *walk_data,
static void
mark_def_site_blocks (sbitmap interesting_blocks)
{
size_t i;
struct dom_walk_data walk_data;
struct mark_def_sites_global_data mark_def_sites_global_data;
referenced_var_iterator rvi;
tree var;
/* Allocate memory for the DEF_BLOCKS hash table. */
def_blocks = htab_create (VEC_length (tree, referenced_vars),
def_blocks = htab_create (num_referenced_vars,
def_blocks_hash, def_blocks_eq, def_blocks_free);
for (i = 0; i < num_referenced_vars; i++)
set_current_def (referenced_var (i), NULL_TREE);
FOR_EACH_REFERENCED_VAR(var, rvi)
set_current_def (var, NULL_TREE);
/* Setup callbacks for the generic dominator tree walker to find and
mark definition sites. */
......@@ -2287,7 +2287,7 @@ mark_sym_for_renaming (tree sym)
if (need_to_initialize_update_ssa_p)
init_update_ssa ();
bitmap_set_bit (syms_to_rename, var_ann (sym)->uid);
bitmap_set_bit (syms_to_rename, DECL_UID (sym));
if (!is_gimple_reg (sym))
need_to_update_vops_p = true;
......@@ -2769,7 +2769,7 @@ update_ssa (unsigned update_flags)
EXECUTE_IF_SET_IN_BITMAP (syms_to_rename, 0, i, bi)
insert_updated_phi_nodes_for (referenced_var (i), dfs, blocks,
update_flags);
update_flags);
FOR_EACH_BB (bb)
BITMAP_FREE (dfs[bb->index]);
......
......@@ -151,7 +151,7 @@ static tree generate_element_ref (struct sra_elt *);
static bool
is_sra_candidate_decl (tree decl)
{
return DECL_P (decl) && bitmap_bit_p (sra_candidates, var_ann (decl)->uid);
return DECL_P (decl) && bitmap_bit_p (sra_candidates, DECL_UID (decl));
}
/* Return true if TYPE is a scalar type. */
......@@ -493,7 +493,7 @@ lookup_element (struct sra_elt *parent, tree child, tree type,
if (TREE_CODE (child) == PARM_DECL)
{
elt->n_copies = 1;
bitmap_set_bit (needs_copy_in, var_ann (child)->uid);
bitmap_set_bit (needs_copy_in, DECL_UID (child));
}
}
......@@ -940,15 +940,15 @@ sra_walk_function (const struct sra_walk_fns *fns)
static bool
find_candidates_for_sra (void)
{
size_t i;
bool any_set = false;
tree var;
referenced_var_iterator rvi;
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
tree var = referenced_var (i);
if (decl_can_be_decomposed_p (var))
{
bitmap_set_bit (sra_candidates, var_ann (var)->uid);
bitmap_set_bit (sra_candidates, DECL_UID (var));
any_set = true;
}
}
......
......@@ -341,18 +341,15 @@ create_ssa_var_map (int flags)
var_map map;
ssa_op_iter iter;
#ifdef ENABLE_CHECKING
sbitmap used_in_real_ops;
sbitmap used_in_virtual_ops;
bitmap used_in_real_ops;
bitmap used_in_virtual_ops;
#endif
map = init_var_map (num_ssa_names + 1);
#ifdef ENABLE_CHECKING
used_in_real_ops = sbitmap_alloc (num_referenced_vars);
sbitmap_zero (used_in_real_ops);
used_in_virtual_ops = sbitmap_alloc (num_referenced_vars);
sbitmap_zero (used_in_virtual_ops);
used_in_real_ops = BITMAP_ALLOC (NULL);
used_in_virtual_ops = BITMAP_ALLOC (NULL);
#endif
if (flags & SSA_VAR_MAP_REF_COUNT)
......@@ -389,7 +386,7 @@ create_ssa_var_map (int flags)
register_ssa_partition (map, use, true);
#ifdef ENABLE_CHECKING
SET_BIT (used_in_real_ops, var_ann (SSA_NAME_VAR (use))->uid);
bitmap_set_bit (used_in_real_ops, DECL_UID (SSA_NAME_VAR (use)));
#endif
}
......@@ -398,7 +395,7 @@ create_ssa_var_map (int flags)
register_ssa_partition (map, dest, false);
#ifdef ENABLE_CHECKING
SET_BIT (used_in_real_ops, var_ann (SSA_NAME_VAR (dest))->uid);
bitmap_set_bit (used_in_real_ops, DECL_UID (SSA_NAME_VAR (dest)));
#endif
}
......@@ -407,7 +404,8 @@ create_ssa_var_map (int flags)
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter,
SSA_OP_VIRTUAL_USES | SSA_OP_VMUSTDEF)
{
SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (use))->uid);
bitmap_set_bit (used_in_virtual_ops,
DECL_UID (SSA_NAME_VAR (use)));
}
#endif /* ENABLE_CHECKING */
......@@ -419,21 +417,21 @@ create_ssa_var_map (int flags)
#if defined ENABLE_CHECKING
{
unsigned i;
sbitmap both = sbitmap_alloc (num_referenced_vars);
sbitmap_a_and_b (both, used_in_real_ops, used_in_virtual_ops);
if (sbitmap_first_set_bit (both) >= 0)
bitmap both = BITMAP_ALLOC (NULL);
bitmap_and (both, used_in_real_ops, used_in_virtual_ops);
if (!bitmap_empty_p (both))
{
sbitmap_iterator sbi;
bitmap_iterator bi;
EXECUTE_IF_SET_IN_SBITMAP (both, 0, i, sbi)
EXECUTE_IF_SET_IN_BITMAP (both, 0, i, bi)
fprintf (stderr, "Variable %s used in real and virtual operands\n",
get_name (referenced_var (i)));
internal_error ("SSA corruption");
}
sbitmap_free (used_in_real_ops);
sbitmap_free (used_in_virtual_ops);
sbitmap_free (both);
BITMAP_FREE (used_in_real_ops);
BITMAP_FREE (used_in_virtual_ops);
BITMAP_FREE (both);
}
#endif
......
......@@ -1165,20 +1165,14 @@ gather_mem_refs_stmt (struct loop *loop, htab_t mem_refs,
FOR_EACH_SSA_TREE_OPERAND (vname, stmt, oi,
SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_KILLS)
{
bitmap_set_bit (ref->vops,
var_ann (SSA_NAME_VAR (vname))->uid);
}
bitmap_set_bit (ref->vops, DECL_UID (SSA_NAME_VAR (vname)));
record_mem_ref_loc (&ref->locs, stmt, mem);
return;
fail:
FOR_EACH_SSA_TREE_OPERAND (vname, stmt, oi,
SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_KILLS)
{
bitmap_set_bit (clobbered_vops,
var_ann (SSA_NAME_VAR (vname))->uid);
}
bitmap_set_bit (clobbered_vops, DECL_UID (SSA_NAME_VAR (vname)));
}
/* Gathers memory references in LOOP. Notes vops accessed through unrecognized
......
......@@ -1555,10 +1555,10 @@ get_asm_expr_operands (tree stmt)
add_stmt_operand (&global_var, s_ann, opf_is_def);
else
EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, bi)
{
tree var = referenced_var (i);
add_stmt_operand (&var, s_ann, opf_is_def | opf_non_specific);
}
{
tree var = referenced_var (i);
add_stmt_operand (&var, s_ann, opf_is_def | opf_non_specific);
}
/* Now clobber all addressables. */
EXECUTE_IF_SET_IN_BITMAP (addressable_vars, 0, i, bi)
......@@ -1937,10 +1937,10 @@ note_addressable (tree var, stmt_ann_t s_ann)
{
subvar_t sv;
for (sv = svars; sv; sv = sv->next)
bitmap_set_bit (s_ann->addresses_taken, var_ann (sv->var)->uid);
bitmap_set_bit (s_ann->addresses_taken, DECL_UID (sv->var));
}
else
bitmap_set_bit (s_ann->addresses_taken, var_ann (var)->uid);
bitmap_set_bit (s_ann->addresses_taken, DECL_UID (var));
}
}
......
......@@ -2913,13 +2913,13 @@ set_uids_in_ptset (bitmap into, bitmap from)
subvar_t svars = get_subvars_for_var (vi->decl);
subvar_t sv;
for (sv = svars; sv; sv = sv->next)
bitmap_set_bit (into, var_ann (sv->var)->uid);
bitmap_set_bit (into, DECL_UID (sv->var));
}
/* We may end up with labels in the points-to set because people
take their address, and they are _DECL's. */
else if (TREE_CODE (vi->decl) == VAR_DECL
|| TREE_CODE (vi->decl) == PARM_DECL)
bitmap_set_bit (into, var_ann (vi->decl)->uid);
bitmap_set_bit (into, DECL_UID (vi->decl));
}
......
......@@ -373,17 +373,16 @@ error:
static void
verify_flow_insensitive_alias_info (void)
{
size_t i;
tree var;
bitmap visited = BITMAP_ALLOC (NULL);
referenced_var_iterator rvi;
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
size_t j;
var_ann_t ann;
varray_type may_aliases;
var = referenced_var (i);
ann = var_ann (var);
may_aliases = ann->may_aliases;
......@@ -391,7 +390,7 @@ verify_flow_insensitive_alias_info (void)
{
tree alias = VARRAY_TREE (may_aliases, j);
bitmap_set_bit (visited, var_ann (alias)->uid);
bitmap_set_bit (visited, DECL_UID (alias));
if (!may_be_aliased (alias))
{
......@@ -402,16 +401,14 @@ verify_flow_insensitive_alias_info (void)
}
}
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
var_ann_t ann;
var = referenced_var (i);
ann = var_ann (var);
if (ann->mem_tag_kind == NOT_A_TAG
&& ann->is_alias_tag
&& !bitmap_bit_p (visited, ann->uid))
&& !bitmap_bit_p (visited, DECL_UID (var)))
{
error ("Addressable variable that is an alias tag but is not in any alias set.");
goto err;
......@@ -554,13 +551,13 @@ verify_name_tags (void)
for (i = 0; aliases && i < VARRAY_ACTIVE_SIZE (aliases); i++)
{
tree alias = VARRAY_TREE (aliases, i);
bitmap_set_bit (type_aliases, var_ann (alias)->uid);
bitmap_set_bit (type_aliases, DECL_UID (alias));
}
/* When grouping, we may have added PTR's type tag into the
alias set of PTR's name tag. To prevent a false
positive, pretend that TMT is in its own alias set. */
bitmap_set_bit (type_aliases, var_ann (tmt)->uid);
bitmap_set_bit (type_aliases, DECL_UID (tmt));
if (bitmap_equal_p (type_aliases, pi->pt_vars))
continue;
......@@ -780,13 +777,31 @@ err:
internal_error ("verify_ssa failed.");
}
/* Return true if the uid in both int tree maps are equal. */
int
int_tree_map_eq (const void *va, const void *vb)
{
const struct int_tree_map *a = va, *b = vb;
return (a->uid == b->uid);
}
/* Hash a UID in a int_tree_map. */
unsigned int
int_tree_map_hash (const void *item)
{
return ((const struct int_tree_map *)item)->uid;
}
/* Initialize global DFA and SSA structures. */
void
init_tree_ssa (void)
{
referenced_vars = VEC_alloc (tree, gc, 20);
referenced_vars = htab_create_ggc (20, int_tree_map_hash,
int_tree_map_eq, NULL);
call_clobbered_vars = BITMAP_ALLOC (NULL);
addressable_vars = BITMAP_ALLOC (NULL);
init_ssanames ();
......@@ -804,6 +819,8 @@ delete_tree_ssa (void)
size_t i;
basic_block bb;
block_stmt_iterator bsi;
referenced_var_iterator rvi;
tree var;
/* Release any ssa_names still in use. */
for (i = 0; i < num_ssa_names; i++)
......@@ -833,13 +850,13 @@ delete_tree_ssa (void)
}
/* Remove annotations from every referenced variable. */
for (i = 0; i < num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
tree var = referenced_var (i);
ggc_free (var->common.ann);
var->common.ann = NULL;
}
VEC_free (tree, gc, referenced_vars);
htab_delete (referenced_vars);
referenced_vars = NULL;
fini_ssanames ();
fini_phinodes ();
......
......@@ -259,7 +259,7 @@ find_va_list_reference (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
var = SSA_NAME_VAR (var);
if (TREE_CODE (var) == VAR_DECL
&& bitmap_bit_p (va_list_vars, var_ann (var)->uid))
&& bitmap_bit_p (va_list_vars, DECL_UID (var)))
return var;
return NULL_TREE;
......@@ -337,12 +337,12 @@ va_list_counter_struct_op (struct stdarg_info *si, tree ap, tree var,
return false;
if (TREE_CODE (var) != SSA_NAME
|| bitmap_bit_p (si->va_list_vars, var_ann (SSA_NAME_VAR (var))->uid))
|| bitmap_bit_p (si->va_list_vars, DECL_UID (SSA_NAME_VAR (var))))
return false;
base = get_base_address (ap);
if (TREE_CODE (base) != VAR_DECL
|| !bitmap_bit_p (si->va_list_vars, var_ann (base)->uid))
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (base)))
return false;
if (TREE_OPERAND (ap, 1) == va_list_gpr_counter_field)
......@@ -361,12 +361,12 @@ static bool
va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
{
if (TREE_CODE (ap) != VAR_DECL
|| !bitmap_bit_p (si->va_list_vars, var_ann (ap)->uid))
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap)))
return false;
if (TREE_CODE (tem) != SSA_NAME
|| bitmap_bit_p (si->va_list_vars,
var_ann (SSA_NAME_VAR (tem))->uid)
DECL_UID (SSA_NAME_VAR (tem)))
|| is_global_var (SSA_NAME_VAR (tem)))
return false;
......@@ -396,7 +396,7 @@ va_list_ptr_read (struct stdarg_info *si, tree ap, tree tem)
/* Note the temporary, as we need to track whether it doesn't escape
the current function. */
bitmap_set_bit (si->va_list_escape_vars,
var_ann (SSA_NAME_VAR (tem))->uid);
DECL_UID (SSA_NAME_VAR (tem)));
return true;
}
......@@ -413,11 +413,11 @@ va_list_ptr_write (struct stdarg_info *si, tree ap, tree tem2)
unsigned HOST_WIDE_INT increment;
if (TREE_CODE (ap) != VAR_DECL
|| !bitmap_bit_p (si->va_list_vars, var_ann (ap)->uid))
|| !bitmap_bit_p (si->va_list_vars, DECL_UID (ap)))
return false;
if (TREE_CODE (tem2) != SSA_NAME
|| bitmap_bit_p (si->va_list_vars, var_ann (SSA_NAME_VAR (tem2))->uid))
|| bitmap_bit_p (si->va_list_vars, DECL_UID (SSA_NAME_VAR (tem2))))
return false;
if (si->compute_sizes <= 0)
......@@ -455,7 +455,7 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs)
if (TREE_CODE (rhs) != SSA_NAME
|| ! bitmap_bit_p (si->va_list_escape_vars,
var_ann (SSA_NAME_VAR (rhs))->uid))
DECL_UID (SSA_NAME_VAR (rhs))))
return;
if (TREE_CODE (lhs) != SSA_NAME || is_global_var (SSA_NAME_VAR (lhs)))
......@@ -495,7 +495,7 @@ check_va_list_escapes (struct stdarg_info *si, tree lhs, tree rhs)
}
bitmap_set_bit (si->va_list_escape_vars,
var_ann (SSA_NAME_VAR (lhs))->uid);
DECL_UID (SSA_NAME_VAR (lhs)));
}
......@@ -519,7 +519,7 @@ check_all_va_list_escapes (struct stdarg_info *si)
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_ALL_USES)
{
if (! bitmap_bit_p (si->va_list_escape_vars,
var_ann (SSA_NAME_VAR (use))->uid))
DECL_UID (SSA_NAME_VAR (use))))
continue;
if (TREE_CODE (stmt) == MODIFY_EXPR)
......@@ -565,12 +565,12 @@ check_all_va_list_escapes (struct stdarg_info *si)
{
if (TREE_CODE (lhs) == SSA_NAME
&& bitmap_bit_p (si->va_list_escape_vars,
var_ann (SSA_NAME_VAR (lhs))->uid))
DECL_UID (SSA_NAME_VAR (lhs))))
continue;
if (TREE_CODE (lhs) == VAR_DECL
&& bitmap_bit_p (si->va_list_vars,
var_ann (lhs)->uid))
DECL_UID (lhs)))
continue;
}
}
......@@ -690,7 +690,7 @@ execute_optimize_stdarg (void)
break;
}
bitmap_set_bit (si.va_list_vars, var_ann (ap)->uid);
bitmap_set_bit (si.va_list_vars, DECL_UID (ap));
/* VA_START_BB and VA_START_AP will be only used if there is just
one va_start in the function. */
......
......@@ -132,16 +132,17 @@ static void find_tail_calls (basic_block, struct tailcall **);
static bool
suitable_for_tail_opt_p (void)
{
int i;
referenced_var_iterator rvi;
tree var;
if (current_function_stdarg)
return false;
/* No local variable nor structure field should be call-clobbered. We
ignore any kind of memory tag, as these are not real variables. */
for (i = 0; i < (int) num_referenced_vars; i++)
FOR_EACH_REFERENCED_VAR (var, rvi)
{
tree var = VEC_index (tree, referenced_vars, i);
if (!(TREE_STATIC (var) || DECL_EXTERNAL (var))
&& (var_ann (var)->mem_tag_kind == NOT_A_TAG
......
2005-06-30 Daniel Berlin <dberlin@dberlin.org>
* hashtab.h (HTAB_DELETED_ENTRY): New macro.
(HTAB_EMPTY_ENTRY): New macro.
2005-06-20 Geoffrey Keating <geoffk@apple.com>
* libiberty.h (strverscmp): Prototype.
......
......@@ -81,6 +81,15 @@ typedef void (*htab_free) (void *);
typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
typedef void (*htab_free_with_arg) (void *, void *);
/* This macro defines reserved value for empty table entry. */
#define HTAB_EMPTY_ENTRY ((PTR) 0)
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define HTAB_DELETED_ENTRY ((PTR) 1)
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
......
2005-06-30 Daniel Berlin <dberlin@dberlin.org>
* hashtab.c (EMPTY_ENTRY): Moved and renamed.
(DELETED_ENTRY): Ditto.
2005-06-20 Geoffrey Keating <geoffk@apple.com>
* strverscmp.c: New.
......
......@@ -64,15 +64,6 @@ Boston, MA 02110-1301, USA. */
#define CHAR_BIT 8
#endif
/* This macro defines reserved value for empty table entry. */
#define EMPTY_ENTRY ((PTR) 0)
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define DELETED_ENTRY ((PTR) 1)
static unsigned int higher_prime_index (unsigned long);
static hashval_t htab_mod_1 (hashval_t, hashval_t, hashval_t, int);
static hashval_t htab_mod (hashval_t, htab_t);
......@@ -290,7 +281,7 @@ htab_mod_m2 (hashval_t hash, htab_t htab)
/* This function creates table with length slightly longer than given
source length. Created hash table is initiated as empty (all the
hash table entries are EMPTY_ENTRY). The function returns the
hash table entries are HTAB_EMPTY_ENTRY). The function returns the
created hash table, or NULL if memory allocation fails. */
htab_t
......@@ -401,7 +392,7 @@ htab_delete (htab_t htab)
if (htab->del_f)
for (i = size - 1; i >= 0; i--)
if (entries[i] != EMPTY_ENTRY && entries[i] != DELETED_ENTRY)
if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY)
(*htab->del_f) (entries[i]);
if (htab->free_f != NULL)
......@@ -427,7 +418,7 @@ htab_empty (htab_t htab)
if (htab->del_f)
for (i = size - 1; i >= 0; i--)
if (entries[i] != EMPTY_ENTRY && entries[i] != DELETED_ENTRY)
if (entries[i] != HTAB_EMPTY_ENTRY && entries[i] != HTAB_DELETED_ENTRY)
(*htab->del_f) (entries[i]);
memset (entries, 0, size * sizeof (PTR));
......@@ -448,9 +439,9 @@ find_empty_slot_for_expand (htab_t htab, hashval_t hash)
PTR *slot = htab->entries + index;
hashval_t hash2;
if (*slot == EMPTY_ENTRY)
if (*slot == HTAB_EMPTY_ENTRY)
return slot;
else if (*slot == DELETED_ENTRY)
else if (*slot == HTAB_DELETED_ENTRY)
abort ();
hash2 = htab_mod_m2 (hash, htab);
......@@ -461,9 +452,9 @@ find_empty_slot_for_expand (htab_t htab, hashval_t hash)
index -= size;
slot = htab->entries + index;
if (*slot == EMPTY_ENTRY)
if (*slot == HTAB_EMPTY_ENTRY)
return slot;
else if (*slot == DELETED_ENTRY)
else if (*slot == HTAB_DELETED_ENTRY)
abort ();
}
}
......@@ -523,7 +514,7 @@ htab_expand (htab_t htab)
{
PTR x = *p;
if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
{
PTR *q = find_empty_slot_for_expand (htab, (*htab->hash_f) (x));
......@@ -556,8 +547,8 @@ htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash)
index = htab_mod (hash, htab);
entry = htab->entries[index];
if (entry == EMPTY_ENTRY
|| (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
if (entry == HTAB_EMPTY_ENTRY
|| (entry != HTAB_DELETED_ENTRY && (*htab->eq_f) (entry, element)))
return entry;
hash2 = htab_mod_m2 (hash, htab);
......@@ -569,8 +560,8 @@ htab_find_with_hash (htab_t htab, const PTR element, hashval_t hash)
index -= size;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY
|| (entry != DELETED_ENTRY && (*htab->eq_f) (entry, element)))
if (entry == HTAB_EMPTY_ENTRY
|| (entry != HTAB_DELETED_ENTRY && (*htab->eq_f) (entry, element)))
return entry;
}
}
......@@ -615,9 +606,9 @@ htab_find_slot_with_hash (htab_t htab, const PTR element,
first_deleted_slot = NULL;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY)
if (entry == HTAB_EMPTY_ENTRY)
goto empty_entry;
else if (entry == DELETED_ENTRY)
else if (entry == HTAB_DELETED_ENTRY)
first_deleted_slot = &htab->entries[index];
else if ((*htab->eq_f) (entry, element))
return &htab->entries[index];
......@@ -631,9 +622,9 @@ htab_find_slot_with_hash (htab_t htab, const PTR element,
index -= size;
entry = htab->entries[index];
if (entry == EMPTY_ENTRY)
if (entry == HTAB_EMPTY_ENTRY)
goto empty_entry;
else if (entry == DELETED_ENTRY)
else if (entry == HTAB_DELETED_ENTRY)
{
if (!first_deleted_slot)
first_deleted_slot = &htab->entries[index];
......@@ -649,7 +640,7 @@ htab_find_slot_with_hash (htab_t htab, const PTR element,
if (first_deleted_slot)
{
htab->n_deleted--;
*first_deleted_slot = EMPTY_ENTRY;
*first_deleted_slot = HTAB_EMPTY_ENTRY;
return first_deleted_slot;
}
......@@ -688,13 +679,13 @@ htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
PTR *slot;
slot = htab_find_slot_with_hash (htab, element, hash, NO_INSERT);
if (*slot == EMPTY_ENTRY)
if (*slot == HTAB_EMPTY_ENTRY)
return;
if (htab->del_f)
(*htab->del_f) (*slot);
*slot = DELETED_ENTRY;
*slot = HTAB_DELETED_ENTRY;
htab->n_deleted++;
}
......@@ -706,13 +697,13 @@ void
htab_clear_slot (htab_t htab, PTR *slot)
{
if (slot < htab->entries || slot >= htab->entries + htab_size (htab)
|| *slot == EMPTY_ENTRY || *slot == DELETED_ENTRY)
|| *slot == HTAB_EMPTY_ENTRY || *slot == HTAB_DELETED_ENTRY)
abort ();
if (htab->del_f)
(*htab->del_f) (*slot);
*slot = DELETED_ENTRY;
*slot = HTAB_DELETED_ENTRY;
htab->n_deleted++;
}
......@@ -726,7 +717,7 @@ htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
{
PTR *slot;
PTR *limit;
slot = htab->entries;
limit = slot + htab_size (htab);
......@@ -734,7 +725,7 @@ htab_traverse_noresize (htab_t htab, htab_trav callback, PTR info)
{
PTR x = *slot;
if (x != EMPTY_ENTRY && x != DELETED_ENTRY)
if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
if (!(*callback) (slot, info))
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment