Permalink
Browse files

more conversions.

  • Loading branch information...
1 parent fcc57a8 commit ccbc98b69466e9ff66506445dd34c0b846124a16 @kjs kjs committed Jun 23, 2012
Showing with 32 additions and 2 deletions.
  1. +32 −2 src/gencode.c
View
@@ -1576,43 +1576,66 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
/* init_cf_copy: */
- m1_reg temp = alloc_reg(comp, VAL_INT);
+ m1_reg temp = alloc_reg(comp, VAL_INT);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, INTERP);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, INTERP);
fprintf(OUT, "\tset_imm I%d, 0, INTERP\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, INTERP\n", cf_reg.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, CHUNK);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, CHUNK);
fprintf(OUT, "\tset_imm I%d, 0, CHUNK\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, CHUNK\n", cf_reg.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, CONSTS);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, CONSTS);
fprintf(OUT, "\tset_imm I%d, 0, CONSTS\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, CONSTS\n", cf_reg.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, MDS);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, MDS);
fprintf(OUT, "\tset_imm I%d, 0, MDS\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, MDS\n", cf_reg.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, BCS);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, BCS);
fprintf(OUT, "\tset_imm I%d, 0, BCS\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, BCS\n", cf_reg.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, PCF);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, PCF);
fprintf(OUT, "\tset_imm I%d, 0, PCF\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, CF\n", cf_reg.no, temp.no);
-
+
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, CF);
+ INS (M0_SET_REF, "%P, %I, %d", cf_reg.no, temp.no, CF);
fprintf(OUT, "\tset_imm I%d, 0, CF\n", temp.no);
fprintf(OUT, "\tset_ref P%d, I%d, P%d\n", cf_reg.no, temp.no, cf_reg.no);
/* init_cf_zero: */
m1_reg temp2 = alloc_reg(comp, VAL_INT);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, 0);
+ INS (M0_SET_IMM, "%I, %d, %d", temp2.no, 0, EH);
+ INS (M0_SET_REF, "%P, %I, %I", cf_reg.no, temp2.no, temp.no);
fprintf(OUT, "\tset_imm I%d, 0, 0\n", temp.no);
fprintf(OUT, "\tset_imm I%d, 0, EH\n", temp2.no);
fprintf(OUT, "\tset_ref P%d, I%d, I%d\n", cf_reg.no, temp2.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp2.no, 0, RETPC);
+ INS (M0_SET_REF, "%P, %I, %I", cf_reg.no, temp2.no, temp.no);
fprintf(OUT, "\tset_imm I%d, 0, RETPC\n", temp2.no);
fprintf(OUT, "\tset_ref P%d, I%d, I%d\n", cf_reg.no, temp2.no, temp.no);
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, SPILLCF);
+ INS (M0_SET_REF, "%P, %I, %I", cf_reg.no, temp2.no, temp.no);
fprintf(OUT, "\tset_imm I%d, 0, SPILLCF\n", temp2.no);
fprintf(OUT, "\tset_ref P%d, I%d, I%d\n", cf_reg.no, temp2.no, temp.no);
free_reg(comp, temp2);
/* init_cf_retpc: */
+ INS (M0_SET_IMM, "%I, %d, %d", temp.no, 0, 10);
+ INS (M0_ADD_I, "%d, %d, %I", RETPC, PC, temp.no);
fprintf(OUT, "\tset_imm I%d, 0, 10\n", temp.no);
fprintf(OUT, "\tadd_i RETPC, PC, I%d\n", temp.no);
@@ -1622,6 +1645,10 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
pc_reg = alloc_reg(comp, VAL_INT);
/* init_cf_pc */
+ INS (M0_SET_IMM, "%I, %d, %d", cont_offset.no, 0, 3);
+ INS (M0_ADD_I, "%I, %I, %d", cont_offset.no, cont_offset.no, PC);
+ INS (M0_SET_IMM, "%I, %d, %d", pc_reg.no, 0, PC);
+ INS (M0_SET_REF, "%P, %I, %I", cf_reg.no, pc_reg.no, cont_offset.no);
fprintf(OUT, "\tset_imm I%d, 0, 3\n", cont_offset.no);
fprintf(OUT, "\tadd_i I%d, I%d, PC\n", cont_offset.no, cont_offset.no);
fprintf(OUT, "\tset_imm I%d, 0, PC\n", pc_reg.no);
@@ -1630,6 +1657,7 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
free_reg(comp, cont_offset);
free_reg(comp, pc_reg);
+ INS (M0_SET, "%d, %P", CF, cf_reg.no);
fprintf(OUT, "\tset CF, P%d, x\n", cf_reg.no);
@@ -1643,6 +1671,8 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
*/
int calledfun_index = funcall->constindex;
+ INS (M0_SET_IMM, "%P, %d, %d", cf_reg.no, 0, calledfun_index);
+ INS (M0_DEREF, "%P, %d, %P", cf_reg.no, CONSTS, cf_reg.no);
fprintf(OUT, "\tset_imm P%d, 0, %d\n", cf_reg.no, calledfun_index);
fprintf(OUT, "\tderef P%d, CONSTS, P%d\n", cf_reg.no, cf_reg.no);

0 comments on commit ccbc98b

Please sign in to comment.