Mercurial > hg > CbC > old > device
changeset 144:56211702f298
creg/freg continue
author | kono |
---|---|
date | Wed, 21 May 2003 21:41:06 +0900 |
parents | 66ddda268ac5 |
children | fb61020a9b48 |
files | Changes mc-code-ia32.c mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h |
diffstat | 6 files changed, 37 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Tue May 20 11:19:01 2003 +0900 +++ b/Changes Wed May 21 21:41:06 2003 +0900 @@ -3010,3 +3010,7 @@ やっぱり(2)かなぁ。long long のことをとかを考えると。 でも、とりあえず(1)でやるか。 + +いずれにせよ、fregv を追放することからはじめるんじゃない? + +それはできました。
--- a/mc-code-ia32.c Tue May 20 11:19:01 2003 +0900 +++ b/mc-code-ia32.c Wed May 21 21:41:06 2003 +0900 @@ -1132,9 +1132,9 @@ code_assign(int e2,int byte,int creg) { if (byte) use_data_reg(creg,1); printf("\t%s %s,(%s)\n",move(byte),register_name(creg,byte),register_name(e2,0)); + regv[creg]=1; } - void code_register_assop(int e2,int op,int byte) { int reg; @@ -1143,6 +1143,7 @@ tosop(op,xreg); creg = xreg; printf("\tmovl %s,%s\n",register_name(reg,0),register_name(creg,0)); + regv[creg]=1; } @@ -1160,6 +1161,7 @@ printf("\t%s %s,(%s)\n",byte ? "movb" : "movl",register_name(creg,byte),register_name(edx,0)); edx_cleanup(); emit_pop_free(xreg); + regv[creg]=1; } @@ -1173,12 +1175,15 @@ case LSHIFT: case ULSHIFT: shift("sall",oreg); + regv[creg]=1; return; case RSHIFT: shift("sarl",oreg); + regv[creg]=1; return; case URSHIFT: shift("shrl",oreg); + regv[creg]=1; return; } if(oreg==-1) { @@ -1245,6 +1250,7 @@ if (oreg!=dreg&&oreg>=0) free_register(oreg); else if (oreg==dreg) regv[dreg]=0; + regv[creg]=1; } static int edx_stack=0;
--- a/mc-code-powerpc.c Tue May 20 11:19:01 2003 +0900 +++ b/mc-code-powerpc.c Wed May 21 21:41:06 2003 +0900 @@ -1637,6 +1637,7 @@ } else { printf("\tstw %s,0(%s)\n",crn,drn); } + regv[creg]=1; } @@ -1649,6 +1650,7 @@ creg = xreg; if (creg!=reg) printf("\tmr %s,%s\n",register_name(creg),register_name(reg)); + regv[creg]=1; } @@ -1672,6 +1674,7 @@ } free_register(edx); emit_pop_free(xreg); + regv[creg]=1; } @@ -1694,12 +1697,15 @@ case LSHIFT: case ULSHIFT: shift("slw",oreg); + regv[creg]=1; return; case RSHIFT: shift("srw",oreg); + regv[creg]=1; return; case URSHIFT: shift("sraw",oreg); + regv[creg]=1; return; } orn = register_name(oreg); @@ -1755,6 +1761,7 @@ error(-1); } if(oreg!=creg) free_register(oreg); + regv[creg]=1; } @@ -2628,6 +2635,7 @@ error(-1); return; } printf("\t%s %s,%s,%s\n",opn,frn,frn,grn); + fregv[freg]=1; free_dregister(e1); } @@ -2656,6 +2664,9 @@ r = get_ptr_cache(&float_one); float_one_lib_used=1; + if (car(e2)==DREGISTER||car(e2)==FREGISTER) { + error(-1); /* unspported now */ + } g_expr(e2); crn=register_name(creg); @@ -2684,6 +2695,9 @@ r = get_ptr_cache(&float_one); float_one_lib_used=1; + if (car(e2)==DREGISTER||car(e2)==FREGISTER) { + error(-1); /* unspported now */ + } g_expr(e2); crn=register_name(creg);
--- a/mc-code.h Tue May 20 11:19:01 2003 +0900 +++ b/mc-code.h Wed May 21 21:41:06 2003 +0900 @@ -2,6 +2,10 @@ mc-code-*.c have to provied these */ +#define MAX_MAX 50 +#define INPUT_REG 2 /* input register ( can be reused ) */ +#define USING_REG 1 /* unreusable register usage */ + extern int size_of_int; extern int size_of_float; extern int size_of_double;
--- a/mc-codegen.c Tue May 20 11:19:01 2003 +0900 +++ b/mc-codegen.c Wed May 21 21:41:06 2003 +0900 @@ -14,7 +14,6 @@ /* creg currrent virtual register freg current floating point register - fregv calue in floating point register */ static void remove0(int *parent,int e) ; @@ -896,7 +895,6 @@ g_expr(e2); tosop(car(e1),(e2=pop_register())); emit_pop_free(e2); - regv[creg]=1; return; } @@ -913,7 +911,6 @@ g_expr(e2); dtosop(car(e1),(e2=emit_dpop(d))); emit_dpop_free(e2,d); - fregv[freg]=1; return; } @@ -1023,7 +1020,6 @@ e2 = emit_pop(0); code_assign(e2,byte,creg); emit_pop_free(e2); - regv[creg]=1; return; } @@ -1126,13 +1122,11 @@ g_expr(e3); if (car(e2)==REGISTER) { code_register_assop(cadr(e2),op,byte); - regv[creg]=1; return; } emit_push(); g_expr(e2); code_assop(op,byte); - regv[creg]=1; return; } @@ -1151,8 +1145,12 @@ g_expr(e3); emit_dpush(d); g_expr(e2); + if (car(e2)==DREGISTER||car(e2)==FREGISTER) { + /* code_register_dassop(cadr(e2),op,d); */ + error(-1); /* unsupported now */ + return; + } code_dassop(op,d); - regv[creg]=1; return; }
--- a/mc-codegen.h Tue May 20 11:19:01 2003 +0900 +++ b/mc-codegen.h Wed May 21 21:41:06 2003 +0900 @@ -1,29 +1,9 @@ - -/* max stack in an expression (for each int, float ) */ -#define MAX_MAX 50 - -/* flag in regs/fregs */ - -#define INPUT_REG 2 /* input register ( can be reused ) */ -#define USING_REG 1 /* unreusable register usage */ - -extern int creg; /* current register */ -extern int reg_sp; /* REGister Stack-Pointer */ +/* for mc-codegen.c */ -extern int *regs; /* 使われているレジスタを示すフラグ */ -extern int *regv; /* 値が入っているかどうか */ -extern int reg_stack[MAX_MAX]; /* 実際のレジスタの領域 */ - -/* floating point registers */ - +extern int creg; /* current register */ extern int freg; /* current floating point register */ -extern int freg_sp; /* floating point REGister Stack-Pointer */ -extern int *fregs; /* 使われているレジスタを示すフラグ */ -extern int *fregv; /* 値が入っているかどうか */ -extern int freg_stack[MAX_MAX]; /* 実際のレジスタの領域 */ - -extern int use; /* generated value will be used in gexpr */ +extern int use; /* generated value will be used in gexpr */ /* function provided by mc-code-*.c */