Mercurial > hg > CbC > old > device
changeset 119:b815fcd57b9d
input var ( incomplete )
author | kono |
---|---|
date | Sun, 23 Mar 2003 19:23:29 +0900 |
parents | 07b91b625f84 |
children | 099518ea9cc1 |
files | .gdbinit .gdbinit.powerpc Changes mc-code-ia32.c mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h mc-parse.c mc.h test/basic.c |
diffstat | 11 files changed, 470 insertions(+), 282 deletions(-) [+] |
line wrap: on
line diff
--- a/.gdbinit Fri Mar 21 18:35:13 2003 +0900 +++ b/.gdbinit Sun Mar 23 19:23:29 2003 +0900 @@ -1,5 +1,5 @@ tb main -r -s mc-parse.c +r -s test/basic.c define regs printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4 printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15
--- a/.gdbinit.powerpc Fri Mar 21 18:35:13 2003 +0900 +++ b/.gdbinit.powerpc Sun Mar 23 19:23:29 2003 +0900 @@ -1,13 +1,26 @@ tb main -r -s mc-code-powerpc.c +r -s mc-parse.c define regs -printf "lr =%08x pc =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$lr,$pc,$r0,$r1,$r3,$r4 +printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4 printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 end define fregs printf "f1=%g f2=%g f3=%g f4=%g f5=%g f6=%g\n",$f1,$f2,$f3,$f4,$f5,$f6 printf "f10=%g f11=%g f12=%g f13=%g f14=%g f15=%g\n",$f10,$f11,$f12,$f13,$f14,$f15 end +define allreg +printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4 +printf "r5=%08x r6=%08x r7=%08x r8=%08x r9=%08x\n",$r5,$r6,$r7,$r8,$r9 +printf "r10=%08x r11=%08x r12=%08x r13=%08x r14=%08x r15=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 +printf "r16=%08x r17=%08x r18=%08x r19=%08x r20=%08x r21=%08x\n",$r10,$r11,$r12,$r13,$r14,$r15 +printf "f1=%g f2=%g f3=%g f4=%g f5=%g f6=%g\n",$f1,$f2,$f3,$f4,$f5,$f6 +printf "f10=%g f11=%g f12=%g f13=%g f14=%g f15=%g\n",$f10,$f11,$f12,$f13,$f14,$f15 +printf "f20=%g f21=%g f22=%g f23=%g f24=%g f25=%g\n",$f20,$f21,$f22,$f23,$f24,$f25 +end +define sh +regs +x/20i $pc-36 +end define si stepi regs
--- a/Changes Fri Mar 21 18:35:13 2003 +0900 +++ b/Changes Sun Mar 23 19:23:29 2003 +0900 @@ -2394,3 +2394,63 @@ ということだったみたいね。ようやっと self compile が通りました。 free_glist を作るか.... + +Sat Mar 22 11:17:41 JST 2003 + +creg/freg を g_expr の引数にした方が、レジスタマシン系では、素直な +みたい。そうすれば、 +## conv->static_(); + addis r15,r31,ha16(_conv-L_242) + la r15,lo16(_conv-L_242)(r15) + lwz r3,0(r15) + lwz r3,244(r3) + mr r29,r3 + mtctr r29 +みたいな mr は減るね。もっとも一命令だけどさ。3% もあるみたい。 +ちょっと多いか... 386 での use_register もなくなるしなぁ。 +(あぁ、でも大半はポインタキャッシュだな。こっちを直す方が +簡単か) + +まぁ、そういう最適化をしないっていうのが、このコンパイラの立場 +なわけだけど。 + + +構造体の引数渡しでは、構造体そのものをレジスタに載せて +引き渡しているみたいだね。まったく... それで、あわてて +メモリに代入しているわけか。 + +なんか mtctr r2; bdn Lxx とかいうのがあるのね。main frame っぽい! +これはベンチマーク用って感じだね。 + + +Sun Mar 23 16:06:29 JST 2003 + +Breakpoint 3, get_register () at mc-code-powerpc.c:235 +235 for(i=MAX_TMP_REG;i>MIN_TMP_REG;i--) { +(gdb) c 9999 +Will ignore next 9998 crossings of breakpoint 3. Continuing. +test/basic.c:67:Bug of compiler + +Breakpoint 2, errmsg () at mc-parse.c:214 +214 if(lineno==0) return; +(gdb) info b +Number Type Disposition Enabled Address WhatStackFrame Condition IgnoreCount Commands +2 breakpoint keep y 0x0000ca08 in errmsg at mc-parse.c :214 + breakpoint already hit 1 time +3 breakpoint keep y 0x000028e4 in get_register at mc-code-powerpc.c :235 + breakpoint already hit 69 times + ignore next 9930 hits +(gdb) run +The program being debugged has been started already. +Start it from the beginning? (y or n) y +Starting program: /Users/kono/src/device/mc -s test/basic.c +[Switching to process 24650 thread 0x2307] +test/basic.c:67:Bug of compiler + +Breakpoint 2, errmsg () at mc-parse.c:214 +214 if(lineno==0) return; +(gdb) c 69 + +うまくいかんね。 + +a+a+a....a で落ちてしまう。まぁねぇ。
--- a/mc-code-ia32.c Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-code-ia32.c Sun Mar 23 19:23:29 2003 +0900 @@ -15,8 +15,24 @@ static int output_mode = TEXT_EMIT_MODE; static int data_alignment = 0; -static int code_disp_label; -static int func_disp_label; +int size_of_int = 4; +int size_of_float = 4; +int size_of_double = 8; +int size_of_longlong = 8; +int endian = 0; +int MAX_REGISTER=6; /* intel386のレジスタを6つまで使う*/ +#define REAL_MAX_REGISTER 8 /* intel386のレジスタが8つということ*/ +int MAX_DATA_REG=4; +int MAX_POINTER=3; +int MAX_REGISTGER_VAR=2; +int MAX_FREGISTER=1; + +#define MAX_FPU_STACK 7 + +int MAX_INPUT_REGISTER_VAR = 0; +int MAX_CODE_INPUT_REGISTER_VAR = 2; +int MAX_INPUT_DREGISTER_VAR = 0; +int MAX_CODE_INPUT_DREGISTER_VAR = 0; /* -16 -8 local2 @@ -41,24 +57,20 @@ int code_disp_offset = 0; int jump_offset = 0; -int size_of_int = 4; -int size_of_float = 4; -int size_of_double = 8; -int size_of_longlong = 8; -int endian = 0; -int MAX_REGISTER=6; /* intel386のレジスタを6つまで使う*/ -#define REAL_MAX_REGISTER 8 /* intel386のレジスタが8つということ*/ -int MAX_DATA_REG=4; -int MAX_POINTER=3; -int MAX_REGISTGER_VAR=2; -int MAX_FREGISTER=1; +static int code_disp_label; +static int func_disp_label; -#define MAX_FPU_STACK 7 - -int MAX_INPUT_REGISTER_VAR = 0; -int MAX_CODE_INPUT_REGISTER_VAR = 2; -int MAX_INPUT_DREGISTER_VAR = 0; -int MAX_CODE_INPUT_DREGISTER_VAR = 0; +static int +lvar(int l) +{ + if (is_code(fnptr)) { + return l+code_disp_offset; + } else if (l<0) { + return l+disp_offset; + } else { + return l+arg_offset; + } +} /* creg currrent virtual register @@ -451,7 +463,7 @@ regv[dreg]=1; return dreg; } else if (xreg<= -REG_LVAR_OFFSET) { - code_rlvar(lvar(xreg+REG_LVAR_OFFSET),dreg); + code_rlvar(xreg+REG_LVAR_OFFSET,dreg); free_lvar(xreg+REG_LVAR_OFFSET); regv[dreg]=1; return dreg; @@ -487,7 +499,7 @@ void code_lvar(int e2,int creg) { - printf("\tlea %d(%%ebp),%s\n",e2,register_name(creg,0)); + printf("\tlea %d(%%ebp),%s\n",lvar(e2),register_name(creg,0)); regv[creg]=1; } @@ -501,14 +513,14 @@ void code_rlvar(int e2,int reg) { - printf("\tmovl %d(%%ebp),%s\n",e2,register_name(reg,0)); + printf("\tmovl %d(%%ebp),%s\n",lvar(e2),register_name(reg,0)); regv[creg]=1; } void code_crlvar(int e2,int reg) { - printf("\tmovsbl %d(%%ebp),%s\n",e2,register_name(reg,0)); + printf("\tmovsbl %d(%%ebp),%s\n",lvar(e2),register_name(reg,0)); regv[creg]=1; } @@ -711,7 +723,7 @@ void code_cmp_crlvar(int e1) { - printf("\tcmpb $0,%d(%%ebp)\n",e1); + printf("\tcmpb $0,%d(%%ebp)\n",lvar(e1)); } @@ -723,7 +735,7 @@ void code_cmp_rlvar(int e1) { - printf("\tcmpl $0,%d(%%ebp)\n",e1); + printf("\tcmpl $0,%d(%%ebp)\n",lvar(e1)); } @@ -1059,7 +1071,7 @@ void code_assign_lvar(int e2,int creg,int byte) { if (byte) use_data_reg(creg,1); - printf("\t%s %s,%d(%%ebp)\n",move(byte),register_name(creg,byte),e2); + printf("\t%s %s,%d(%%ebp)\n",move(byte),register_name(creg,byte),lvar(e2)); } void @@ -1125,7 +1137,7 @@ oreg = dreg; regv[dreg]=1; } else if (oreg<= -REG_LVAR_OFFSET) { - code_rlvar(lvar(oreg+REG_LVAR_OFFSET),dreg); + code_rlvar(oreg+REG_LVAR_OFFSET,dreg); free_lvar(oreg+REG_LVAR_OFFSET); oreg = dreg; regv[dreg]=1; @@ -1224,7 +1236,7 @@ use_register(reg,REG_ECX,1); } else if (reg<= -REG_LVAR_OFFSET) { use_register(dreg,REG_ECX,0); - code_rlvar(lvar(reg+REG_LVAR_OFFSET),dreg); + code_rlvar(reg+REG_LVAR_OFFSET,dreg); reg = dreg; regv[dreg]=0; } else { @@ -1572,18 +1584,6 @@ printf("\t.type\t%s,@object\n",name); } -int -lvar(int l) -{ - if (is_code(fnptr)) { - return l+code_disp_offset; - } else if (l<0) { - return l+disp_offset; - } else { - return l+arg_offset; - } -} - /* floating point */ @@ -1616,7 +1616,7 @@ void code_dassign_lvar(int e2,int freg,int d) { - printf("\t%s %d(%%ebp)\n",fstore(d),e2); + printf("\t%s %d(%%ebp)\n",fstore(d),lvar(e2)); } void code_dassign_fregister(int e,int d,int freg) @@ -1726,7 +1726,7 @@ void code_drlvar(int e2,int d,int freg) { - printf("\t%s %d(%%ebp)\n",fload(d),e2); + printf("\t%s %d(%%ebp)\n",fload(d),lvar(e2)); } void code_cmp_drgvar(int e2) @@ -1736,7 +1736,7 @@ void code_cmp_drlvar(int e2) { - printf("\tfcomp %d(%%ebp)\n",e2); + printf("\tfcomp %d(%%ebp)\n",lvar(e2)); } void dtosop(int op,int e1) @@ -1839,7 +1839,7 @@ int xreg; if ((xreg=pop_fregister())==-1) { } else if (xreg<= -REG_LVAR_OFFSET) { - code_drlvar(lvar(REG_LVAR_OFFSET+xreg),1,freg); + code_drlvar(REG_LVAR_OFFSET+xreg,1,freg); free_lvar(xreg+REG_LVAR_OFFSET); /* pushed order is reversed. We don't need this for comutable operator, but it is ok to do this. */ @@ -1855,7 +1855,7 @@ void emit_dpush() { - if (freg_sp>MAX_FPU_STACK) code_save_fstacks(); + if (freg_sp>=MAX_FPU_STACK) code_save_fstacks(); if (freg_sp>MAX_MAX) error(-1); freg_stack[freg_sp++]=-1; printf("# fpush:%d\n",freg_sp); @@ -1875,7 +1875,7 @@ creg = xreg; } code_assign_lvar( - lvar(reg_stack[sp]=new_lvar(size_of_int)),creg,0); + (reg_stack[sp]=new_lvar(size_of_int)),creg,0); reg_stack[sp]= reg_stack[sp]-REG_LVAR_OFFSET; regv[xreg]=0; creg=screg; @@ -1892,7 +1892,7 @@ while(sp-->0) { if ((xreg=freg_stack[sp])==-1) { code_dassign_lvar( - lvar(freg_stack[sp]=new_lvar(size_of_double)),freg,1); + (freg_stack[sp]=new_lvar(size_of_double)),freg,1); freg_stack[sp]= freg_stack[sp]-REG_LVAR_OFFSET; } }
--- a/mc-code-powerpc.c Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-code-powerpc.c Sun Mar 23 19:23:29 2003 +0900 @@ -15,6 +15,7 @@ static void ld_indexx(int byte, int n, int xreg); static void local_table(void); static void shift(char *op, int reg); +static int struct_push(int e4,int t,int arg); static int output_mode = TEXT_EMIT_MODE; static int data_alignment = 0; @@ -34,6 +35,86 @@ int endian = 1; +#define REG_fp 1 +#define REG_sp 30 +#define REG_VAR_BASE 29 +#define REG_VAR_MIN 22 +#define MIN_TMP_REG 3 +#define MAX_TMP_REG 15 + +#define PTRC_REG 3 + +#define FREG_VAR_BASE 31 +#define FREG_VAR_MIN 24 +#define MIN_TMP_FREG 1 +#define MAX_TMP_FREG 15 + +#define RET_REGISTER 3 +#define RET_FREGISTER 1 + +int MAX_REGISTER=30; /* PowerPCのレジスタを10個まで使う*/ +int MAX_FREGISTER=30; +#define REAL_MAX_REGISTER 32 /* PowerPCのレジスタが32ということ*/ +#define REAL_MAX_FREGISTER 32 /* PowerPCのレジスタが32ということ*/ + +int MAX_INPUT_REGISTER_VAR = 10-MIN_TMP_REG; +int MAX_CODE_INPUT_REGISTER_VAR = 10-MIN_TMP_REG; +int MAX_INPUT_DREGISTER_VAR = 13-MIN_TMP_FREG; +int MAX_CODE_INPUT_DREGISTER_VAR = 13-MIN_TMP_FREG; + +#define CREG_REGISTER MAX_TMP_REG +#define FREG_FREGISTER MAX_TMP_FREG + +int powerpc_regs[REAL_MAX_REGISTER]; +int powerpc_regv[REAL_MAX_REGISTER]; + +int *regv = powerpc_regv; +int *regs = powerpc_regs; + +int powerpc_fregs[REAL_MAX_FREGISTER]; +int powerpc_fregv[REAL_MAX_FREGISTER]; + +int *fregv = powerpc_fregv; +int *fregs = powerpc_fregs; + +static int max_reg_var, max_freg_var; +static int cond_reg=-1,cond_freg=-1; + +static char *reg_name[] = { + "r0","r1","r2","r3","r4","r5","r6","r7","r8","r9", + "r10","r11","r12","r13","r14","r15","r16","r17","r18","r19", + "r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", + "r30","r31" +}; + +static char *freg_name[] = { + "f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", + "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19", + "f20","f21","f22","f23","f24","f25","f26","f27","f28","f29", + "f30","f31" +}; + +#define register_name(i) reg_name[i] +#define fregister_name(i) freg_name[i] + +static +NMTBL float_zero = {"_float_zero",STATIC,FLOAT,0}; +static +NMTBL float_one = {"_float_one",STATIC,FLOAT,0}; + + +static char * fload(int d); +static int code_d1(double d); +static int code_d2(double d); +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); + +int max_func_args; +#define ARG_LVAR_OFFSET 0x10000000 + /* -16 -8 local2 <-- r30 -12 -4 local1 @@ -66,17 +147,15 @@ r+ +------------+---+---------------+----------+--------------+----+ - caller arg xx register save local callee arg xx reg_save disp max_func_args*size_of_int + lvar>0 lvar<0 lvar>0x1000 0000 */ - -int arg_offset = 0; +int arg_offset = 24; int arg_offset1 = 24; int disp_offset = 0; #define r1_offset 60 #define func_disp_offset (r1_offset-12) int code_disp_offset = 0; int jump_offset = 0; -int max_func_args; - void code_offset_set() { @@ -84,97 +163,79 @@ -(disp-max_func_args*size_of_int-func_disp_offset)); printf(".set L_%d,%d\n",r1_offset_label, -(disp-max_func_args*size_of_int+reg_save-r1_offset)); - printf("## disp %d arg_offset=%d disp_offset=%d reg_save=%d\n",disp,arg_offset,disp_offset,reg_save); } -int -lvar(int l) +#define CODE_LVAR l+code_disp_offset +#define FUNC_LVAR l+disp_offset +#define CALLER_ARG (l-ARG_LVAR_OFFSET)+arg_offset1 +#define CALLEE_ARG l+arg_offset + +static void +lvar8(int l) { if (fnptr->sc==CODE) { - return l+code_disp_offset; - } else if (l<0) { - return l+disp_offset; - } else { - return l+arg_offset; + printf("lo16(%d+L_%d)(r30)\n",CODE_LVAR,lvar_offset_label); + } else if (l<0) { /* local variable */ + printf("lo16(%d+L_%d)(r30)\n",FUNC_LVAR,lvar_offset_label); + } else if (l>ARG_LVAR_OFFSET) { /* caller's arguments */ + printf("lo16(%d)(r30)\n",CALLER_ARG); + } else { /* callee's arguments */ + printf("lo16(%d+L_%d)(r30)\n",CALLEE_ARG,lvar_offset_label); } } - - -#define REG_fp 1 -#define REG_sp 30 -#define REG_VAR_BASE 29 -#define REG_VAR_MIN 22 -#define MIN_TMP_REG 3 -#define MAX_TMP_REG 15 +/* if size of local variables / input variables is more then 64k, + lo16 does not work. We have to use ha16 also. But we can't know + the exact size in one path compile. We may safely use lvar16ha + if disp or max_func_args > 32k. Of course this is reduantant for + smaller offset. But who cares who use very large local variables? + */ -#define PTRC_REG 3 - -#define FREG_VAR_BASE 31 -#define FREG_VAR_MIN 24 -#define MIN_TMP_FREG 1 -#define MAX_TMP_FREG 15 - -#define RET_REGISTER 3 -#define RET_FREGISTER 1 +#define LARGE_LVAR (disp<-32765||max_func_args>32765) -int MAX_REGISTER=30; /* PowerPCのレジスタを10個まで使う*/ -int MAX_FREGISTER=30; -#define REAL_MAX_REGISTER 32 /* PowerPCのレジスタが32ということ*/ -#define REAL_MAX_FREGISTER 32 /* PowerPCのレジスタが32ということ*/ - -int MAX_INPUT_REGISTER_VAR = 12-MIN_TMP_REG; -int MAX_CODE_INPUT_REGISTER_VAR = 12-MIN_TMP_REG; -int MAX_INPUT_DREGISTER_VAR = 12-MIN_TMP_FREG; -int MAX_CODE_INPUT_DREGISTER_VAR = 12-MIN_TMP_FREG; - -#define CREG_REGISTER MAX_TMP_REG -#define FREG_FREGISTER MAX_TMP_FREG - -int powerpc_regs[REAL_MAX_REGISTER]; -int powerpc_regv[REAL_MAX_REGISTER]; - -int *regv = powerpc_regv; -int *regs = powerpc_regs; +static void +lvar16ha(int l) +{ + if (fnptr->sc==CODE) { + printf("la r0,ha16(%d+L_%d)(r30)\n",CODE_LVAR,lvar_offset_label); + } else if (l<0) { /* local variable */ + printf("la r0,ha16(%d+L_%d)(r30)\n",FUNC_LVAR,lvar_offset_label); + } else if (l>ARG_LVAR_OFFSET) { /* caller's arguments */ + if (CALLER_ARG>32765) + printf("la r0,ha16(%d)(r30)\n",CALLER_ARG); + } else { /* callee's arguments */ + printf("la r0,ha16(%d+L_%d)(r30)\n",CALLEE_ARG,lvar_offset_label); + } +} -int powerpc_fregs[REAL_MAX_FREGISTER]; -int powerpc_fregv[REAL_MAX_FREGISTER]; - -int *fregv = powerpc_fregv; -int *fregs = powerpc_fregs; - -static int max_reg_var, max_freg_var; -static int cond_reg=-1,cond_freg=-1; - -static char *reg_name[] = { - "r0","r1","r2","r3","r4","r5","r6","r7","r8","r9", - "r10","r11","r12","r13","r14","r15","r16","r17","r18","r19", - "r20","r21","r22","r23","r24","r25","r26","r27","r28","r29", - "r30","r31" -}; +static void +lvar16lo(int l) +{ + if (fnptr->sc==CODE) { + printf("lo16(%d+L_%d)(r0)\n",CODE_LVAR,lvar_offset_label); + } else if (l<0) { /* local variable */ + printf("lo16(%d+L_%d)(r0)\n",FUNC_LVAR,lvar_offset_label); + } else if (l>ARG_LVAR_OFFSET) { /* caller's arguments */ + if (CALLER_ARG>32765) + printf("lo16(%d)(r0)\n",CALLER_ARG); + else + printf("lo16(%d)(r30)\n",CALLER_ARG); + } else { /* callee's arguments */ + printf("lo16(%d+L_%d)(r0)\n",CALLEE_ARG,lvar_offset_label); + } +} -static char *freg_name[] = { - "f0","f1","f2","f3","f4","f5","f6","f7","f8","f9", - "f10","f11","f12","f13","f14","f15","f16","f17","f18","f19", - "f20","f21","f22","f23","f24","f25","f26","f27","f28","f29", - "f30","f31" -}; +#define lvar_intro(i) if (LARGE_LVAR) lvar16ha(i) + +#define lvar(i) if (LARGE_LVAR) lvar16lo(i); else lvar8(i) -static -NMTBL float_zero = {"_float_zero",STATIC,FLOAT,0}; -static -NMTBL float_one = {"_float_one",STATIC,FLOAT,0}; - -char * fload(int d); -int code_d1(double d); -int code_d2(double d); -void code_save_stacks(); -void code_save_input_registers(); -void clear_ptr_cache_reg(int r); -int fregister_var(int r); -int arg_offset_v(int arg); -void set_creg(int,int); -void set_freg(int,int); +void +code_lvar(int e2,int creg) { + lvar_intro(e2); + printf("\tla %s,",register_name(creg)); + lvar(e2); + regv[creg]=1; +} void code_init(void) @@ -182,36 +243,12 @@ init_ptr_cache(); } -#define register_name(i) reg_name[i] -#define fregister_name(i) freg_name[i] - void gexpr_code_init(void){ regv[creg]=0; fregv[freg]=0; } -int -replace_arg_var(int reg,int type) -{ - int arglist=fnptr->dsp; - int nargs=0; - int lvar; - NMTBL *n; - while(arglist) { - n = (NMTBL*)caddr(arglist); - if (n->sc==REGISTER && n->dsp==reg) { - if (n->ty!=type) error(-1); - lvar = arg_offset_v(nargs); - n->sc=LVAR; n->dsp = lvar; - return lvar; - } - arglist = cadr(arglist); - nargs++; - } - error(-1); - return 0; -} void code_arg_register() @@ -231,9 +268,7 @@ } /* INPUT_REG か PTR_CACHE をつぶす */ for(i=MAX_TMP_REG;i>MIN_TMP_REG;i--) { - if (regs[i]==INPUT_REG) { - code_assign_lvar(lvar(replace_arg_var(i,INT)),i,0); - } else if (regs[i]==PTRC_REG) { + if (regs[i]==PTRC_REG) { clear_ptr_cache_reg(i); } else continue; @@ -244,7 +279,7 @@ for(i=0;i<reg_sp;i++) { if (reg_stack[i]>=0) { code_assign_lvar( - lvar(reg_stack[i]=new_lvar(size_of_int)),i,0); + (reg_stack[i]=new_lvar(size_of_int)),i,0); reg_stack[i]= reg_stack[i]-REG_LVAR_OFFSET; return i; } @@ -268,19 +303,11 @@ fregs[i]=USING_REG; /* そのレジスタを使うことを宣言し */ return i; /* その場所を表す番号を返す */ } - for(i=MAX_TMP_FREG;i>MIN_TMP_FREG;i--) { - if (fregs[i]==INPUT_REG) { - code_dassign_lvar(lvar(replace_arg_var(i,DOUBLE)),i,0); - } else - continue; - fregs[i]=USING_REG; /* そのレジスタを使うことを宣言し */ - return i; /* その場所を表す番号を返す */ - } /* search register stack */ for(i=0;i<freg_sp;i++) { if ((reg=freg_stack[i])>=0) { code_dassign_lvar( - lvar(freg_stack[i]=new_lvar(size_of_double)),reg,1); + (freg_stack[i]=new_lvar(size_of_double)),reg,1); freg_stack[i]= freg_stack[i]-REG_LVAR_OFFSET; return i; } @@ -489,7 +516,7 @@ xreg=pop_register(); if (xreg<= -REG_LVAR_OFFSET) { reg = get_register(); - code_rlvar(lvar(REG_LVAR_OFFSET+xreg),reg); + code_rlvar(REG_LVAR_OFFSET+xreg,reg); free_lvar(REG_LVAR_OFFSET+xreg); xreg = reg; regv[xreg]=1; @@ -613,13 +640,6 @@ regv[creg]=1; } -void -code_lvar(int e2,int creg) { - printf("\tla %s,lo16(%d+L_%d)(r30)\n",register_name(creg), - e2,lvar_offset_label); - regv[creg]=1; -} - void code_register(int e2,int creg) { @@ -631,15 +651,18 @@ void code_rlvar(int e2,int reg) { - printf("\tlwz %s,lo16(%d+L_%d)(r30)\n",register_name(reg), - e2,lvar_offset_label); + lvar_intro(e2); + printf("\tlwz %s,",register_name(reg)); + lvar(e2); regv[creg]=1; } void code_crlvar(int e2,int reg) { - printf("\tlbz %s,lo16(%d+L_%d)(r30)\n",register_name(reg),e2,lvar_offset_label); + lvar_intro(e2); + printf("\tlbz %s,",register_name(reg)); + lvar(e2); printf("\textsb %s,%s\n",register_name(reg),register_name(reg)); regv[reg]=1; } @@ -921,9 +944,11 @@ void -code_cmp_crlvar(int e1) { +code_cmp_crlvar(int e2) { char *crn = register_name(creg); - printf("\tlbz %s,lo16(%d+L_%d)(r30)\n",crn,e1,lvar_offset_label); + lvar_intro(e2); + printf("\tlbz %s,",crn); + lvar(e2); code_cmp_register(creg); regv[creg]=0; } @@ -941,9 +966,11 @@ void -code_cmp_rlvar(int e1) { +code_cmp_rlvar(int e2) { char *crn = register_name(creg); - printf("\tlwz %s,lo16(%d+L_%d)(r30)\n",crn,e1,lvar_offset_label); + lvar_intro(e2); + printf("\tlwz %s,",crn); + lvar(e2); code_cmp_register(creg); regv[creg]=0; } @@ -1047,7 +1074,7 @@ printf("\tmr r4,%s\n",trn); printf("\tmr r3,%s\n",frn); printf("\tbl L_%s$stub\n",bcopy); - extern_define(bcopy,0,FUNCTION); + extern_define(bcopy,0,FUNCTION,1); break; } } @@ -1066,19 +1093,21 @@ } int -struct_push(int e4,int t) +struct_push(int e4,int t,int arg) { int length,count; - int dreg; char *drn,*crn,*srn; + int dreg,sreg; char *drn,*crn,*srn; g_expr(e4); length=size(t); if(length%size_of_int) { length += size_of_int - (length%size_of_int); } dreg = get_register(); if (!dreg) error(-1); + sreg = get_register(); if (!sreg) error(-1); drn = register_name(dreg); - crn = register_name(dreg); - srn = register_name(reg_sp); + crn = register_name(creg); + srn = register_name(sreg); + code_lvar(arg,sreg); for(count=0;length<MAX_COPY_LEN;count++,length-=size_of_int) { if (length==0) { free_register(dreg); @@ -1093,17 +1122,11 @@ /* downward direction copy */ printf("\tmr %s,%s\n",drn,srn); emit_copy(creg,dreg,length,0,0,1); - /* we have value in creg, it may be changed */ - if (dreg!=creg) free_register(dreg); + if (dreg) free_register(dreg); + if (sreg) free_register(sreg); return length/size_of_int; } -int -arg_offset_v(int arg) -{ - return arg*size_of_int+0; -} - void set_creg(int reg,int mode) { @@ -1141,6 +1164,7 @@ void code_save_input_registers() { +#if 0 int args; NMTBL *n; int reg; @@ -1176,6 +1200,46 @@ free_fregister(reg); } } +#else + int args; + NMTBL *n; + int reg; + int tag; + int lvar; + int t; + /* fnptr->dsp=list4(type,fnptr->dsp,(int)n,0); */ + int reg_offset = 0; + int offset = 0; + + for(args = fnptr->dsp;args;args = cadr(args)) { + n = (NMTBL *)caddr(args); + tag = n->sc; + reg = n->dsp; + if (!n||n==&null_nptr) error(REG_ERR); + if (tag==REGISTER) { + /* regs[reg]==INPUT_REG case should be considered */ + n->dsp = offset; + offset+=size_of_int; + t = INT; + reg += reg_offset; /* for duplicated floating point argument */ + } else if (tag==DREGISTER) { + /* fregs[reg]==INPUT_REG case should be considered */ + n->dsp = offset; + offset+=size_of_double; + t = DOUBLE; + reg_offset+=2; + } else + continue; + n->sc = LVAR; + lvar = list2(LVAR,n->dsp); + g_expr_u(assign_expr0(list2(LVAR,n->dsp),list3(tag,reg,(int)n),n->ty,t)); + if (tag==REGISTER) { + free_register(reg); + } else if (tag==DREGISTER) { + free_fregister(reg); + } + } +#endif } int @@ -1188,11 +1252,16 @@ ; } +int +caller_arg_offset_v(int arg) +{ + return ARG_LVAR_OFFSET+arg*size_of_int; +} int function(int e1) { - int e2,e3,e4,e5,nargs,t,r0,r1,greg; + int e2,e3,e4,e5,nargs,t,r0,r1; int arg,reg_arg,freg_arg,arg_assign; int reg_arg_list=0,ret_type,special_lvar; NMTBL *fn; @@ -1225,7 +1294,7 @@ e4 = car(e3); if(scalar(t)) { if (reg_arg>MAX_INPUT_REGISTER_VAR) { - arg = list2(LVAR,arg_offset_v(nargs)); + arg = list2(LVAR,caller_arg_offset_v(nargs)); } else if (!simple_args(e3) && cadr(e3)) { arg = get_register_var(0); arg_assign = list2( @@ -1240,32 +1309,25 @@ nargs ++ ; reg_arg++; continue; } else if (t==DOUBLE||t==FLOAT) { - if (reg_arg<MAX_INPUT_REGISTER_VAR-1) { - /* sigh... */ + if (reg_arg<MAX_INPUT_REGISTER_VAR+1) { + /* sigh... + printf requies floating value in integer registers + */ if (car(e4)==DRLVAR) { special_lvar = cadr(e4); e5 = list2(LVAR,special_lvar); } else { special_lvar = new_lvar(size_of_double); - if (simple_args(list2(e4,0))) { - greg = freg; - arg = get_input_fregister_var(freg_arg,0); - use_var(arg); freg = cadr(arg); - g_expr(assign_expr0( - (e5=list2(LVAR,special_lvar)),e4,t,t)); - e4 = list2(DREGISTER,freg); - reg_arg_list = list2(e5,reg_arg_list); - freg = greg; - } else { - g_expr(assign_expr0( - (e5=list2(LVAR,special_lvar)),e4,t,t)); - reg_arg_list = list2(e5,reg_arg_list); - e4 = list2(DREGISTER,freg); - } + g_expr(assign_expr0( + (e5=list2(LVAR,special_lvar)),e4,t,t)); + reg_arg_list = list2(e5,reg_arg_list); + e4 = list2(DREGISTER,freg); /* freg should not change until XXX */ } r0=get_input_register_var(reg_arg,0); r1=get_input_register_var(reg_arg+1,0); + use_var(r0); /* protect from input register free */ + use_var(r1); /* protect from input register free */ reg_arg_list = list2(r0,reg_arg_list); reg_arg_list = list2(r1,reg_arg_list); arg_assign = list2( assign_expr0(r0,e5,INT,INT), arg_assign); @@ -1274,12 +1336,22 @@ INT,INT), arg_assign); reg_arg += 2; } + if (freg_arg>=4 && freg_arg<=MAX_INPUT_DREGISTER_VAR) { + /* oh my god! + it requies integer register and floating register and + stack value. You are crazy. + */ + arg_assign = list2( + assign_expr0(list2(LVAR,caller_arg_offset_v(nargs)), + get_input_fregister_var(freg_arg,0),t,t), + arg_assign); + } if (freg_arg>MAX_INPUT_DREGISTER_VAR) { - arg = list2(LVAR,arg_offset_v(nargs)); + arg = list2(LVAR,caller_arg_offset_v(nargs)); } else if (!simple_args(e3)) { arg = get_fregister_var(0); arg_assign = list2( - assign_expr0(get_input_fregister_var(reg_arg,0),arg,t,t), + assign_expr0(get_input_fregister_var(freg_arg,0),arg,t,t), arg_assign); } else { arg = get_input_fregister_var(freg_arg,0); @@ -1291,7 +1363,8 @@ nargs += size_of_double/size_of_int; continue; } else if (car(t)==STRUCT||car(t)==UNION) { - nargs += struct_push(e4,t); + arg = list2(LVAR,caller_arg_offset_v(nargs)); + nargs += struct_push(e4,t,arg); continue; } else { error(TYERR); @@ -1314,7 +1387,7 @@ arg = car(reg_arg_list); if (car(arg)==DREGISTER) free_fregister(cadr(arg)); else if (car(arg)==REGISTER) free_register(cadr(arg)); - else if (car(arg)==LVAR) free_lvar(cadr(arg)); + else if (car(arg)==LVAR&&cadr(arg)<0) free_lvar(cadr(arg)); } if (ret_type==DOUBLE||ret_type==FLOAT) { set_freg(RET_FREGISTER,0); @@ -1355,22 +1428,31 @@ rindirect(int e1) /* *(p +5 ) */ { char *crn; - int e2,e3; + int e2,e3,e4,offset; + + offset=0; e3 = cadr(e2 = cadr(e1)); + if (car(e2)==ADD) { + e4=caddr(e2); + if (car(e4)==CONST) { + offset=cadr(e4); + e2=e3; + } + } g_expr(e2); crn=register_name(creg); switch (car(e1)) { case FRINDIRECT: case DRINDIRECT: - printf("\t%s %s,0(%s)\n",fload(car(e1)==DRINDIRECT), - fregister_name(freg),crn); + printf("\t%s %s,%d(%s)\n",fload(car(e1)==DRINDIRECT), + fregister_name(freg),offset,crn); regv[creg]=0; regv[freg]=1; return DOUBLE; case CRINDIRECT: - printf("\tlbz %s,0(%s)\n",crn,crn); + printf("\tlbz %s,%d(%s)\n",crn,offset,crn); printf("\textsb %s,%s\n",crn,crn); return CHAR; case RINDIRECT: - printf("\tlwz %s,0(%s)\n",crn,crn); + printf("\tlwz %s,%d(%s)\n",crn,offset,crn); return INT; } error(-1); return INT; @@ -1394,10 +1476,11 @@ code_assign_lvar(int e2,int creg,int byte) { char *crn; crn=register_name(creg); + lvar_intro(e2); if (byte) { - printf("\tstb %s,lo16(%d+L_%d)(r30)\n",crn,e2,lvar_offset_label); + printf("\tstb %s,",crn); lvar(e2); } else { - printf("\tstw %s,lo16(%d+L_%d)(r30)\n",crn,e2,lvar_offset_label); + printf("\tstw %s,",crn); lvar(e2); } } @@ -1465,7 +1548,7 @@ error(-1); } else if (oreg<= -REG_LVAR_OFFSET) { dx = get_register(); if (dx<0) error(-1); - code_rlvar(lvar(oreg+REG_LVAR_OFFSET),dx); + code_rlvar(oreg+REG_LVAR_OFFSET,dx); oreg = dx; regv[oreg]=1; } @@ -1629,6 +1712,7 @@ printf("_%s:\n",name); code_disp_label=fwdlabel(); printf("\tla r30,L_%d(r30)\n",code_disp_label); + max_func_args = 0; } @@ -1923,7 +2007,7 @@ for(n=ntable;n < &ntable[GSYMS];n++) { if (n->sc == GVAR) { if (init==0) { - data_mode(0); + printf(".data\n"); init=1; } printf("L_%s$non_lazy_ptr:\n\t.long\t_%s\n",n->nm,n->nm); @@ -1934,7 +2018,7 @@ if (is_code(n)||is_function(n)) continue; if (n->sc==EXTRN1) { if(init==0) { - data_mode(0); + printf(".data\n"); printf(".non_lazy_symbol_pointer\n"); init=1; } @@ -2060,8 +2144,9 @@ void code_dassign_lvar(int e2,int freg,int d) { - printf("\t%s %s,lo16(%d+L_%d)(r30)\n",fstore(d),fregister_name(freg), - e2,lvar_offset_label); + lvar_intro(e2); + printf("\t%s %s,",fstore(d),fregister_name(freg)); + lvar(e2); fregv[freg]=1; } @@ -2141,13 +2226,13 @@ { char *frn = fregister_name(freg); char *crn = register_name(creg); - int d = new_lvar(size_of_double); - free_lvar(d); - d = lvar(d); + int e2 = new_lvar(size_of_double); + free_lvar(e2); printf("\tfctiwz %s,%s\n",frn,frn); - printf("\tstfd %s,lo16(%d+L_%d)(r30)\n",frn,d,lvar_offset_label); - printf("\tlwz %s,lo16(%d+L_%d)(r30)\n",crn, - d+size_of_double-size_of_int,lvar_offset_label); + lvar_intro(e2); + printf("\tstfd %s,",frn); lvar(e2); + lvar_intro(e2+size_of_double-size_of_int); + printf("\tlwz %s,",crn); lvar(e2+size_of_double-size_of_int); fregs[freg]=0; regs[creg]=1; } @@ -2295,8 +2380,8 @@ void code_drlvar(int e2,int d,int freg) { - printf("\t%s %s,lo16(%d+L_%d)(r30)\n",fload(d),fregister_name(freg), - e2,lvar_offset_label); + lvar_intro(e2); + printf("\t%s %s,",fload(d),fregister_name(freg)); lvar(e2); fregv[freg]=1; } @@ -2319,8 +2404,8 @@ int g=get_fregister(); char *grn=fregister_name(g); - printf("\t%s %s,lo16(%d+L_%d)(r30)\n",fload(1),grn, - e2,lvar_offset_label); + lvar_intro(e2); + printf("\t%s %s,",fload(1),grn); lvar(e2); printf("\tfcmpu cr0,%s,%s\n",frn,grn); free_fregister(g); fregv[freg]=0; @@ -2448,7 +2533,7 @@ xreg=pop_fregister(); if (xreg<= -REG_LVAR_OFFSET) { reg = get_fregister(); - code_drlvar(lvar(REG_LVAR_OFFSET+xreg),1,reg); + code_drlvar(REG_LVAR_OFFSET+xreg,1,reg); free_lvar(REG_LVAR_OFFSET+xreg); fregv[reg]=1; xreg=reg; } @@ -2477,14 +2562,14 @@ for(i=0;i<reg_sp;i++) { if ((reg=reg_stack[i])>=0) { code_assign_lvar( - lvar(reg_stack[i]=new_lvar(size_of_int)),reg,0); + (reg_stack[i]=new_lvar(size_of_int)),reg,0); reg_stack[i]= reg_stack[i]-REG_LVAR_OFFSET; } } for(i=0;i<freg_sp;i++) { if ((reg=freg_stack[i])>=0) { code_dassign_lvar( - lvar(freg_stack[i]=new_lvar(size_of_double)),reg,1); + (freg_stack[i]=new_lvar(size_of_double)),reg,1); freg_stack[i]= freg_stack[i]-REG_LVAR_OFFSET; } }
--- a/mc-code.h Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-code.h Sun Mar 23 19:23:29 2003 +0900 @@ -19,7 +19,6 @@ #define REG_LVAR_OFFSET 2 extern void code_init(); -extern char *register_name(int i,int byte); extern void gexpr_code_init(void); extern int register_var(int r); extern int get_register_var(NMTBL *n); @@ -87,7 +86,6 @@ extern void code_set_return_register(int mode); extern void text_mode(void); extern void global_table(void); -extern int lvar(int l); extern void code_label(int labelno);
--- a/mc-codegen.c Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-codegen.c Sun Mar 23 19:23:29 2003 +0900 @@ -95,7 +95,7 @@ code_crgvar(e1,creg); return CHAR; case LVAR: - code_lvar(lvar(e2),creg); + code_lvar(e2,creg); return ADDRESS; case REGISTER: code_register(e2,creg); @@ -104,19 +104,19 @@ code_fregister(e2,freg); return DOUBLE; case RLVAR: - code_rlvar(lvar(e2),creg); + code_rlvar(e2,creg); return INT; case CRLVAR: - code_crlvar(lvar(e2),creg); + code_crlvar(e2,creg); return CHAR; case FRLVAR: - code_drlvar(lvar(e2),0,freg); + code_drlvar(e2,0,freg); return FLOAT; case FRGVAR: code_drgvar(e1,0,freg); return FLOAT; case DRLVAR: - code_drlvar(lvar(e2),1,freg); + code_drlvar(e2,1,freg); return DOUBLE; case DRGVAR: code_drgvar(e1,1,freg); @@ -394,7 +394,7 @@ jcond(l1,cond); return; case CRLVAR: - code_cmp_crlvar(lvar(e2)); + code_cmp_crlvar(e2); jcond(l1,cond); return; case RGVAR: @@ -402,15 +402,15 @@ jcond(l1,cond); return; case RLVAR: - code_cmp_rlvar(lvar(e2)); + code_cmp_rlvar(e2); jcond(l1,cond); return; case DRLVAR: - code_cmp_drlvar(lvar(e2)); + code_cmp_drlvar(e2); jcond(l1,cond); return; case DRGVAR: - code_cmp_drgvar(lvar(e2)); + code_cmp_drgvar(e2); jcond(l1,cond); return; case REGISTER: @@ -929,7 +929,7 @@ reg = cadr(e4); switch(car(e2)) { case GVAR: code_assign_gvar(e2,reg,byte); return; - case LVAR: code_assign_lvar(lvar(cadr(e2)),reg,byte); return; + case LVAR: code_assign_lvar(cadr(e2),reg,byte); return; case REGISTER: code_assign_register(cadr(e2),byte,reg); return; } g_expr(e2); @@ -942,10 +942,10 @@ switch(e5) { case CRGVAR: code_crgvar(e4,reg); return; case RGVAR: code_rgvar(e4,reg); return; - case CRLVAR: code_crlvar(lvar(cadr(e4)),reg); return; - case RLVAR: code_rlvar(lvar(cadr(e4)),reg); return; + case CRLVAR: code_crlvar(cadr(e4),reg); return; + case RLVAR: code_rlvar(cadr(e4),reg); return; case GVAR: code_gvar(e4,reg); return; - case LVAR: code_lvar(lvar(cadr(e4)),reg); return; + case LVAR: code_lvar(cadr(e4),reg); return; case CONST: code_const(cadr(e4),reg); return; case ADDRESS: if (car(cadr(e4))==STRING) code_string(cadr(e4),reg); @@ -984,7 +984,7 @@ return; case LVAR: g_expr(e4); - code_assign_lvar(lvar(cadr(e2)),creg,byte); + code_assign_lvar(cadr(e2),creg,byte); return; case REGISTER: g_expr(e4); @@ -1014,7 +1014,7 @@ code_dassign_gvar(e2,reg,d); return; case LVAR: - code_dassign_lvar(lvar(cadr(e2)),reg,d); + code_dassign_lvar(cadr(e2),reg,d); return; case DREGISTER: if (reg!=cadr(e2)) @@ -1030,7 +1030,7 @@ reg = cadr(e2); switch(e5) { case DRGVAR: code_drgvar(e4,d,reg); return; - case DRLVAR: code_drlvar(lvar(cadr(e4)),d,reg); return; + case DRLVAR: code_drlvar(cadr(e4),d,reg); return; case DCONST: code_dconst(e4,reg); return; case DEFAULT: error(-1); @@ -1061,7 +1061,7 @@ return; case LVAR: g_expr(e4); - code_dassign_lvar(lvar(cadr(e2)),freg,d); + code_dassign_lvar(cadr(e2),freg,d); return; case DREGISTER: g_expr(e4);
--- a/mc-codegen.h Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-codegen.h Sun Mar 23 19:23:29 2003 +0900 @@ -1,6 +1,6 @@ /* max stack in an expression (for each int, float ) */ -#define MAX_MAX 20 +#define MAX_MAX 50 /* flag in regs/fregs */
--- a/mc-parse.c Fri Mar 21 18:35:13 2003 +0900 +++ b/mc-parse.c Sun Mar 23 19:23:29 2003 +0900 @@ -3501,19 +3501,20 @@ } void -extern_define(char *s,int d,int type) +extern_define(char *s,int d,int type,int use) { NMTBL *nptr0; int i; hash=0; name=namebuf; i=0; while((name[i++] = *s)) { - hash=(((7*hash)&0xfffffff) ^ (*s)); + hash=(((7*hash)&0xfffffff) ^ (*s)); s++; } if (cheapp+i >= cheap+CHEAPSIZE) error(STRERR); name[i++] = 0; (nptr0 = gsearch())->sc = EXTRN; nptr0->dsp = d; nptr0->ty=type; + if (use) extrn_use(nptr0); } static void
--- a/mc.h Fri Mar 21 18:35:13 2003 +0900 +++ b/mc.h Sun Mar 23 19:23:29 2003 +0900 @@ -308,7 +308,7 @@ extern Converter *conv; -EXTERN void extern_define(char *s,int dsp,int type); +EXTERN void extern_define(char *s,int dsp,int type,int use); EXTERN void error(int n); EXTERN int append4(int p,int a1,int a2,int a3); EXTERN int assign_expr(int e1,int e2,int t,int type);
--- a/test/basic.c Fri Mar 21 18:35:13 2003 +0900 +++ b/test/basic.c Sun Mar 23 19:23:29 2003 +0900 @@ -58,18 +58,39 @@ } int -g2( -int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8, -int b0,int b1,int b2,int b3,int b4,int b5,int b6,int b7,int b8 +i50( +int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9,int a10,int a11,int a12,int a13,int a14,int a15,int a16,int a17,int a18,int a19,int a20,int a21,int a22,int a23,int a24,int a25,int a26,int a27,int a28,int a29,int a30,int a31,int a32,int a33,int a34,int a35,int a36,int a37,int a38,int a39,int a40,int a41,int a42,int a43,int a44,int a45,int a46,int a47,int a48,int a49 ) { - printf("g: %d\n", -a0+a1+a2+a3+a4+a5+a6+a7+a8+ -b0+b1+b2+b3+b4+b5+b6+b7+b8 + printf("i50: %d\n", +a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 ); return a8; } +float +f50( +float a0,float a1,float a2,float a3,float a4,float a5,float a6,float a7,float a8,float a9,float a10,float a11,float a12,float a13,float a14,float a15,float a16,float a17,float a18,float a19,float a20,float a21,float a22,float a23,float a24,float a25,float a26,float a27,float a28,float a29,float a30,float a31,float a32,float a33,float a34,float a35,float a36,float a37,float a38,float a39,float a40,float a41,float a42,float a43,float a44,float a45,float a46,float a47,float a48,float a49 +) +{ + printf("f50: %g\n", +a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 + ); + return a8; +} + +double +d50( +double a0,double a1,double a2,double a3,double a4,double a5,double a6,double a7,double a8,double a9,double a10,double a11,double a12,double a13,double a14,double a15,double a16,double a17,double a18,double a19,double a20,double a21,double a22,double a23,double a24,double a25,double a26,double a27,double a28,double a29,double a30,double a31,double a32,double a33,double a34,double a35,double a36,double a37,double a38,double a39,double a40,double a41,double a42,double a43,double a44,double a45,double a46,double a47,double a48,double a49 +) +{ + printf("d50: %g\n", +a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19+a20+a21+a22+a23+a24+a25+a26+a27+a28+a29+a30+a31+a32+a33+a34+a35+a36+a37+a38+a39+a40+a41+a42+a43+a44+a45+a46+a47+a48+a49 + ); + return a8; +} + + int h( int a0,int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8) { @@ -91,6 +112,23 @@ void tmp1 () { + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n", +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49 +); + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", +0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 +); + +i50( +0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49 +); +f50( +0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 +); +d50( +0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 +); + h(0,1,2,3,4,5,6,7,1); g(g(0,1,2,3,4,5,6,7,0), g(0,1,2,3,4,5,6,7,1), @@ -111,13 +149,6 @@ f(0,1,2,3,4,5,6,7,6), f(0,1,2,3,4,5,6,7,7)); - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d \n", -0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49 -); - printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g %g \n", -0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0,32.0,33.0,34.0,35.0,36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0,44.0,45.0,46.0,47.0,48.0,49.0 -); - }