Advertisement

このページを編集する際は,編集に関する方針に従ってください.

概要

引数

  • unsigned int hashcode
  • tree type

実装

4121 /* Given TYPE, and HASHCODE its hash code, return the canonical
4122    object for an identical type if one already exists.
4123    Otherwise, return TYPE, and record it as the canonical object.
4124 
4125    To use this function, first create a type of the sort you want.
4126    Then compute its hash code from the fields of the type that
4127    make it different from other similar types.
4128    Then call this function and use the value.  */
4129 
4130 tree
4131 type_hash_canon (unsigned int hashcode, tree type)
4132 {
4133   tree t1;
4134 
4135   /* The hash table only contains main variants, so ensure that's what we're
4136      being passed.  */
4137   gcc_assert (TYPE_MAIN_VARIANT (type) == type);
4138 
4139   if (!lang_hooks.types.hash_types)
4140     return type;
4141 
4142   /* See if the type is in the hash table already.  If so, return it.
4143      Otherwise, add the type.  */
4144   t1 = type_hash_lookup (hashcode, type);
4145   if (t1 != 0)
4146     {
4147 #ifdef GATHER_STATISTICS
4148       tree_node_counts[(int) t_kind]--;
4149       tree_node_sizes[(int) t_kind] -= sizeof (struct tree_type);
4150 #endif
4151       return t1;
4152     }
4153   else
4154     {
4155       type_hash_add (hashcode, type);
4156       return type;
4157     }
4158 }



リンク元

特に記載のない限り、コミュニティのコンテンツはCC-BY-SAライセンスの下で利用可能です。