Mercurial > hg > CbC > old > device
changeset 578:dbde3b869a0f
try to remove code_fix_frame_pointer(); PowerPC fixed.
author | kono |
---|---|
date | Sun, 15 Jan 2006 19:28:50 +0900 |
parents | 7e0076617c76 |
children | 74bea4129e15 |
files | Changes mc-code-arm.c mc-code-ia32.c mc-code-mips.c mc-code-powerpc.c mc-codegen.c |
diffstat | 6 files changed, 74 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sun Jan 15 18:28:39 2006 +0900 +++ b/Changes Sun Jan 15 19:28:50 2006 +0900 @@ -8365,6 +8365,10 @@ pointer から計算すれば良いらしい。どうして、R1SAVE することにしたのかは不明。 +function has return value but reached to the end +なんだけど、reachability のcheckが while(1) の +時とかやってないので、結構、うるさい。 + Sun Jan 15 16:06:29 JST 2006 code_fix_frame_pointer って何をやっているのだろう? @@ -8374,5 +8378,15 @@ でさ、env をさっさと計算して get_register_var に入れてしまう のが良いと思う。で、INDIRECT+offset にして代入すれば良い。 - - +PowerPC, IA32 では、disp_offset ==0 には、原理的に出来ない。 +互換性の問題だから。code_segment の code_disp_offset を disp_offset +に合わせることは出来るはず。そうすれば、mc-codegen の方で +disp_offset を見ることはないんじゃないの? + +そもそも、そうでないと parallel assignment がうまく動かない +はずだよね。 + + + + +
--- a/mc-code-arm.c Sun Jan 15 18:28:39 2006 +0900 +++ b/mc-code-arm.c Sun Jan 15 19:28:50 2006 +0900 @@ -2725,6 +2725,11 @@ #endif } +int +code_frame_pointer_register() +{ + return list2(REGISTER,REG_fp); +} void code_fix_frame_pointer(int offset) {
--- a/mc-code-ia32.c Sun Jan 15 18:28:39 2006 +0900 +++ b/mc-code-ia32.c Sun Jan 15 19:28:50 2006 +0900 @@ -283,6 +283,7 @@ #define is_int_reg(reg) (reg<REG_EBP) #define REG_LCREG 8 #define REG_L 9 +#define REG_fp REG_EBP #define regv_l(r) (virtual(r==REG_L?REG_ESI:REG_EAX)) #define regv_h(r) (virtual(r==REG_L?REG_EDI:REG_EDX)) @@ -1501,6 +1502,11 @@ printf("\tmovl %s,%%ebp\n",register_name(e3,0)); } +int +code_frame_pointer_register() +{ + return list2(REGISTER,virtual(REG_fp)); +} void code_fix_frame_pointer(int disp_offset) {
--- a/mc-code-mips.c Sun Jan 15 18:28:39 2006 +0900 +++ b/mc-code-mips.c Sun Jan 15 19:28:50 2006 +0900 @@ -370,15 +370,14 @@ #define arg_offset 8 #define arg_offset1 0 int disp_offset = 0; -#define disp_offset 0 +#define disp_offset0 0 #define func_disp_offset 8 -#define code_disp_offset 0 -#define jump_offset 0 - -#define CODE_LVAR(l) ((l)+code_disp_offset) +#define code_disp_offset0 0 + +#define CODE_LVAR(l) ((l)+code_disp_offset0) #define CODE_CALLER_ARG(l) ((l)+arg_offset1) -#define FUNC_LVAR(l) (l+disp_offset) +#define FUNC_LVAR(l) (l+disp_offset0) #define CALLER_ARG(l) ((l)+arg_offset1) #define CALLEE_ARG(l) ((l)+arg_offset1) @@ -2294,6 +2293,11 @@ #endif } +int +code_frame_pointer_register() +{ + return list2(REGISTER,REG_fp); +} void code_fix_frame_pointer(int offset) {
--- a/mc-code-powerpc.c Sun Jan 15 18:28:39 2006 +0900 +++ b/mc-code-powerpc.c Sun Jan 15 19:28:50 2006 +0900 @@ -297,20 +297,18 @@ *SIZE_OF_INT *SIZE_OF_INT */ -static int arg_offset = 24; -static int arg_offset1 = 24; +#define arg_offset 24 +#define arg_offset1 24 int disp_offset = -12; -// #define func_disp_offset 60 + #define func_disp_offset 68 -#define r1_offset func_disp_offset+12 -static int code_disp_offset = 0; -// static int jump_offset = 0; - -#define CODE_LVAR l+code_disp_offset -#define CODE_CALLER_ARG (l-ARG_LVAR_OFFSET)+arg_offset1 -#define FUNC_LVAR l+disp_offset -#define CALLER_ARG (l-ARG_LVAR_OFFSET)+arg_offset1 -#define CALLEE_ARG l+arg_offset +#define code_disp_offset0 (-12) + +#define CODE_LVAR(l) ((l)+code_disp_offset0) +#define CODE_CALLER_ARG(l) ((l)+arg_offset1) +#define FUNC_LVAR(l) ((l)+disp_offset) +#define CALLER_ARG(l) ((l)+arg_offset1) +#define CALLEE_ARG(l) ((l)+arg_offset) void code_offset_set() @@ -319,7 +317,6 @@ int l; #endif int lvar_offsetv = -disp+max_func_args*SIZE_OF_INT+func_disp_offset; - // int r1_offsetv = -disp+max_func_args*SIZE_OF_INT-reg_save+r1_offset; int r1_offsetv = lvar_offsetv-reg_save+12; printf(".set L_%d,%d\n",lvar_offset_label,r1_offsetv-lvar_offsetv); if (r1_offsetv-lvar_offsetv > 65000) error(-1); @@ -360,29 +357,29 @@ if (!large_offset_reg) { if (is_code(fnptr)) { if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - printf("lo16(%d)(r1)\n",CODE_CALLER_ARG); + printf("lo16(%d)(r1)\n",CODE_CALLER_ARG(l-ARG_LVAR_OFFSET)); } else - printf("lo16(%d)(r30)\n",CODE_LVAR); + printf("lo16(%d)(r30)\n",CODE_LVAR(l)); } else if (l<0) { /* local variable */ - printf("lo16(%d)(r30)\n",FUNC_LVAR); + printf("lo16(%d)(r30)\n",FUNC_LVAR(l)); } else if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - printf("lo16(%d)(r1)\n",CALLER_ARG); + printf("lo16(%d)(r1)\n",CALLER_ARG(l-ARG_LVAR_OFFSET)); } else { /* callee's arguments */ - printf("lo16(%d+L_%d)(r30)\n",CALLEE_ARG,lvar_offset_label); + printf("lo16(%d+L_%d)(r30)\n",CALLEE_ARG(l),lvar_offset_label); } } else { rn = register_name(large_offset_reg); if (is_code(fnptr)) { if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - printf("lo16(%d)(%s)\n",CODE_CALLER_ARG,rn); + printf("lo16(%d)(%s)\n",CODE_CALLER_ARG(l-ARG_LVAR_OFFSET),rn); } else - printf("lo16(%d)(%s)\n",CODE_LVAR,rn); + printf("lo16(%d)(%s)\n",CODE_LVAR(l),rn); } else if (l<0) { /* local variable */ - printf("lo16(%d)(%s)\n",FUNC_LVAR,rn); + printf("lo16(%d)(%s)\n",FUNC_LVAR(l),rn); } else if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - printf("lo16(%d)(%s)\n",CALLER_ARG,rn); + printf("lo16(%d)(%s)\n",CALLER_ARG(l-ARG_LVAR_OFFSET),rn); } else { /* callee's arguments */ - printf("lo16(%d+L_%d)(%s)\n",CALLEE_ARG,lvar_offset_label,rn); + printf("lo16(%d+L_%d)(%s)\n",CALLEE_ARG(l),lvar_offset_label,rn); } free_register(large_offset_reg); } @@ -404,31 +401,32 @@ large_offset_reg=0; if (is_code(fnptr)) { if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - if (LARGE_OFFSET(CODE_CALLER_ARG)) { + if (LARGE_OFFSET(CODE_CALLER_ARG(l-ARG_LVAR_OFFSET))) { rn=register_name(large_offset_reg=get_register()); - printf("\taddis %s,r1,ha16(%d)\n",rn,CODE_CALLER_ARG); + printf("\taddis %s,r1,ha16(%d)\n",rn, + CODE_CALLER_ARG(l-ARG_LVAR_OFFSET)); } } else { - if (LARGE_OFFSET(CODE_LVAR)) { + if (LARGE_OFFSET(CODE_LVAR(l))) { rn=register_name(large_offset_reg=get_register()); - printf("\taddis %s,r30,ha16(%d)\n",rn,CODE_LVAR); + printf("\taddis %s,r30,ha16(%d)\n",rn,CODE_LVAR(l)); } } } else if (l<0) { /* local variable */ - if (LARGE_OFFSET(FUNC_LVAR)) { + if (LARGE_OFFSET(FUNC_LVAR(l))) { rn=register_name(large_offset_reg=get_register()); - printf("\taddis %s,r30,ha16(%d)\n",rn,FUNC_LVAR); + printf("\taddis %s,r30,ha16(%d)\n",rn,FUNC_LVAR(l)); } } else if (l>=ARG_LVAR_OFFSET) { /* caller's arguments */ - if (LARGE_OFFSET(CALLER_ARG)) { + if (LARGE_OFFSET(CALLER_ARG(l-ARG_LVAR_OFFSET))) { rn=register_name(large_offset_reg=get_register()); - printf("\taddis %s,r1,ha16(%d)\n",rn,CALLER_ARG); + printf("\taddis %s,r1,ha16(%d)\n",rn,CALLER_ARG(l-ARG_LVAR_OFFSET)); } } else { /* callee's arguments */ - if (LARGE_OFFSET(CALLEE_ARG)) { + if (LARGE_OFFSET(CALLEE_ARG(l))) { rn=register_name(large_offset_reg=get_register()); printf("\taddis %s,r30,lo16(%d+L_%d)\n", - rn,CALLEE_ARG,lvar_offset_label); + rn,CALLEE_ARG(l),lvar_offset_label); } } } @@ -1862,11 +1860,7 @@ return !contains_p(e3,not_simple_p); } -int -caller_arg_offset_v(int arg) -{ - return ARG_LVAR_OFFSET+arg*SIZE_OF_INT; -} +#define caller_arg_offset_v(arg) (ARG_LVAR_OFFSET+(arg)*SIZE_OF_INT) void use_input_reg(int reg,int mode) @@ -2285,9 +2279,10 @@ void code_fix_frame_pointer(int disp_offset) { - int l = 0; +#if 0 printf("\tla r30,"); - printf("lo16(%d)(r30)\n",FUNC_LVAR); + printf("lo16(%d)(r30)\n",FUNC_LVAR(0)-CODE_LVAR(0)); +#endif } void @@ -2817,7 +2812,7 @@ { int r1_offsetv; disp&= -SIZE_OF_INT; - r1_offsetv = -disp+max_func_args*SIZE_OF_INT +code_disp_offset +8+32; + r1_offsetv = -disp+max_func_args*SIZE_OF_INT -code_disp_offset0 +8+32; printf(".set L_%d,%d\n",code_disp_label,-r1_offsetv); if (max_func_arg_label) {