-/* The tarval represents the address of the entity. As the address must
- be constant the entity must have as owner the global type. */
-tarval *new_tarval_from_entity (entity *ent, ir_mode *mode)
-{
- ANNOUNCE();
- assert(ent);
- assert(mode && (get_mode_sort(mode) == irms_reference));
-
- return get_tarval((void *)ent, 0, mode);
-}
-int tarval_is_entity(tarval *tv)
-{
- ANNOUNCE();
- assert(tv);
- /* tv->value == NULL means dereferencing a null pointer */
- return ((get_mode_sort(tv->mode) == irms_reference) && (tv->value != NULL) && (tv->length == 0)
- && (tv != tarval_P_void));
-}
-
-entity *tarval_to_entity(tarval *tv)
-{
- ANNOUNCE();
- assert(tv);
-
- if (tarval_is_entity(tv))
- return (entity *)tv->value;
- else {
- assert(0 && "tarval did not represent an entity");
- return NULL;
- }
-}
-
-void free_tarval_entity(entity *ent) {
- /* There can be a tarval referencing this entity. Even if the
- tarval is not used by the code any more, it can still reference
- the entity as tarvals live indepently of the entity referenced.
- Further the tarval is hashed into a set. If a hash function
- evaluation happens to collide with this tarval, we will vrfy that
- it contains a proper entity and we will crash if the entity is
- freed.
-
- Unluckily, tarvals can neither be changed nor deleted, and to find
- one, all existing reference modes have to be tried -> a facility
- to retrieve all modes of a kind is needed. */
- ANNOUNCE();
-}