Mercurial > hg > CbC > old > device
changeset 21:f9f789aa7587
Linux version (Redhat 7.2)
author | kono |
---|---|
date | Mon, 03 Feb 2003 23:11:21 +0900 |
parents | 8d3db5fc8a97 |
children | 3fa41d00f658 |
files | mc-nop-386.c mc-parse.c stdio.h |
diffstat | 3 files changed, 28 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-nop-386.c Mon Feb 03 17:52:54 2003 +0900 +++ b/mc-nop-386.c Mon Feb 03 23:11:21 2003 +0900 @@ -420,7 +420,7 @@ printf("\tmovl %d(%%ebp),%s\n",lvar(e2),register_name(creg,0)); return; case CRLVAR: - printf("\tmovsbl %d(%%ebp),%s\n",lvar(e2),register_name(creg,1)); + printf("\tmovsbl %d(%%ebp),%s\n",lvar(e2),register_name(creg,0)); return; case FNAME: printf("\tmovl $%s,%s\n",((NMTBL *)e2)->nm,register_name(creg,0)); @@ -509,7 +509,7 @@ } g_expr(e2); printf("\tincl (%s)\n",register_name(creg,0)); - printf("\tmovsbl (%s),%s\n",register_name(creg,1),register_name(creg,0)); + printf("\tmovsbl (%s),%s\n",register_name(creg,0),register_name(creg,0)); return; case CPOSTDEC: if (car(e2)==REGISTER) { @@ -518,7 +518,7 @@ return; } g_expr(e2); - printf("\tmovsbl (%s),%s\n",register_name(creg,1),register_name(creg,0)); + printf("\tmovsbl (%s),%s\n",register_name(creg,0),register_name(creg,0)); printf("\tdecl (%s)\n",register_name(creg,0)); return; case CPREDEC: @@ -531,7 +531,7 @@ emit_push(); e2 = emit_pop(0); printf("\tdecl (%s)\n",register_name(e2,0)); - printf("\tmovsbl (%s),%s\n",register_name(e2,1),register_name(creg,0)); + printf("\tmovsbl (%s),%s\n",register_name(e2,0),register_name(creg,0)); return; case MUL: case UMUL: case DIV: case UDIV: @@ -938,7 +938,7 @@ emit_push(); } /* compute arguments in reverse order */ -/* printf("# jump code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */ +/* printf("## jump code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */ regs = 0; i=MAX_REGISTER_VAR; for (e3=nargs; e3;e3 =cadr(e3)) { @@ -955,7 +955,7 @@ case RLVAR: case CRLVAR: if (env==0 && fnptr->sc==CODE) { -/* printf("# e5=%d car(e3)=%d\n",e5,car(e3)); */ +/* printf("## e5=%d car(e3)=%d\n",e5,car(e3)); */ if (e5>=0 && e5==car(e3)) { /* The same positioned local variable. No need to copy */ reg_stack[reg_sp++] = -2; @@ -966,7 +966,7 @@ emit_push(); break; case REGISTER: -/* printf("# i=%d rname[e5]=%d\n",i,rname[e5]); */ +/* printf("## i=%d rname[e5]=%d\n",i,rname[e5]); */ if (i>0 && rname[e5]==REG_ESI+ --i) { /* The same register variable. No need to copy */ reg_stack[reg_sp++] = e5; @@ -987,7 +987,7 @@ } /* force lvar offset mode to CODE */ scode = fnptr->sc; fnptr->sc = CODE; -/* printf("# jump2 code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */ +/* printf("## jump2 code_arg_offset=%d code_disp_offset=%d\n",code_arg_offset,code_disp_offset); */ /* copy arguments to destination environment if necessary */ nargs = reverse0(nargs); /* pop in normal order */ i=0; @@ -1059,7 +1059,7 @@ op = ((byte = (car(e1) == CRINDIRECT)) ? "movsbl" : "movl"); e3 = cadr(e2 = cadr(e1)); g_expr(e2); - printf("\t%s (%s),%s\n",op,register_name(creg,byte),register_name(creg,byte)); + printf("\t%s (%s),%s\n",op,register_name(creg,0),register_name(creg,0)); } void @@ -1115,7 +1115,10 @@ e2 = emit_pop(0); if (byte) use_data_reg(creg,1); printf("\t%s %s,(%s)\n",op,register_name(e2,byte),register_name(creg,0)); - printf("\tmovl %s,%s\n",register_name(e2,0),register_name(creg,0)); + free_register(creg); + creg = e2; + regs[creg]=1; + /* printf("\tmovl %s,%s\n",register_name(e2,0),register_name(creg,0)); */ return; } @@ -1158,7 +1161,7 @@ tosop(op); if(new_reg>=0) free_register(new_reg); printf("\tpopl %s # assop \n",register_name(dreg,0)); - printf("\t%s %s,(%s)\n",byte ? "movb" : "movl",register_name(creg,byte),register_name(dreg,byte)); + printf("\t%s %s,(%s)\n",byte ? "movb" : "movl",register_name(creg,byte),register_name(dreg,0)); return; } @@ -1411,7 +1414,7 @@ void gen_comment(char *s) { - printf("# %s",s); + printf("## %s",s); } void @@ -1436,7 +1439,7 @@ if(disp0) { printf("\tsubl $%d,%%esp\n",-disp0); } -printf("# args %d disp %d code_arg_offset=%d code_disp_offset=%d\n",args,disp,code_arg_offset,code_disp_offset); +printf("## args %d disp %d code_arg_offset=%d code_disp_offset=%d\n",args,disp,code_arg_offset,code_disp_offset); } void
--- a/mc-parse.c Mon Feb 03 17:52:54 2003 +0900 +++ b/mc-parse.c Mon Feb 03 23:11:21 2003 +0900 @@ -153,7 +153,6 @@ } if (!chk) if ( (freopen(ccout,"w",stdout)) == NULL ) error(FILERR); -printf("test\n"); init(); while(1) { for (nptr = &ntable[GSYMS],i=LSYMS; i--;) {
--- a/stdio.h Mon Feb 03 17:52:54 2003 +0900 +++ b/stdio.h Mon Feb 03 23:11:21 2003 +0900 @@ -11,6 +11,7 @@ #define stderr (&__sF[2]) #else +#ifdef bsd extern FILE __sstdin; extern FILE __sstdout; extern FILE __sstderr; @@ -18,6 +19,17 @@ #define stdin (&__sstdin) #define stdout (&__sstdout) #define stderr (&__sstderr) +#else +/* new Linux */ +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; +/* +#define stdin stdin +#define stdout stdout +#define stderr stderr + */ +#endif #endif #define BUFSIZ 1024 /* size of buffer used by setbuf */