res->types = NEW_ARR_F (type *, 1);
res->glob_type = new_type_class(id_from_str (GLOBAL_TYPE_NAME,
strlen(GLOBAL_TYPE_NAME)));
- add_irp_type((type *)res->glob_type);
+ add_irp_type(res->glob_type);
res->const_code_irg = new_const_code_irg();
assert (ent && ent->type);
assert (irg);
assert (is_method_type(ent->type));
+ assert (ent->peculiarity == existent);
ent->irg = irg;
}
void set_entity_link(entity *ent, void *l);
/* The entity knows the corresponding irg if the entity is a method.
- This allows to get from a Call to the called irg. */
+ This allows to get from a Call to the called irg.
+ Only entities of peculiarity "existent" can have a corresponding irg,
+ else the field is fixed to NULL. (Get returns NULL, set asserts.) */
ir_graph *get_entity_irg(entity *ent);
void set_entity_irg(entity *ent, ir_graph *irg);
-/*
+/*10 2002/03/19 13:08:33
** Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
** All rights reserved.
**
void *link; /* To store some intermediate information */
unsigned long visit; /* visited counter for walks of the type information */
/* for methods */
+ enum peculiarity peculiarity;
ir_graph *irg; /* If (type == method_type) this is the corresponding irg.
The ir_graph constructor automatically sets this field.
- @@@ Does this go here, or should it be in type_method,
- or should Call have an attribute ent??
Yes, it must be here. */
- peculiarity peculiarity;
};
-/****h* libfirm/type
+/****h* libfirm/type6 2002/03/19 13:08:33
*
* NAME
* file type.h - datastructure to hold type information.
void remove_class_supertype(type *clss, type *supertype);
/* This enumeration flags the peculiarity of entities and types. */
-typedef enum {
+typedef enum peculiarity {
description, /* Represents only a description. The entity/type is never
allocated, no code/data exists for this entity/type. */
existent /* The entity/type (can) exist. */