hashval_t hash_type_name (tree t) { gcc_checking_assert (TYPE_MAIN_VARIANT (t) == t); /* If not in LTO, all main variants are unique, so we can do pointer hash. */ if (!in_lto_p) return htab_hash_pointer (t); /* Anonymous types are unique. */ if (type_in_anonymous_namespace_p (t)) return htab_hash_pointer (t); /* For polymorphic types, we can simply hash the virtual table. */ if (TYPE_BINFO (t) && BINFO_VTABLE (TYPE_BINFO (t))) { tree v = BINFO_VTABLE (TYPE_BINFO (t)); hashval_t hash = 0; if (TREE_CODE (v) == POINTER_PLUS_EXPR) { hash = TREE_INT_CST_LOW (TREE_OPERAND (v, 1)); v = TREE_OPERAND (TREE_OPERAND (v, 0), 0); } v = DECL_ASSEMBLER_NAME (v); hash = iterative_hash_hashval_t (hash, htab_hash_pointer (v)); return hash; } /* Rest is not implemented yet. */ gcc_unreachable (); }
static hashval_t stscm_hash_symtab_smob (const void *p) { const symtab_smob *st_smob = p; return htab_hash_pointer (st_smob->symtab); }
static hashval_t cache_hash (const void *arg) { const struct tailcall_cache *cache = arg; return htab_hash_pointer (cache->next_bottom_frame); }
/* Hash table helpers functions. */ static hashval_t hash_ptr (const void *p) { const struct ptr_hash_entry *const d = (const struct ptr_hash_entry *) p; return htab_hash_pointer (d->ptr); }
/* Hashtable helpers. */ static hashval_t hash_descriptor (const void *p) { const struct vec_descriptor *const d = (const struct vec_descriptor *) p; return htab_hash_pointer (d->file) + d->line; }
static hashval_t syscm_hash_symbol_smob (const void *p) { const symbol_smob *s_smob = p; return htab_hash_pointer (s_smob->symbol); }
static hashval_t hash_type_map_instance (const void *p) { const struct type_map_instance *inst = (const struct type_map_instance *) p; return htab_hash_pointer (inst->type); }
static hashval_t hash_symbol_error (const void *a) { const struct symbol_error *se = a; return htab_hash_pointer (se->sym); }
static hashval_t hash_dis_line_entry (const void *item) { const struct dis_line_entry *dle = (const struct dis_line_entry *) item; return htab_hash_pointer (dle->symtab) + dle->line; }
static hashval_t bfcache_hash (const void *arg) { const struct btrace_frame_cache *cache = arg; return htab_hash_pointer (cache->frame); }
/* Notice that the pointer has been freed. */ static void free_overhead (struct vec_prefix *ptr) { PTR *slot = htab_find_slot_with_hash (ptr_hash, ptr, htab_hash_pointer (ptr), NO_INSERT); struct ptr_hash_entry *p = (struct ptr_hash_entry *) *slot; p->loc->allocated -= p->allocated; htab_clear_slot (ptr_hash, slot); free (p); }
void vec_prefix::release_overhead (void) { PTR *slot = htab_find_slot_with_hash (ptr_hash, this, htab_hash_pointer (this), NO_INSERT); struct ptr_hash_entry *p = (struct ptr_hash_entry *) *slot; p->loc->allocated -= p->allocated; htab_clear_slot (ptr_hash, slot); ::free (p); }
tree decl_shadowed_for_var_lookup (tree from) { struct tree_map *h, in; in.from = from; h = (struct tree_map *) htab_find_with_hash (shadowed_var_for_decl, &in, htab_hash_pointer (from)); if (h) return h->to; return NULL_TREE; }
void decl_shadowed_for_var_insert (tree from, tree to) { struct tree_map *h; void **loc; h = GGC_NEW (struct tree_map); h->hash = htab_hash_pointer (from); h->from = from; h->to = to; loc = htab_find_slot_with_hash (shadowed_var_for_decl, h, h->hash, INSERT); *(struct tree_map **) loc = h; }
/* For given name, return descriptor, create new if needed. */ static struct alloc_pool_descriptor * allocate_pool_descriptor (const char *name) { struct alloc_pool_descriptor **slot; if (!alloc_pool_hash.is_created ()) alloc_pool_hash.create (10); slot = alloc_pool_hash.find_slot_with_hash (name, htab_hash_pointer (name), INSERT); if (*slot) return *slot; *slot = XCNEW (struct alloc_pool_descriptor); (*slot)->name = name; return *slot; }
static hashval_t frscm_hash_frame_smob (const void *p) { const frame_smob *f_smob = p; const struct frame_id *fid = &f_smob->frame_id; hashval_t hash = htab_hash_pointer (f_smob->inferior); if (fid->stack_status == FID_STACK_VALID) hash = iterative_hash (&fid->stack_addr, sizeof (fid->stack_addr), hash); if (fid->code_addr_p) hash = iterative_hash (&fid->code_addr, sizeof (fid->code_addr), hash); if (fid->special_addr_p) hash = iterative_hash (&fid->special_addr, sizeof (fid->special_addr), hash); return hash; }
/* For given name, return descriptor, create new if needed. */ static struct alloc_pool_descriptor * alloc_pool_descriptor (const char *name) { struct alloc_pool_descriptor **slot; if (!alloc_pool_hash) alloc_pool_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL); slot = (struct alloc_pool_descriptor **) htab_find_slot_with_hash (alloc_pool_hash, name, htab_hash_pointer (name), 1); if (*slot) return *slot; *slot = xcalloc (sizeof (**slot), 1); (*slot)->name = name; return *slot; }
/* For given name, return descriptor, create new if needed. */ static struct varray_descriptor * varray_descriptor (const char *name) { struct varray_descriptor **slot; if (!varray_hash) varray_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL); slot = (struct varray_descriptor **) htab_find_slot_with_hash (varray_hash, name, htab_hash_pointer (name), INSERT); if (*slot) return *slot; *slot = XCNEW (struct varray_descriptor); (*slot)->name = name; return *slot; }
/* Account the overhead. */ static void register_overhead (struct vec_prefix *ptr, size_t size, const char *name, int line, const char *function) { struct vec_descriptor *loc = vec_descriptor (name, line, function); struct ptr_hash_entry *p = XNEW (struct ptr_hash_entry); PTR *slot; p->ptr = ptr; p->loc = loc; p->allocated = size; if (!ptr_hash) ptr_hash = htab_create (10, hash_ptr, eq_ptr, NULL); slot = htab_find_slot_with_hash (ptr_hash, ptr, htab_hash_pointer (ptr), INSERT); gcc_assert (!*slot); *slot = p; loc->allocated += size; if (loc->peak < loc->allocated) loc->peak += loc->allocated; loc->times++; }
static unsigned int htab_hash_elem (const void *p) { const_p_hash_elem elem = (const_p_hash_elem) p; return htab_hash_pointer (elem->insn); }
/* The hash function, based on the pointer to the pointer SSA_NAME. */ static hashval_t name_to_bb_hash (const void *p) { const_tree n = ((const struct name_to_bb *)p)->ssa_name; return htab_hash_pointer (n) ^ ((const struct name_to_bb *)p)->store; }
inline hashval_t alloc_pool_hasher::hash (const value_type *d) { return htab_hash_pointer (d->name); }
static hashval_t func_cl_pf_opts_mapping_hash (const void* entry) { const struct func_cl_pf_opts_mapping *e = entry; return htab_hash_pointer (e->func); }
/* Hashtable helpers. */ static hashval_t hash_descriptor (const void *p) { const struct varray_descriptor *d = (const struct varray_descriptor *) p; return htab_hash_pointer (d->name); }
/* Hashtable helpers. */ static hashval_t hash_descriptor (const void *p) { const struct alloc_pool_descriptor *d = p; return htab_hash_pointer (d->name); }
inline hashval_t tree_entry_hasher::hash (const value_type *e) { return htab_hash_pointer (e->key); }
static hashval_t hash_tree (const void *p) { const struct tree_hash_entry *e = (const struct tree_hash_entry *) p; return htab_hash_pointer (e->key); }