Mercurial > hg > CbC > old > device
changeset 732:7a4f389b5bc0
i64 continue...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 04 Nov 2010 21:10:20 +0900 |
parents | 1f6e34c4dbbf |
children | 116d4701d097 |
files | mc-code-i64.c |
diffstat | 1 files changed, 109 insertions(+), 40 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-i64.c Fri Oct 29 16:14:00 2010 +0900 +++ b/mc-code-i64.c Thu Nov 04 21:10:20 2010 +0900 @@ -258,21 +258,15 @@ extern int lp64; -#define regv_l(r) (r==REG_L?REG_ESI:REG_EAX) -#define regv_h(r) (r==REG_L?REG_EDI:REG_EDX) - int code_lassop_p = 0; #define MAX_REGISTER 14 /* intel386のレジスタを6つまで使う*/ #define REAL_MAX_REGISTER 16 /* intel386のレジスタが8つということ*/ -static int MAX_DATA_REG=8; -static int MAX_POINTER=8; int MAX_REGISTER_VAR=8; -// static int MAX_FREGISTER=1; - -#define MAX_FPU_STACK 7 - -// static int MAX_INPUT_REGISTER_VAR = 0; +static int MAX_DREGISTER=16; +int MAX_DREGISTER_VAR=8; + +static int MAX_INPUT_REGISTER_VAR = 6; int MAX_CODE_INPUT_REGISTER_VAR = 6; static int MAX_INPUT_DREGISTER_VAR = 6; // static int MAX_INPUT_FREGISTER_VAR = 0; @@ -293,12 +287,13 @@ /* local2 -8 local1 <-- -6 0 local variable - %edi -12 <- disp_offset %ebp - %esi -8 - %ebx -4 + -12 <- disp_offset %ebp + -8 + -4 %ebp = %esp 0 %eip 4 <- arg_offset - arg7 8 + arg8 8 + arg7 16 %r9d arg6 %r8d arg5 %ecx arg4 @@ -328,12 +323,12 @@ */ #define REAL_MAX_LREGISTER 2 -static int ia32regs[1+REAL_MAX_REGISTER+REAL_MAX_LREGISTER]; +static int ia32regs[1+REAL_MAX_REGISTER]; static int *regs = ia32regs; -static int ia32fregs[1]; +static int ia32fregs[1+MAX_DREGISTER]; static int *fregs = ia32fregs; static int freg; @@ -356,18 +351,108 @@ #define is_int_reg(reg) 1 // (1<=reg&®<REG_EBP) // return value register -#define RET_FREGISTER -#define RET_DREGISTER -#define RET_LREGISTER REG_LCREG +#define RET_FREGISTER 1 +#define RET_DREGISTER 1 +#define RET_LREGISTER REG_EAX #define RET_REGISTER REG_EAX // defalut current register #define CREG_REGISTER REG_ECX -#define FREG_FREGISTER 0 - -static char *reg_name[8+1]; -static char *reg_name_l[4+1]; -static char *reg_name_w[4+1]; +#define FREG_FREGISTER 2 + +static char *reg_name_l[] = {0, + 0, + 0, + 0, + 0, + "%cl", + "%dl", + "%r8b", + "%r9b", + "%al", + "%bl", + "%r10b", + "%r11b", + "%r12b", + "%r13b", + "%r14b", + "%r15b", + "%r16b"}; +static char *reg_name_w[] = {0, + "%sp", + "%bp", + "%di", + "%si", + "%cx", + "%dx", + "%r8w", + "%r9w", + "%ax", + "%bx", + "%r10w", + "%r11w", + "%r12w", + "%r13w", + "%r14w", + "%r15w", + "%r16w"}; + +static char *reg_name[] = {0, + "%esp", + "%ebp", + "%edi", + "%esi", + "%ecx", + "%edx", + "%r8d", + "%r9d", + "%eax", + "%ebx", + "%r10d", + "%r11d", + "%r12d", + "%r13d", + "%r14d", + "%r15d", + "%r16d"}; + +static char *reg_name_q[] = {0, + "%rsp", + "%rbp", + "%rdi", + "%rsi", + "%rcx", + "%rdx", + "%r8", + "%r9", + "%rax", + "%rbx", + "%r10", + "%r11", + "%r12", + "%r13", + "%r14", + "%r15", + "%r16"}; + +static char *reg_name_q[16+1] = {0, + "%xmm0", + "%xmm1", + "%xmm2", + "%xmm3", + "%xmm4", + "%xmm5", + "%xmm6", + "%xmm7", + "%xmm8", + "%xmm9", + "%xmm10", + "%xmm11", + "%xmm12", + "%xmm13", + "%xmm14", + "%xmm15", + "%xmm16"}; static void ascii(char *s); @@ -670,22 +755,6 @@ MAX_POINTER=3; MAX_REGISTER_VAR=2; - reg_name[REG_EAX] = "%eax"; - reg_name[REG_EBX] = "%ebx"; - reg_name[REG_ECX] = "%ecx"; - reg_name[REG_EDX] = "%edx"; - reg_name[REG_ESI] = "%esi"; - reg_name[REG_EDI] = "%edi"; - reg_name[REG_EBP] = "%ebp"; - reg_name[REG_ESP] = "%esp"; - reg_name_l[REG_EAX] = "%al"; - reg_name_l[REG_EBX] = "%bl"; - reg_name_l[REG_ECX] = "%cl"; - reg_name_l[REG_EDX] = "%dl"; - reg_name_w[REG_EAX] = "%ax"; - reg_name_w[REG_EBX] = "%bx"; - reg_name_w[REG_ECX] = "%cx"; - reg_name_w[REG_EDX] = "%dx"; }