Mercurial > hg > CbC > old > device
changeset 396:bfeefa7f09f5
First binary run
author | kono |
---|---|
date | Wed, 13 Oct 2004 16:10:44 +0900 |
parents | f82993ed5ab9 |
children | 33a09aa401ba |
files | Changes mc-code-arm.c |
diffstat | 2 files changed, 31 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Tue Sep 14 22:09:37 2004 +0900 +++ b/Changes Wed Oct 13 16:10:44 2004 +0900 @@ -5992,3 +5992,12 @@ str r2, [fp, #4+.L3] なんだけど、L3 が巨大なのでだめになってしまう。(まぁ、そうだよね) まぁ、でも、L3 は巨大にはならないんじゃない? + +Wed Sep 15 16:50:46 JST 2004 + +basic のレジスタに載った引数をスタックに戻すところがおかしい。 + + +そうか、C++ のmaglegationをいれれば、C++ とは接続可能。 +だけど。 +
--- a/mc-code-arm.c Tue Sep 14 22:09:37 2004 +0900 +++ b/mc-code-arm.c Wed Oct 13 16:10:44 2004 +0900 @@ -15,6 +15,7 @@ char *l_include_path[]={ "/Developer/Zaurus-X-gcc/opt/Embedix/tools/arm-linux/include", "/Developer/Zaurus-X-gcc/opt/Embedix/tools/arm-linux/include/linux", + "/home/zaurus/develop/include", "/usr/include", 0}; @@ -50,7 +51,6 @@ static int creg; static int output_mode = TEXT_EMIT_MODE; static int register_save_return_label; -static int code_size_label ; static int r1_offset_label; static int lvar_offset_label; @@ -335,7 +335,7 @@ #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_offset1) +#define CALLEE_ARG(l) ((l)+arg_offset) static int code_offset_set(NMTBL *fnptr) @@ -352,9 +352,9 @@ lvar_offsetv += round16(r1_offsetv)-r1_offsetv; r1_offsetv = round16(r1_offsetv); -printf(" @ args = %d, pretend = %d, frame = %d\n", - max_func_args,0,round16(-disp)); -printf(" @ frame_needed = 1, current_function_anonymous_args = 0\n"); +// printf(" @ args = %d, pretend = %d, frame = %d\n", +// max_func_args,0,round16(-disp)); +// printf(" @ frame_needed = 1, current_function_anonymous_args = 0\n"); printf("\t.set .L%d, %d\n",lvar_offset_label,lvar_offsetv); printf("\t.set .L%d, %d\n",r1_offset_label,r1_offsetv); @@ -905,7 +905,7 @@ i = REG_VAR_BASE-i; } else { if (i<0||i>=MAX_INPUT_REGISTER_VAR) return 0; - i = i+MIN_TMP_REG; + i = i+1; } return list3(REGISTER,i,(int)n); } @@ -3106,6 +3106,7 @@ return disp; } +static int entry_label; void code_enter(char *name) @@ -3117,9 +3118,11 @@ if (stmode!=STATIC) printf("\t.globl\t%s\n",name); printf("\t.type\t%s,function\n",name); - code_size_label = backdef(); lvar_offset_label = fwdlabel(); max_func_args = 0; + printf("%s:\n",name); + jmp(entry_label = fwdlabel()); + register_save_return_label = backdef(); } @@ -3134,12 +3137,12 @@ void code_leave(char *name) { + fwddef(entry_label); code_offset_set(fnptr); - printf("%s:\n",name); code_add(REG_sp,disp,REG_fp); - jmp(code_size_label); + jmp(register_save_return_label); local_table(); - printf("\t.size\t%s,.L%d-.L%d\n",name, code_size_label,backdef()); + printf("\t.size\t%s,.L%d-%s\n",name, backdef(),name); } void @@ -3154,12 +3157,13 @@ lvar_offset_label = fwdlabel(); r1_offset_label = fwdlabel(); - code_size_label = fwdlabel(); printf("\t.type\t%s,function\n",name); if (stmode!=STATIC) printf("\t.globl\t%s\n",name); + printf("%s:\n",name); + printf("\tmov\tip, sp\n"); + jmp(entry_label = fwdlabel()); register_save_return_label = backdef(); - } void @@ -3224,8 +3228,7 @@ // entry part (save register) - printf("%s:\n",name); - printf("\tmov\tip, sp\n"); + fwddef(entry_label); code_register_save(max_reg_var,max_freg_var,-arg_offset-SIZE_OF_INT*2); code_add(REG_fp,-4,REG_ip); @@ -3233,7 +3236,7 @@ jmp(register_save_return_label); local_table(); - printf("\t.size\t%s,.L%d-.L%d\n",name, code_size_label,backdef()); + printf("\t.size\t%s,.L%d-%s\n",name, backdef(),name); free_all_register(); } @@ -4980,19 +4983,19 @@ check_lreg(reg); break; case LDIV: - code_longlong_lib("____divdi3",reg,oreg); + code_longlong_lib("__divdi3",reg,oreg); check_lreg(reg); break; case LUDIV: - code_longlong_lib("___udivdi3",reg,oreg); + code_longlong_lib("__udivdi3",reg,oreg); check_lreg(reg); break; case LMOD: - code_longlong_lib("___moddi3",reg,oreg); + code_longlong_lib("__moddi3",reg,oreg); check_lreg(reg); break; case LUMOD: - code_longlong_lib("___umoddi3",reg,oreg); + code_longlong_lib("__umoddi3",reg,oreg); check_lreg(reg); break; default: