@@ -1095,6 +1095,22 @@ gencode_funcall(M1_compiler *comp, m1_funcall *f) {
10951095 fprintf (OUT , "\tset_imm I%d, 0, 0\n" , flagsreg .no );
10961096 fprintf (OUT , "\tgc_alloc P%d, I%d, I%d\n" , cf_reg .no , sizereg .no , flagsreg .no );
10971097
1098+ /* store arguments in registers of new callframe.
1099+ XXX this still needs to be specced for M0's calling conventions. */
1100+
1101+ m1_expression * argiter = f -> arguments ;
1102+ int regindex = 12 ; /* points to I0. XXX */
1103+ while (argiter != NULL ) {
1104+ m1_reg argreg ;
1105+ m1_reg indexreg = gen_reg (comp , VAL_INT );
1106+ gencode_expr (comp , argiter );
1107+ argreg = popreg (comp -> regstack );
1108+ fprintf (OUT , "\tset_imm I%d, 0, %d\n" , indexreg .no , regindex );
1109+ fprintf (OUT , "\tset_ref P%d, I%d, I%d\n" , cf_reg .no , indexreg .no , argreg .no );
1110+ regindex ++ ;
1111+ argiter = argiter -> next ;
1112+ }
1113+
10981114 /* init_cf_copy: */
10991115 m1_reg temp = gen_reg (comp , VAL_INT );
11001116 fprintf (OUT , "\tset_imm I%d, 0, INTERP\n" , temp .no );
0 commit comments