-/** Resolve polymorphy in the inheritance relation.
- *
- * Returns the dynamically referenced entity if the static entity and the
- * dynamic type are given.
- * Search downwards in overwritten tree. */
-entity *resolve_ent_polymorphy(type *dynamic_class, entity *static_ent) {
- entity *res;
- assert(static_ent && static_ent->kind == k_entity);
-
- res = resolve_ent_polymorphy2(dynamic_class, static_ent);
-#if DEBUG_libfirm
- if (!res) {
- printf(" Could not find entity "); DDME(static_ent);
- printf(" in "); DDMT(dynamic_class);
- printf("\n");
- dump_entity(static_ent);
- dump_type(get_entity_owner(static_ent));
- dump_type(dynamic_class);
- }
-#endif
- assert(res);
- return res;
-}
+ if (irg)
+ return get_irg_additional_properties(irg);
+
+ if (ent->attr.mtd_attr.irg_add_properties & mtp_property_inherited)
+ return get_method_additional_properties(get_entity_type(ent));
+
+ return ent->attr.mtd_attr.irg_add_properties;
+} /* get_entity_additional_properties */
+
+/* Sets the mask of the additional graph properties. */
+void set_entity_additional_properties(ir_entity *ent, unsigned property_mask)
+{
+ ir_graph *irg;
+
+ assert(is_method_entity(ent));
+
+ /* first check, if the graph exists */
+ irg = get_entity_irg(ent);
+ if (irg)
+ set_irg_additional_properties(irg, property_mask);
+ else {
+ /* do not allow to set the mtp_property_inherited flag or
+ * the automatic inheritance of flags will not work */
+ ent->attr.mtd_attr.irg_add_properties = property_mask & ~mtp_property_inherited;
+ }
+} /* set_entity_additional_properties */
+
+/* Sets one additional graph property. */
+void set_entity_additional_property(ir_entity *ent, mtp_additional_property flag)
+{
+ ir_graph *irg;
+
+ assert(is_method_entity(ent));
+
+ /* first check, if the graph exists */
+ irg = get_entity_irg(ent);
+ if (irg)
+ set_irg_additional_property(irg, flag);
+ else {
+ unsigned mask = ent->attr.mtd_attr.irg_add_properties;
+
+ if (mask & mtp_property_inherited)
+ mask = get_method_additional_properties(get_entity_type(ent));
+
+ /* do not allow to set the mtp_property_inherited flag or
+ * the automatic inheritance of flags will not work */
+ ent->attr.mtd_attr.irg_add_properties = mask | (flag & ~mtp_property_inherited);
+ }
+} /* set_entity_additional_property */
+
+/* Returns the class type that this type info entity represents or NULL
+ if ent is no type info entity. */
+ir_type *(get_entity_repr_class)(const ir_entity *ent) {
+ return _get_entity_repr_class(ent);
+} /* get_entity_repr_class */
+
+dbg_info *(get_entity_dbg_info)(const ir_entity *ent) {
+ return _get_entity_dbg_info(ent);
+} /* get_entity_dbg_info */
+
+void (set_entity_dbg_info)(ir_entity *ent, dbg_info *db) {
+ _set_entity_dbg_info(ent, db);
+} /* set_entity_dbg_info */
+
+/* Initialize entity module. */
+void firm_init_entity(void)
+{
+ symconst_symbol sym;
+
+ assert(firm_unknown_type && "Call init_type() before firm_init_entity()!");
+ assert(!unknown_entity && "Call firm_init_entity() only once!");
+
+ unknown_entity = new_rd_entity(NULL, firm_unknown_type, new_id_from_str(UNKNOWN_ENTITY_NAME), firm_unknown_type);
+ set_entity_visibility(unknown_entity, visibility_external_allocated);
+ set_entity_ld_ident(unknown_entity, get_entity_ident(unknown_entity));
+
+ current_ir_graph = get_const_code_irg();
+ sym.entity_p = unknown_entity;
+ /* TODO: we need two unknown_entities here, one for code and one for data */
+ unknown_entity->value = new_SymConst(mode_P_data, sym, symconst_addr_ent);
+} /* firm_init_entity */