changeset 62:129f4802b027

separation done
author kono
date Thu, 20 Feb 2003 05:27:29 +0900
parents 8ffb8ca3fe34
children e13486b2c12e
files Makefile mc-code-ia32.c mc-nop-386.c mc-parse.c mc.h
diffstat 5 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Feb 20 03:29:15 2003 +0900
+++ b/Makefile	Thu Feb 20 05:27:29 2003 +0900
@@ -23,19 +23,19 @@
 clean :
 	-rm -f *.s *.o mc mc1 a.out *~ core* */*.o
 
-mc1 : b00.s b01.s mc-tree.o
-	$(CC) -g -o $@ $(PRINTF) mc-tree.o b00.s b01.s 
+mc1 : b00.s b01.s mc-codegen.o mc-tree.o $CONVERTER
+	$(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o $CONVERTER
 b00.s : mc-parse.c mc
 	./mc -s mc-parse.c
 	mv mcout.s $@ 
-b01.s : mc-nop-386.c mc
-	./mc -s mc-nop-386.c 
+b01.s : mc-code-ia32.c mc
+	./mc -s mc-code-ia32.c 
 	mv mcout.s $@ 
 b10.s : mc-parse.c mc1
 	./mc1 -s mc-parse.c
 	mv mcout.s $@ 
-b11.s : mc-nop-386.c $(PRINTF) mc1
-	./mc1 -s mc-nop-386.c 
+b11.s : mc-code-ia32.c $(PRINTF) mc1
+	./mc1 -s mc-code-ia32.c 
 	mv mcout.s $@ 
 
 diff :  b00.s b01.s b10.s b11.s
--- a/mc-code-ia32.c	Thu Feb 20 03:29:15 2003 +0900
+++ b/mc-code-ia32.c	Thu Feb 20 05:27:29 2003 +0900
@@ -158,11 +158,6 @@
     }
 }
 
-extern int rname[MAX_MAX];
-extern int regs[MAX_MAX];       /* 使われているレジスタを示すフラグ */
-extern int reg_stack[MAX_MAX];  /* 実際のレジスタの領域 */
-extern int regv[MAX_MAX];       /* 値が入っているかどうか */
-
 extern int creg_regvar;
 
 void
@@ -329,7 +324,7 @@
 
 void
 code_crlvar(int e2) {
-    printf("\tmovsbl %d(%%ebp),%s\n",lvar(e2),register_name(creg,0));
+    printf("\tmovsbl %d(%%ebp),%s\n",e2,register_name(creg,0));
 }
 
 
@@ -788,7 +783,7 @@
 
 
 void
-code_fix_frame_pointer(disp_offset) {
+code_fix_frame_pointer(int disp_offset) {
     printf("\tlea %d(%%ebp),%%ebp\n",disp_offset);
 }
 
--- a/mc-nop-386.c	Thu Feb 20 03:29:15 2003 +0900
+++ b/mc-nop-386.c	Thu Feb 20 05:27:29 2003 +0900
@@ -1740,6 +1740,7 @@
 void
 code_leave(char *name)
 {
+    disp=(disp-(size_of_int-1))&(-(size_of_int-1));
     printf("\t.set _%d,%d\n",code_disp_label,disp+code_disp_offset);
     printf("_%d:\n",labelno);
     printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
@@ -1793,6 +1794,7 @@
     printf("\tpopl %%ebx\n");
     printf("\tleave\n");
     printf("\tret\n");
+    disp=(disp-(size_of_int-1))&(-(size_of_int-1));
     printf("\t.set _%d,%d\n",func_disp_label,disp+disp_offset);
     printf("_%d:\n",labelno);
     printf("\t.size\t%s,_%d-%s\n",name,labelno,name);
--- a/mc-parse.c	Thu Feb 20 03:29:15 2003 +0900
+++ b/mc-parse.c	Thu Feb 20 05:27:29 2003 +0900
@@ -1709,9 +1709,9 @@
 	getsym();
 	e2=rvalue(expr10());
 	if(t==INT&&type==INT) 
-	    e1=list3(op,e1,e2);
+	    e1=binop(op,e1,e2,t,type);
 	else 
-	    e1=list3(op+US,e1,e2);
+	    e1=binop(op+US,e1,e2,t,type);
 	type= INT;
     }
     return e1;
@@ -2137,10 +2137,28 @@
 	case RSHIFT:
 	    e=e1>>e2;break;
 	case LSHIFT:
-	    e=e1<<e2;
+	    e=e1<<e2;break;
+	case GT:
+	    e=(e1>e2);break;
+	case GE:
+	    e=(e1>=e2);break;
+	case LT:
+	    e=(e1<e2);break;
+	case LE:
+	    e=(e1<=e2);break;
+	case UGT:
+	    e=((unsigned)e1>(unsigned)e2);break;
+	case UGE:
+	    e=((unsigned)e1>=(unsigned)e2);break;
+	case ULT:
+	    e=((unsigned)e1<(unsigned)e2);break;
+	case ULE:
+	    e=((unsigned)e1<=(unsigned)e2);break;
 	}
 	return list2(CONST,e);
     }
+    if(op==GT||op==GE||op==LT||op==LE||op==UGT||op==UGE||op==ULT||op==ULE)
+	return(list3(op,e1,e2));
     if((op==ADD||op==MUL||op==BOR||op==EOR||op==BAND)&&
 	(car(e1)==CONST||(car(e2)!=CONST&&
 	(car(e1)==RGVAR||car(e1)==RLVAR)))) {
--- a/mc.h	Thu Feb 20 03:29:15 2003 +0900
+++ b/mc.h	Thu Feb 20 05:27:29 2003 +0900
@@ -243,7 +243,7 @@
 #include "conv/c.h"
 #include "conv/null.h"
 
-EXTERN Converter *conv;
+extern Converter *conv;
 
 
 EXTERN void error(int n);