Mercurial > hg > CbC > old > device
diff mc-code-powerpc.c @ 195:c193120ee2a6
*** empty log message ***
author | kono |
---|---|
date | Sun, 04 Apr 2004 21:17:10 +0900 |
parents | f53d70110377 |
children | 5f70abd9453d |
line wrap: on
line diff
--- a/mc-code-powerpc.c Sat Jan 10 17:13:49 2004 +0900 +++ b/mc-code-powerpc.c Sun Apr 04 21:17:10 2004 +0900 @@ -129,6 +129,12 @@ return i; } +int use_longlong(int i) { + return i; +} + + +#if FLOAT_CODE static NMTBL float_zero = {"_float_zero",STATIC,FLOAT,0}; static @@ -138,11 +144,14 @@ static char * fload(int d); static int code_d1(double d); static int code_d2(double d); +#endif + static void code_save_stacks(); static void code_save_input_registers(); static void clear_ptr_cache_reg(int r); static void set_creg(int,int); static void set_freg(int,int); +static void set_lreg(int,int); static int max_func_args; static int my_func_args; @@ -431,6 +440,7 @@ return reg_stack[--reg_sp]; } +#if FLOAT_CODE int get_dregister(int d) { /* 使われていないレジスタを調べる */ @@ -467,6 +477,15 @@ { /* レジスタから値を取り出す */ return freg_stack[--freg_sp]; } +#endif + +#if LONGLONG_CODE +int +get_lregister_var(NMTBL *n) +{ + return -1; +} +#endif void emit_pop_free(int xreg) @@ -555,10 +574,12 @@ int i; for(i=0;i<MAX_REGISTER;i++) { regs[i]=0; regv[i]=0; } for(i=0;i<MAX_FREGISTER;i++) { regs[i+FREG_OFFSET]=0; regv[i+FREG_OFFSET]=0; } - creg = get_register(); +#if FLOAT_CODE freg = get_dregister(1); + set_freg(FREG_FREGISTER,0); +#endif + ireg = creg = get_register(); set_creg(CREG_REGISTER,0); - set_freg(FREG_FREGISTER,0); return; } @@ -1245,6 +1266,8 @@ creg = ireg = reg; regs[creg]=1; } + if (ireg!=creg) error(-1); + ireg = reg; } void @@ -1258,6 +1281,13 @@ creg = freg = reg; regs[freg]=1; } + if (freg!=creg) error(-1); + freg = reg; +} + +void +set_lreg(int reg,int mode) +{ } void @@ -1545,12 +1575,14 @@ g_expr(e2); crn=register_name(creg); switch (car(e1)) { +#if FLOAT_CODE case FRINDIRECT: case DRINDIRECT: printf("\t%s %s,%d(%s)\n",fload(car(e1)==DRINDIRECT), fregister_name(freg),offset,crn); regv[creg]=0; regv[freg]=1; creg = freg; return DOUBLE; +#endif case CRINDIRECT: printf("\tlbz %s,%d(%s)\n",crn,offset,crn); printf("\textsb %s,%s\n",crn,crn); @@ -2056,6 +2088,8 @@ code_set_fixed_creg(int reg,int mode,int type) { if (type==FLOAT||type==DOUBLE) { set_freg(reg,mode); + } else if (type==LONGLONG) { + set_lreg(reg,mode); } else { set_creg(reg,mode); } @@ -2084,8 +2118,10 @@ emit_data(int e, int t, NMTBL *n) { int l; +#if FLOAT_CODE double d; float f; +#endif char *name; name = n->nm; if(mode!=GDECL && mode!=STADECL) { @@ -2115,12 +2151,16 @@ printf("\t.long %d\n",cadr(e)); gpc += size_of_int; } +#if LONGLONG_CODE +#endif +#if FLOAT_CODE } else if(t==DOUBLE) { d = dcadr(e); printf("\t.long\t0x%x,0x%x\n",code_d2(d),code_d1(d)); } else if(t==FLOAT) { f = dcadr(e); printf("\t.long\t0x%x\n",*(int *)&f); +#endif } else if(t!=CHAR) { gpc += size_of_int; if(car(e)==ADDRESS&&car(cadr(e))==GVAR) { @@ -2282,6 +2322,8 @@ */ } +#if FLOAT_CODE + /* floating point */ static int float_one_lib_used=0; @@ -2307,8 +2349,6 @@ 0 }; - - char * fstore(int d) { @@ -2823,6 +2863,214 @@ regv[freg]=1; } +#endif + +#if LONGLONG_CODE + + +/* 64bit int part */ + +void lrexpr(int e1, int e2,int l1, int op) +{ +} + +int lpop_register() +{ + return 0; +} + +int emit_lpop() +{ + return 0; +} + +void code_lregister(int e2,int reg) +{ + +} + +void code_cmp_lregister(int reg) +{ + +} + +void code_cmp_lrgvar(int e1,int e2) +{ + +} + +void code_cmp_lrlvar(int e1,int e2) +{ + +} + +void code_lassign(int e1,int e2) +{ + +} + +void code_lassign_gvar(int e1,int e2) +{ + +} + +void code_lassign_lvar(int e1,int e2) +{ + +} + +void code_lassign_lregister(int e2,int reg) +{ + +} + +void code_lconst(int e1,int e2) +{ + +} + +void code_lneg(int e1,int e2) +{ + +} + +void code_lrgvar(int e1,int e2) +{ + +} + +void code_lrlvar(int e1,int e2) +{ + +} + +void ltosop(int e1,int e2) +{ + +} + +void emit_lpop_free(int e1) +{ + +} + +void emit_lpush() +{ + +} + +void code_i2ll(int creg) +{ + +} + +void code_i2ull(int creg) +{ + +} + +void code_u2ll(int creg) +{ + +} + +void code_u2ull(int creg) +{ + +} + +void code_ll2i(int creg) +{ + +} + +void code_ll2u(int creg) +{ + +} + +void code_ull2i(int creg) +{ + +} + +void code_ull2u(int creg) +{ + +} + +#if FLOAT_CODE +void code_d2ll(int creg) +{ + +} + +void code_d2ull(int creg) +{ + +} + +void code_f2ll(int creg) +{ + +} + +void code_f2ull(int creg) +{ + +} + +void code_ll2d(int creg) +{ + +} + +void code_ll2f(int creg) +{ + +} + +void code_ull2d(int creg) +{ + +} + +void code_ull2f(int creg) +{ + +} + +void code_ull2ll(int creg) +{ + +} + +void code_ull2ull(int creg) +{ + +} + +#endif + + +void code_lpreinc(int e1,int e2,int reg) +{ + +} + +void code_lpostinc(int e1,int e2,int reg) +{ + +} + +void code_lassop(int op) +{ + +} + + +#endif + void code_save_stacks() { @@ -2834,6 +3082,7 @@ reg_stack[i]= reg_stack[i]-REG_LVAR_OFFSET; } } +#if FLOAT_CODE for(i=0;i<freg_sp;i++) { if ((reg=freg_stack[i])>=0) { code_dassign_lvar( @@ -2841,6 +3090,7 @@ freg_stack[i]= freg_stack[i]-REG_LVAR_OFFSET; } } +#endif } void @@ -2854,11 +3104,13 @@ void code_closing() { +#if FLOAT_CODE if (d2u_lib_used) emit_lib(d2u_lib); if (u2d_lib_used) emit_lib(u2d_lib); if (float_one_lib_used) emit_lib(float_one_lib); if (float_zero_lib_used) emit_lib(float_zero_lib); if (i2d_lib_used) emit_lib(i2d_lib); +#endif global_table(); /* printf("\t.ident \"Micro-C compiled\"\n"); */ }