Esempio n. 1
0
inline hashval_t
polymorphic_call_target_hasher::hash (const value_type *odr_query)
{
  hashval_t hash;

  hash = iterative_hash_host_wide_int
	  (odr_query->otr_token,
	   odr_query->type->id);
  hash = iterative_hash_hashval_t (TYPE_UID (odr_query->context.outer_type),
				   hash);
  hash = iterative_hash_host_wide_int (odr_query->context.offset, hash);
  return iterative_hash_hashval_t
	    (((int)odr_query->context.maybe_in_construction << 1)
	     | (int)odr_query->context.maybe_derived_type, hash);
}
Esempio n. 2
0
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 ();
}
Esempio n. 3
0
inline hashval_t
polymorphic_call_target_hasher::hash (const value_type *odr_query)
{
  return iterative_hash_hashval_t (odr_query->type->id,
				   odr_query->otr_token);
}