- cl_entry *p;
- ir_node *call, **new_in;
- ir_type *ctp, *lowered_mtp;
- size_t i, n_res, n_params, n_com, pos;
-
- new_in = NEW_ARR_F(ir_node *, 0);
- for (p = env->cl_list; p; p = p->next) {
- call = p->call;
- ctp = get_Call_type(call);
- lowered_mtp = lower_mtp(env->flags, ctp);
- set_Call_type(call, lowered_mtp);
+ ir_node *call = entry->call;
+ ir_graph *irg = get_irn_irg(call);
+ size_t n_params = get_Call_n_params(call);
+ size_t n_com = 0;
+ size_t n_res = get_method_n_ress(ctp);
+ size_t pos = 0;
+ ir_node **new_in;
+ size_t i;
+
+ for (i = 0; i < n_res; ++i) {
+ ir_type *type = get_method_res_type(ctp, i);
+ if (is_compound_type(type))
+ ++n_com;
+ }
+
+ new_in = ALLOCANZ(ir_node*, n_params + n_com + (n_Call_max+1));
+ new_in[pos++] = get_Call_mem(call);
+ new_in[pos++] = get_Call_ptr(call);
+ assert(pos == n_Call_max+1);
+ add_hidden_param(irg, n_com, &new_in[pos], entry, ctp);
+ pos += n_com;
+
+ /* copy all other parameters */
+ for (i = 0; i < n_params; ++i) {
+ ir_node *param = get_Call_param(call, i);
+ new_in[pos++] = param;
+ }
+ assert(pos == n_params+n_com+(n_Call_max+1));
+ set_irn_in(call, pos, new_in);
+}
+
+static ir_entity *create_compound_arg_entity(ir_graph *irg, ir_type *type)
+{
+ ir_type *frame = get_irg_frame_type(irg);
+ ident *id = id_unique("$compound_param.%u");
+ ir_entity *entity = new_entity(frame, id, type);
+ /* TODO:
+ * we could do some optimisations here and create a big union type for all
+ * different call types in a function */
+ return entity;
+}
+
+static void fix_compound_params(cl_entry *entry, ir_type *ctp)
+{
+ ir_node *call = entry->call;
+ dbg_info *dbgi = get_irn_dbg_info(call);
+ ir_node *mem = get_Call_mem(call);
+ ir_graph *irg = get_irn_irg(call);
+ ir_node *nomem = new_r_NoMem(irg);
+ ir_node *frame = get_irg_frame(irg);
+ size_t n_params = get_method_n_params(ctp);
+ size_t i;
+
+ for (i = 0; i < n_params; ++i) {
+ ir_type *type = get_method_param_type(ctp, i);
+ ir_node *block;
+ ir_node *arg;
+ ir_node *sel;
+ ir_node *copyb;
+ ir_entity *arg_entity;
+ if (!is_compound_type(type))
+ continue;