/** general **/
/*******************************************************************/
+entity *unknown_entity = NULL; entity *get_unknown_entity(void) { return unknown_entity; }
+#define UNKNOWN_ENTITY_NAME "unknown_entity"
+
+static INLINE entity *
+new_rd_entity (dbg_info *db, type *owner, ident *name, type *type);
+
void
init_entity (void)
{
+ assert(unknown_type && "Call init_type before init_entity!");
+ assert(!unknown_entity && "Call init_entity only once!");
+ unknown_entity = new_rd_entity(NULL, unknown_type, new_id_from_str(UNKNOWN_ENTITY_NAME), unknown_type);
+ set_entity_visibility(unknown_entity, visibility_external_allocated);
+ set_entity_ld_ident(unknown_entity, get_entity_ident(unknown_entity));
+
+ symconst_symbol sym;
+ sym.entity_p = unknown_entity;
+ current_ir_graph = get_const_code_irg();
+ unknown_entity->value = new_SymConst(sym, symconst_addr_ent);
}
+
/*-----------------------------------------------------------------*/
/* ENTITY */
/*-----------------------------------------------------------------*/
-static void insert_entity_in_owner (entity *ent) {
+static INLINE void insert_entity_in_owner (entity *ent) {
type *owner = ent->owner;
switch (get_type_tpop_code(owner)) {
case tpo_class: {
}
}
-entity *
-new_entity (type *owner, ident *name, type *type)
+static INLINE entity *
+new_rd_entity (dbg_info *db, type *owner, ident *name, type *type)
{
entity *res;
ir_graph *rem;
assert(!id_contains_char(name, ' ') && "entity name should not contain spaces");
res = (entity *) xmalloc (sizeof (entity));
+ memset(res, 0, sizeof(res));
res->kind = k_entity;
- assert_legal_owner_of_ent(owner);
res->owner = owner;
res->name = name;
res->type = type;
}
res->irg = NULL;
- res->accesses = NULL;
+ //res->accesses = NULL;
#ifdef DEBUG_libfirm
res->nr = get_irp_new_node_nr();
- res->c_name = (char*) get_id_str (name);
+ res->c_name = (char *)get_id_str (name);
#endif /* DEBUG_libfirm */
res->visit = 0;
+ set_entity_dbg_info(res, db);
- /* Remember entity in it's owner. */
- insert_entity_in_owner (res);
return res;
}
+
entity *
new_d_entity (type *owner, ident *name, type *type, dbg_info *db) {
- entity *res = new_entity(owner, name, type);
- set_entity_dbg_info(res, db);
+ assert_legal_owner_of_ent(owner);
+ entity *res = new_rd_entity(db, owner, name, type);
+ /* Remember entity in it's owner. */
+ insert_entity_in_owner (res);
+
return res;
}
+entity *
+new_entity (type *owner, ident *name, type *type) {
+ return new_d_entity(owner, name, type, NULL);
+}
+
+
+
+
static void free_entity_attrs(entity *ent) {
int i;
if (get_type_tpop(get_entity_owner(ent)) == type_class) {
}
#ifdef DEBUG_libfirm
new->nr = get_irp_new_node_nr();
- new->c_name = get_id_str (new->name);
+ new->c_name = (char *)get_id_str (new->name);
#endif
insert_entity_in_owner (new);
assert(ent && is_method_type(get_entity_type(ent)));
/* Wie kann man die Referenz auf einen IRG löschen, z.B. wenn die
* Methode selbst nicht mehr aufgerufen werden kann, die Entität
- * aber erhalten bleiben soll. */
+ * aber erhalten bleiben soll? Wandle die Entitaet in description oder
+ * inherited um! */
/* assert(irg); */
assert((irg && ent->peculiarity == peculiarity_existent) ||
(!irg && ent->peculiarity == peculiarity_description) ||