changeset 225:8675ea3d2c7f

*** empty log message ***
author kono
date Mon, 26 Apr 2004 14:07:43 +0900
parents 82a55cc6b5fc
children a31e1d24c097
files Makefile mc-code-ia32.c
diffstat 2 files changed, 65 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Mon Apr 26 12:17:19 2004 +0900
+++ b/Makefile	Mon Apr 26 14:07:43 2004 +0900
@@ -100,7 +100,7 @@
 	-./$(MC) -s $(TARGET).c
 	-gcc $(TARGET).s $(MLIB)
 	-./a.out > $(TARGET).$(MC).out
-	-diff  $(TARGET).gcc.out $(TARGET).$(MC).out
+	-diff $(TARGET).gcc.out $(TARGET).$(MC).out
 
 check-code: $(MC)
 	-./$(MC) -s $(TARGET).c
@@ -188,63 +188,71 @@
 mc-code-ia32.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-code-ia32.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-code-ia32.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-code-ia32.o: conv/conv.h mc-codegen.h mc-code.h
+mc-code-ia32.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+mc-code-ia32.o: mc-codegen.h mc-code.h
 mc-codegen.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 mc-codegen.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc-codegen.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-codegen.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-codegen.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-codegen.o: conv/conv.h mc-codegen.h mc-code.h
+mc-codegen.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+mc-codegen.o: mc-codegen.h mc-code.h
 mc-parse.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 mc-parse.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc-parse.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-parse.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-parse.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-parse.o: conv/conv.h mc-codegen.h
+mc-parse.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+mc-parse.o: mc-codegen.h
 mc-tree.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 mc-tree.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc-tree.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-tree.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-tree.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-tree.o: conv/conv.h
+mc-tree.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
 mc.o: /usr/include/stdio.h /usr/include/sys/types.h
 mc.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
-mc.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h conv/conv.h
+mc.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
+mc.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
 conv/c.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 conv/c.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 conv/c.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 conv/c.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
-conv/c.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h conv/conv.h
+conv/c.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
+conv/c.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
 conv/c.o: conv/convdef.h conv/c.h
 conv/c2cbc.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 conv/c2cbc.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 conv/c2cbc.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 conv/c2cbc.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 conv/c2cbc.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-conv/c2cbc.o: conv/conv.h
+conv/c2cbc.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
 conv/cbc2c.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 conv/cbc2c.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 conv/cbc2c.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 conv/cbc2c.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 conv/cbc2c.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-conv/cbc2c.o: conv/conv.h
+conv/cbc2c.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
 conv/null.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 conv/null.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 conv/null.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 conv/null.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 conv/null.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-conv/null.o: conv/conv.h conv/convdef.h conv/null.h
+conv/null.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+conv/null.o: conv/convdef.h conv/null.h
 mc-code-powerpc.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 mc-code-powerpc.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc-code-powerpc.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-code-powerpc.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-code-powerpc.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-code-powerpc.o: conv/conv.h mc-code.h mc-codegen.h
+mc-code-powerpc.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+mc-code-powerpc.o: mc-code.h mc-codegen.h
 mc-code-mips.o: mc.h /usr/include/stdio.h /usr/include/sys/types.h
 mc-code-mips.o: /usr/include/sys/appleapiopts.h /usr/include/sys/cdefs.h
 mc-code-mips.o: /usr/include/machine/types.h /usr/include/ppc/types.h
 mc-code-mips.o: /usr/include/machine/ansi.h /usr/include/ppc/ansi.h
 mc-code-mips.o: /usr/include/machine/endian.h /usr/include/ppc/endian.h
-mc-code-mips.o: conv/conv.h mc-code.h mc-codegen.h
+mc-code-mips.o: /usr/include/stdlib.h /usr/include/alloca.h conv/conv.h
+mc-code-mips.o: mc-code.h mc-codegen.h
--- a/mc-code-ia32.c	Mon Apr 26 12:17:19 2004 +0900
+++ b/mc-code-ia32.c	Mon Apr 26 14:07:43 2004 +0900
@@ -9,6 +9,8 @@
 char *l_include_path[] = {
     "/usr/include/",
     "/usr/include/linux/",
+    "/usr/include/diet/",
+    "/usr/lib/gcc-lib/i386-linux/2.95.4/include/",
     "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/",
     0
 };
@@ -170,6 +172,7 @@
     macro_define("__flexarr\n");
     macro_define("__builtin_va_list int*\n");
     macro_define("wchar_t int\n");
+    macro_define("__THROW\n");
 
     arg_offset = 8;
     func_disp_offset = -12;
@@ -721,7 +724,7 @@
 
 
 void
-code_bool(int e1) {
+code_bool(int e1,int reg) {
     char *xrn;
     int e2,e3;
     b_expr(e1,1,e2=fwdlabel(),1);  /* including > < ... */
@@ -760,7 +763,7 @@
 }
 
 void
-code_cmp_crgvar(int e1,int sz) {
+code_cmp_crgvar(int e1,int reg,int sz) {
     if (sz==1)
 	printf("\tcmpb $0,%s\n",((NMTBL*)cadr(e1))->nm);
     else if (sz==size_of_short)
@@ -769,7 +772,7 @@
 
 
 void
-code_cmp_crlvar(int e1,int sz) {
+code_cmp_crlvar(int e1,int reg,int sz) {
     if (sz==1)
 	printf("\tcmpb $0,%d(%%ebp)\n",lvar(e1));
     else if (sz==size_of_short)
@@ -778,13 +781,13 @@
 
 
 void
-code_cmp_rgvar(int e1) {
+code_cmp_rgvar(int e1,int reg) {
     printf("\tcmpl $0,%s\n",((NMTBL*)cadr(e1))->nm);
 }
 
 
 void
-code_cmp_rlvar(int e1) {
+code_cmp_rlvar(int e1,int reg) {
     printf("\tcmpl $0,%d(%%ebp)\n",lvar(e1));
 }
 
@@ -1089,7 +1092,7 @@
 }
 
 int
-code_rindirect(int e1, int offset, int us)
+code_rindirect(int e1, int reg,int offset, int us)
 {
     char *crn,*op;
     int byte;
@@ -1101,7 +1104,7 @@
 }
 
 int
-code_crindirect(int e1, int offset, int us)
+code_crindirect(int e1, int reg,int offset, int us)
 {
     char *crn,*op;
     int byte;
@@ -1113,7 +1116,7 @@
 }
 
 int
-code_srindirect(int e1, int offset, int us)
+code_srindirect(int e1, int reg,int offset, int us)
 {
     char *crn,*op;
     int byte;
@@ -1126,7 +1129,7 @@
 
 #if FLOAT_CODE
 int
-code_drindirect(int e1, int offset, int d)
+code_drindirect(int e1, int reg,int offset, int d)
 {
     g_expr(e1);
     printf("\t%s (%s)\n",fload(d),register_name(creg,0));
@@ -1136,7 +1139,7 @@
 
 #if LONGLONG_CODE
 int
-code_lrindirect(int e1, int offset, int us)
+code_lrindirect(int e1, int reg, int offset, int us)
 {
     return LONGLONG;
 }
@@ -1173,11 +1176,11 @@
 }
 
 void
-code_register_assop(int e2,int op,int byte) {
+code_register_assop(int e2,int reg0,int op,int byte) {
     int reg;
     int xreg = creg;
     creg = reg = e2;
-    tosop(op,xreg);
+    tosop(op,reg,xreg);
     creg = xreg;
     printf("\tmovl %s,%s\n",register_name(reg,0),register_name(creg,0));
     regs[creg]=regv[creg]=1;
@@ -1185,7 +1188,7 @@
 
 
 void
-code_assop(int op,int byte,int sign) {
+code_assop(int op,int reg,int byte,int sign) {
     char *xrn;
     int xreg;
     int edx = edx_setup();
@@ -1194,7 +1197,7 @@
     printf("\tmovl %s,%s  # assop \n",register_name(creg,0),register_name(edx,0));
     regv[edx]=1;
     ld_indexx(byte,0,edx,sign);
-    tosop(op,xreg);
+    tosop(op,reg,xreg);
     printf("\t%s %s,(%s)\n",move(byte),register_name(creg,byte),register_name(edx,0));
     edx_cleanup();
     emit_pop_free(xreg);
@@ -1203,7 +1206,7 @@
 
 
 void
-tosop(int op,int oreg)
+tosop(int op,int reg,int oreg)
 {
     int dx;
     char *orn,*crn;
@@ -1298,7 +1301,7 @@
 }
 
 void
-oprtc(int op,int orn)
+oprtc(int op,int reg,int orn)
 {
     char *crn = register_name(creg,0);
 
@@ -1903,17 +1906,17 @@
     printf("\t%s %d(%%ebp)\n",fload(d),lvar(e2));
 }
 
-void code_cmp_drgvar(int e2,int d)
+void code_cmp_drgvar(int e2,int reg,int d)
 { 
     printf("\tfcomp %s\n",((NMTBL*)cadr(e2))->nm);
 }
 
-void code_cmp_drlvar(int e2,int d)
+void code_cmp_drlvar(int e2,int reg,int d)
 { 
     printf("\tfcomp %d(%%ebp)\n",lvar(e2));
 }
 
-void dtosop(int op,int e1)
+void dtosop(int op,int reg,int e1)
 {
     switch(op) {
     case FADD:
@@ -1933,11 +1936,11 @@
 }
 
 void
-code_dassop(int op,int d) {
+code_dassop(int op,int reg,int d) {
     /* we have lvalue in creg, applied floating value is in %st(0) */
     emit_dpop(d);                            /* do nothing for 387 */
     printf("\t%s (%s)\n",fload(d),register_name(creg,0));
-    dtosop(op,0);
+    dtosop(op,reg,0);
     printf("\t%s (%s)\n",fstore(d),register_name(creg,0));
 }
 
@@ -2175,13 +2178,13 @@
 
 }
 
-void ltosop(int e1,int e2)
+void ltosop(int e1,int reg,int e2)
 {
 
 }
 
 int code_lconst_op_p(int op,int e) {return 0;}
-void loprtc(int op,int e) {}
+void loprtc(int op,int reg,int e) {}
 
 void emit_lpop_free(int e1)
 {
@@ -2193,93 +2196,93 @@
 
 }
 
-void code_i2ll(int creg)
+void code_i2ll()
 {
 
 }
 
-void code_i2ull(int creg)
+void code_i2ull()
 {
 
 }
 
-void code_u2ll(int creg)
+void code_u2ll()
 {
 
 }
 
-void code_u2ull(int creg)
+void code_u2ull()
 {
 
 }
 
-void code_ll2i(int creg)
+void code_ll2i()
 {
 
 }
 
-void code_ll2u(int creg)
+void code_ll2u()
 {
 
 }
 
-void code_ull2i(int creg)
+void code_ull2i()
 {
 
 }
 
-void code_ull2u(int creg)
+void code_ull2u()
 {
 
 }
 
 #if FLOAT_CODE
-void code_d2ll(int creg)
+void code_d2ll()
 {
 
 }
 
-void code_d2ull(int creg)
+void code_d2ull()
 {
 
 }
 
-void code_f2ll(int creg)
+void code_f2ll()
 {
 
 }
 
-void code_f2ull(int creg)
+void code_f2ull()
 {
 
 }
 
-void code_ll2d(int creg)
+void code_ll2d()
 {
 
 }
 
-void code_ll2f(int creg)
+void code_ll2f()
 {
 
 }
 
-void code_ull2d(int creg)
+void code_ull2d()
 {
 
 }
 
-void code_ull2f(int creg)
+void code_ull2f()
 {
 
 }
 
-void code_ull2ll(int creg)
+void code_ull2ll()
 {
 
 }
 
-void code_ull2ull(int creg)
+void code_ull2ull()
 {
 
 }
@@ -2297,7 +2300,7 @@
 
 }
 
-void code_lassop(int op)
+void code_lassop(int op,int reg)
 {
 
 }