Mercurial > hg > CbC > old > device
changeset 743:78f57ff5c86e
i64 basic.c code generation (not yet compiled)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Nov 2010 13:26:13 +0900 |
parents | bdae6a221174 |
children | c9d4390b2b4e |
files | mc-code-i64.c |
diffstat | 1 files changed, 17 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-i64.c Tue Nov 09 22:19:02 2010 +0900 +++ b/mc-code-i64.c Fri Nov 12 13:26:13 2010 +0900 @@ -362,14 +362,14 @@ #define FREG_OFFSET 18 -#define REG_ESP 1 -#define REG_EBP 2 -#define REG_EDI 3 // first argument register -#define REG_ESI 4 -#define REG_EDX 5 -#define REG_ECX 6 // for strange reason (code_assop) -#define REG_EAX 7 -#define REG_EBX 8 +#define REG_ESP 0 +#define REG_EBP 1 +#define REG_EDI 2 // first argument register +#define REG_ESI 3 +#define REG_EDX 4 +#define REG_ECX 5 // for strange reason (code_assop) +#define REG_EAX 6 +#define REG_EBX 7 #define is_int_reg(reg) (1<=reg&®<MAX_REGISTER) #define is_float_reg(reg) (RET_FREGISTER<=reg&®<FREG_OFFSET+REAL_MAX_DREGISTER) @@ -387,7 +387,6 @@ 0, 0, 0, - 0, "%cl", "%dl", "%r8b", @@ -401,7 +400,7 @@ "%r14b", "%r15b", "%r16b"}; -static char *reg_name_w[] = {0, +static char *reg_name_w[] = { "%sp", "%bp", "%di", @@ -420,7 +419,7 @@ "%r15w", "%r16w"}; -static char *reg_name[] = {0, +static char *reg_name[] = { "%esp", "%ebp", "%edi", @@ -445,7 +444,7 @@ #define FREG_VAR_BASE (RET_FREGISTER+16) #define FREG_VAR_MIN (RET_FREGISTER+16-MAX_DREGISTER_VAR) -static char *reg_name_q[] = {0, +static char *reg_name_q[] = { "%rsp", "%rbp", "%rdi", @@ -465,7 +464,8 @@ "%r16", }; -static char *reg_name_d[] = {0, "%xmm0", // 18 +static char *reg_name_d[] = { + "%xmm0", // 18 "%xmm1", "%xmm2", "%xmm3", @@ -694,7 +694,7 @@ return i; } -#define fregister_name(reg) reg_name_d[reg-FREG_OFFSET] +#define fregister_name(reg) reg_name_d[(reg)-FREG_OFFSET] static void set_freg(int reg,int mode) @@ -872,8 +872,8 @@ get_data_register(void) { /* 使われていないレジスタを調べる */ int i,reg,j; - for(i=1;is_data_reg(i) && i<MAX_REGISTER+1;i++) { - if (! regs[i]) { /* 使われていないなら */ + for(i=1; i<MAX_REGISTER+1;i++) { + if (is_data_reg(i) && ! regs[i]) { /* 使われていないなら */ regs[i]=1; /* そのレジスタを使うことを宣言し */ return i; /* その場所を表す番号を返す */ } @@ -3651,7 +3651,7 @@ r = get_ptr_cache(one); drn=register_name(r,0); grn=fregister_name(g=get_dregister(d)); - printf("\tmovs%s 0(%s),%s\n",d?"d":"s",grn,drn); + printf("\tmovs%s 0(%s),%s\n",d?"d":"s",drn,grn); return g; }