- /* link unused ones */
- list = NULL;
- for (i = n - 1; i >= 0; --i) {
- ent = get_class_member(frame_tp, i);
- if (get_entity_link(ent) == NULL) {
- set_entity_link(ent, list);
- list = ent;
- }
- }
+ if (list != NULL) {
+ /* delete list members */
+ for (ent = list; ent; ent = list) {
+ list = (ir_entity*)get_entity_link(ent);
+ free_entity(ent);
+ }
+ /* we changed the frame type, its layout should be redefined */
+ set_type_state(frame_tp, layout_undefined);
+ }
+ irp_free_resources(irp, IRP_RESOURCE_ENTITY_LINK);
+
+ /* we changed the type, this affects none of the currently known graph
+ * properties, but I don't use ALL because I don't know if someone adds
+ * type-based properties at some point */
+ confirm_irg_properties(irg,
+ IR_GRAPH_PROPERTIES_CONTROL_FLOW
+ | IR_GRAPH_PROPERTY_NO_BADS
+ | IR_GRAPH_PROPERTY_NO_TUPLES
+ | IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES
+ | IR_GRAPH_PROPERTY_CONSISTENT_OUTS
+ | IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE
+ | IR_GRAPH_PROPERTY_MANY_RETURNS);
+}