- my_assert_not(pp, NULL);
- fprintf(fout, " %s (", pp->ret_type.name);
- if (pp->is_stdcall && pp->argc_reg == 0)
- fprintf(fout, "__stdcall ");
- fprintf(fout, "*icall%d)(", i);
- for (j = 0; j < pp->argc; j++) {
- if (j > 0)
- fprintf(fout, ", ");
- fprintf(fout, "%s a%d", pp->arg[j].type.name, j + 1);
+ if (pp == NULL)
+ ferr(po, "NULL pp\n");
+
+ if (pp->is_unresolved) {
+ int regmask_push = 0;
+ collect_call_args(po, i, pp, ®mask_push, &save_arg_vars,
+ i + opcnt * 2);
+
+ if (!((regmask_push & (1 << xCX))
+ && (regmask_push & (1 << xDX))))
+ {
+ if (pp->argc_stack != 0
+ || ((regmask | regmask_arg) & (1 << xCX)))
+ {
+ pp_insert_reg_arg(pp, "ecx");
+ regmask |= 1 << xCX;
+ }
+ if (pp->argc_stack != 0
+ || ((regmask | regmask_arg) & (1 << xDX)))
+ {
+ pp_insert_reg_arg(pp, "edx");
+ regmask |= 1 << xDX;
+ }
+ }
+ regmask |= regmask_push;
+ }
+
+ if (pp->is_fptr) {
+ fprintf(fout, " %s (", pp->ret_type.name);
+ if (pp->is_stdcall && pp->argc_reg == 0)
+ fprintf(fout, "__stdcall ");
+ fprintf(fout, "*icall%d)(", i);
+ for (j = 0; j < pp->argc; j++) {
+ if (j > 0)
+ fprintf(fout, ", ");
+ fprintf(fout, "%s a%d", pp->arg[j].type.name, j + 1);
+ }
+ fprintf(fout, ");\n");