- /* copy the members to the target pset */
- /* NOTE: If src and tgt pset are the same, inserting while iterating is not allowed */
- if (tgt_slot != i)
- for(n1 = pset_first(ass[i]->members); n1; n1 = pset_next(ass[i]->members))
- pset_insert_ptr(ass[tgt_slot]->members, n1);
- }
-}
-
-#define ALIGN_SPILL_AREA 16
-#define pset_foreach(pset, elm) for(elm=pset_first(pset); elm; elm=pset_next(pset))
-
-/**
- * Returns a spill type for a mode. Keep them in a map to reduce
- * the number of types.
- *
- * @param types a map containing all created types
- * @param ss the spill slot
- *
- * Note that type types should are identical for every mode.
- * This rule might break if two different register classes return the same
- * mode but different alignments.
- */
-static ir_type *get_spill_type(pmap *types, spill_slot_t *ss) {
- pmap_entry *e = pmap_find(types, ss->largest_mode);
- ir_type *res;
-
- if (! e) {
- char buf[64];
- snprintf(buf, sizeof(buf), "spill_slot_type_%s", get_mode_name(ss->largest_mode));
- res = new_type_primitive(new_id_from_str(buf), ss->largest_mode);
- set_type_alignment_bytes(res, ss->align);
- pmap_insert(types, ss->largest_mode, res);
- }
- else {
- res = e->value;
- assert(get_type_alignment_bytes(res) == (int)ss->align);
- }
- return res;
-}
-
-/**
- * Create spill slot entities on the frame type.
- *
- * @param ssenv the spill environment
- * @param n number of spill slots
- * @param ss array of spill slots
- */
-static void assign_entities(ss_env_t *ssenv, int n_slots, spill_slot_t *ss[]) {
- int i, offset, frame_align;
- ir_type *frame = get_irg_frame_type(ssenv->cenv->irg);
-
- /* aligning by increasing frame size */
- offset = get_type_size_bits(frame) / 8;
- offset = round_up2(offset, ALIGN_SPILL_AREA);
- set_type_size_bytes(frame, -1);
-
- /* create entities and assign offsets according to size and alignment*/
- for (i = 0; i < n_slots; ++i) {
- char buf[64];
- ident *name;
- entity *spill_ent;
- ir_node *irn;
-
- /* build entity */
- snprintf(buf, sizeof(buf), "spill_slot_%d", i);
- name = new_id_from_str(buf);