Mercurial > hg > CbC > old > device
changeset 151:81032a1b8a5d
MIPS continue
author | kono |
---|---|
date | Mon, 14 Jul 2003 14:40:35 +0900 |
parents | f8271009a314 |
children | 17c6598617f8 |
files | Changes mc-code-mips.c mc-codegen.c |
diffstat | 3 files changed, 32 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Mon Jul 14 14:05:20 2003 +0900 +++ b/Changes Mon Jul 14 14:40:35 2003 +0900 @@ -3135,3 +3135,7 @@ ならないんだが、それを保証できない。 前と同じで、creg を廃止して、ireg/freg/dreg/lreg とするか? + +Mon Jul 14 14:25:23 JST 2003 + +なんか unsigned が通らなくなっているみたい。
--- a/mc-code-mips.c Mon Jul 14 14:05:20 2003 +0900 +++ b/mc-code-mips.c Mon Jul 14 14:40:35 2003 +0900 @@ -98,10 +98,10 @@ int powerpc_regs[REAL_MAX_REGISTER+REAL_MAX_FREGISTER+REAL_MAX_DREGISTER]; int powerpc_regv[REAL_MAX_REGISTER+REAL_MAX_FREGISTER+REAL_MAX_DREGISTER]; -unsigned char dreg_pair0[REAL_MAX_DREGISTER] = { +int dreg_pair0[REAL_MAX_DREGISTER] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 }; -unsigned char dreg_pair1[REAL_MAX_DREGISTER] = { +int dreg_pair1[REAL_MAX_DREGISTER] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }; @@ -140,7 +140,7 @@ } static char * -reg_name1(int i,unsigned char *d) +reg_name1(int i,int *d) { if (i<=REAL_MAX_REGISTER+REAL_MAX_FREGISTER) { error(-1); @@ -424,7 +424,7 @@ static int get_dregister1() { int i; - for(i=MAX_TMP_DREG;i>MIN_TMP_DREG;i--) { + for(i=MAX_TMP_DREG+DREG_OFFSET;i>MIN_TMP_DREG+DREG_OFFSET;i--) { if (regs[i]) continue; /* 使われている */ if (regs[dreg_pair0[i-DREG_OFFSET]]) continue; if (regs[dreg_pair1[i-DREG_OFFSET]]) continue; @@ -1630,14 +1630,14 @@ void code_assign_gvar(int e2,int creg,int byte) { - char *crn,*nm; + char *crn,*name; - nm = ((NMTBL*)cadr(e2))->nm; + name = ((NMTBL*)cadr(e2))->nm; crn=register_name(creg); if (byte) { - printf("\tsb %s,%s\n",crn,nm); + printf("\tsb %s,%s\n",crn,name); } else { - printf("\tsw %s,%s\n",crn,nm); + printf("\tsw %s,%s\n",crn,name); } } @@ -2505,12 +2505,12 @@ void code_drgvar(int e2,int d,int freg) { - char *nm = ((NMTBL*)cadr(e2))->nm; + char *name = ((NMTBL*)cadr(e2))->nm; if (d) { - printf("\tlw %s,%s\n",dregister_name0(freg),nm); - printf("\tlw %s,%s\n",dregister_name1(freg),nm); + printf("\tlw %s,%s\n",dregister_name0(freg),name); + printf("\tlw %s,%s\n",dregister_name1(freg),name); } else { - printf("\tl.s %s,%s\n",fregister_name(freg),nm); + printf("\tl.s %s,%s\n",fregister_name(freg),name); } regv[freg]=1; } @@ -2765,7 +2765,10 @@ int emit_dpop(int d) { int xreg,reg; - xreg=pop_fregister(); + if (d) + xreg=pop_dregister(); + else + xreg=pop_fregister(); if (xreg<= -REG_LVAR_OFFSET) { reg = get_dregister(d); code_drlvar(REG_LVAR_OFFSET+xreg,d,reg); @@ -2785,9 +2788,15 @@ int new_reg; if (freg_sp>MAX_MAX) error(-1); new_reg = get_dregister(d); - freg_stack[freg_sp++] = freg; /* push するかわりにレジスタを使う */ - creg = freg = new_reg; - regv[freg]=1; + if (d) { + dreg_stack[dreg_sp++] = dreg; /* push するかわりにレジスタを使う */ + creg = dreg = new_reg; + regv[dreg]=1; + } else { + freg_stack[freg_sp++] = freg; /* push するかわりにレジスタを使う */ + creg = freg = new_reg; + regv[freg]=1; + } } void
--- a/mc-codegen.c Mon Jul 14 14:05:20 2003 +0900 +++ b/mc-codegen.c Mon Jul 14 14:40:35 2003 +0900 @@ -1122,10 +1122,12 @@ switch(car(e2)) { case GVAR: g_expr(e4); + creg = d?use_double(creg):use_float(creg); code_dassign_gvar(e2,creg,d); return; case LVAR: g_expr(e4); + creg = d?use_double(creg):use_float(creg); code_dassign_lvar(cadr(e2),creg,d); return; case DREGISTER: @@ -1316,6 +1318,7 @@ case SASS: case ASS: case CASS: case FASS: case DASS: case LASS: case ASSOP: case CASSOP: case DASSOP: case FASSOP: case COMMA: case EQ: case NEQ: + case LAND: case LOR: case DOP+EQ: case DOP+NEQ: case FOP+EQ: case FOP+NEQ: case LT: case ULT: case LE: case ULE: