changeset 602:429ec87e03e7

*** empty log message ***
author kono
date Fri, 27 Jan 2006 14:35:38 +0900
parents 6b808480f08b
children 2baddc88097d
files Makefile Makefile.ia32 Makefile.linuxzaurus Makefile.mips Makefile.powerpc mc-codegen.c mc.h
diffstat 7 files changed, 165 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Jan 27 11:07:44 2006 +0900
+++ b/Makefile	Fri Jan 27 14:35:38 2006 +0900
@@ -177,10 +177,11 @@
 depend :
 	makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
 		mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
-		mc-macro.c mc-macro.h mc-parse.h \
+		mc-macro.c mc-inline.c mc-macro.h mc-parse.h \
 	    conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
                 mc-code-powerpc.c \
+                mc-code-arm.c \
                 mc-code-mips.c
 
 clean :
@@ -267,6 +268,10 @@
 mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
 mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h
+mc-inline.o: /usr/include/stdio.h /usr/include/_types.h
+mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
+mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
+mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
 conv/c.o: /usr/include/stdio.h /usr/include/_types.h
 conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
@@ -287,6 +292,10 @@
 mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h
 mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h
+mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h
+mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
+mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
+mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h
 mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h
 mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
--- a/Makefile.ia32	Fri Jan 27 11:07:44 2006 +0900
+++ b/Makefile.ia32	Fri Jan 27 14:35:38 2006 +0900
@@ -175,9 +175,10 @@
 depend :
 	makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
 		mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
-		mc-macro.c mc-macro.h mc-parse.h \
+		mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
 	    conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
+                mc-code-arm.c \
                 mc-code-powerpc.c \
                 mc-code-mips.c
 
--- a/Makefile.linuxzaurus	Fri Jan 27 11:07:44 2006 +0900
+++ b/Makefile.linuxzaurus	Fri Jan 27 14:35:38 2006 +0900
@@ -176,9 +176,10 @@
 depend :
 	makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
 		mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
-		mc-macro.c mc-macro.h mc-parse.h \
+		mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
 	    conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
+                mc-code-arm.c \
                 mc-code-powerpc.c \
                 mc-code-mips.c
 
--- a/Makefile.mips	Fri Jan 27 11:07:44 2006 +0900
+++ b/Makefile.mips	Fri Jan 27 14:35:38 2006 +0900
@@ -174,9 +174,10 @@
 depend :
 	makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
 		mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
-		mc-macro.c mc-macro.h mc-parse.h \
+		mc-inline.c mc-macro.c mc-macro.h mc-parse.h \
 	    conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
+                mc-code-arm.c \
                 mc-code-powerpc.c \
                 mc-code-mips.c
 
--- a/Makefile.powerpc	Fri Jan 27 11:07:44 2006 +0900
+++ b/Makefile.powerpc	Fri Jan 27 14:35:38 2006 +0900
@@ -14,7 +14,7 @@
 MC=mc-$(ARCH)
 MLIB = -lm
 PRINTF= # printf.c
-CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/c2cbc.o conv/cbc2c.o
+CONVERTER=conv/c.o conv/null.o conv/c2cbc.o conv/cbc2c.o
 COMPLIB = mc-parse.o mc-codegen.o mc-switch.o mc-macro.o mc-tree.o mc-inline.o
 # CODE=mc-code-ia32.c
 CODE=mc-code-$(ARCH).c
@@ -177,10 +177,11 @@
 depend :
 	makedepend mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \
 		mc-parse.c mc-tree.c mc-switch.c mc-switch.h mc.h \
-		mc-macro.c mc-macro.h mc-parse.h \
+		mc-macro.c mc-inline.c mc-macro.h mc-parse.h \
 	    conv/c.c conv/c.h conv/c2cbc.c conv/c2cbc.h conv/cbc2c.c \
 	    conv/cbc2c.h conv/conv.h conv/convdef.h conv/null.c conv/null.h \
                 mc-code-powerpc.c \
+                mc-code-arm.c \
                 mc-code-mips.c
 
 clean :
@@ -258,7 +259,7 @@
 mc-tree.o: /usr/include/stdio.h /usr/include/_types.h
 mc-tree.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-tree.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
-mc-tree.o: mc-parse.h
+mc-tree.o: mc-parse.h mc-codegen.h
 mc-switch.o: /usr/include/stdio.h /usr/include/_types.h
 mc-switch.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-switch.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
@@ -267,15 +268,22 @@
 mc-macro.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-macro.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
 mc-macro.o: mc-parse.h mc-macro.h mc-codegen.h mc-code.h
+mc-inline.o: /usr/include/stdio.h /usr/include/_types.h
+mc-inline.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
+mc-inline.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
+mc-inline.o: mc-parse.h mc-codegen.h mc-switch.h mc-code.h mc-inline.h
 conv/c.o: /usr/include/stdio.h /usr/include/_types.h
 conv/c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 conv/c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
-conv/c.o: mc-parse.h conv/conv.h conv/convdef.h conv/c.h
+conv/c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c.h
 conv/c2cbc.o: /usr/include/stdio.h /usr/include/_types.h
 conv/c2cbc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 conv/c2cbc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
-conv/c2cbc.o: mc-parse.h conv/conv.h conv/convdef.h conv/c2cbc.h
-conv/cbc2c.o: mc.h
+conv/c2cbc.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/c2cbc.h
+conv/cbc2c.o: /usr/include/stdio.h /usr/include/_types.h
+conv/cbc2c.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
+conv/cbc2c.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
+conv/cbc2c.o: mc-parse.h mc-codegen.h conv/conv.h conv/convdef.h conv/cbc2c.h
 conv/null.o: /usr/include/stdio.h /usr/include/_types.h
 conv/null.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 conv/null.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
@@ -284,6 +292,10 @@
 mc-code-powerpc.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-code-powerpc.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h
 mc-code-powerpc.o: mc.h mc-parse.h mc-code.h mc-codegen.h
+mc-code-arm.o: /usr/include/stdio.h /usr/include/_types.h
+mc-code-arm.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
+mc-code-arm.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
+mc-code-arm.o: mc-parse.h mc-code.h mc-codegen.h
 mc-code-mips.o: /usr/include/stdio.h /usr/include/_types.h
 mc-code-mips.o: /usr/include/sys/_types.h /usr/include/sys/cdefs.h
 mc-code-mips.o: /usr/include/machine/_types.h /usr/include/ppc/_types.h mc.h
--- a/mc-codegen.c	Fri Jan 27 11:07:44 2006 +0900
+++ b/mc-codegen.c	Fri Jan 27 14:35:38 2006 +0900
@@ -3600,9 +3600,9 @@
     case INT:		break;
     case UNSIGNED:	break;
     case VOID:		break;
-    case CHAR:		op=COP; type=set_type_with_attr(INT,type); break;
+    case CHAR:		op=COP;    type=set_type_with_attr(INT,type); break;
     case UCHAR:		op=COP+US; type=set_type_with_attr(UNSIGNED,type); break;
-    case SHORT:		op=SOP; type=set_type_with_attr(SHORT,type); break;
+    case SHORT:		op=SOP;    type=set_type_with_attr(SHORT,type); break;
     case USHORT:	op=SOP+US; type=set_type_with_attr(UNSIGNED,type); break;
     case LONGLONG:	op=LOP; break;
     case ULONGLONG:	op=LOP+US; break;
@@ -3628,11 +3628,14 @@
 	case POINTER:
 	    break;
 	case BIT_FIELD:
-	    e =  list3(RBIT_FIELD,cadr(e),type);
+	    if (car(e)==BIT_FIELD) {
+		e =  list3(RBIT_FIELD,cadr(e),type);
             /*                         byte rvalue,   store type */
+	    } else {
+		e =  list3(RBIT_FIELD,e,type);
+	    }
 	    type=set_type_with_attr(cadr(type0),type);/* value type */
 	    return e;
-	    break;
 	default:
 	    error(TYERR);
 	}
@@ -3767,7 +3770,8 @@
     type = search_struct_type(type,nptr->nm,&dsp);
     if (!type) { error(TYERR); type=INT; return e; }
     if (inmode) {
-	e = e1;
+	// bitfield will be checked after parse
+	return e1;
     } else if(dsp) {
 	switch(car(e)) {
 	case GVAR:
--- a/mc.h	Fri Jan 27 11:07:44 2006 +0900
+++ b/mc.h	Fri Jan 27 14:35:38 2006 +0900
@@ -161,27 +161,28 @@
 #define COMMENT  	11
 #define DECL  	12
 #define COMP  	13
-#define LABEL  	14
-#define IVAR  	15
+#define IVAR  	14
+#define RIVAR	15
+#define LABEL  	16
 
 #define NULLARY_ARGS(i) (i==RETURN||i==ENVIRONMENT||i==LCALL||i==REGISTER||i==DREGISTER||i==FREGISTER||i==LREGISTER||(GVAR<=(i%SOP)&&(i%SOP)<=LABEL))
 
 /* unary  argments */
 
-#define ADDRESS	16
-#define MINUS  	17
-#define LNOT   	18
-#define BNOT   	19
-#define INC    	20
-#define POSTINC	21
-#define UPOSTINC       	22
-#define PREINC 	23
-#define UPREINC	24
-#define POSTDEC	25
-#define UPOSTDEC       	26
-#define PREDEC 	27
-#define UPREDEC	28
-#define DEC    	29
+#define ADDRESS	17
+#define MINUS  	18
+#define LNOT   	19
+#define BNOT   	20
+#define INC    	21
+#define POSTINC	22
+#define UPOSTINC       	23
+#define PREINC 	24
+#define UPREINC	25
+#define POSTDEC	26
+#define UPOSTDEC       	27
+#define PREDEC 	28
+#define UPREDEC	29
+#define DEC    	30
 #define CPOSTINC (COP+POSTINC)
 #define CUPOSTINC (COP+UPOSTINC)
 #define CPREINC (COP+PREINC)
@@ -206,9 +207,9 @@
 #define LPREINC (LOP+PREINC)
 #define LUPOSTINC       (LOP+UPOSTINC)
 #define LUPREINC        (LOP+UPREINC)
-#define INDIRECT       	30
-#define RINDIRECT      	31
-#define URINDIRECT     	32
+#define INDIRECT       	31
+#define RINDIRECT      	32
+#define URINDIRECT     	33
 #define CRINDIRECT      (COP+RINDIRECT)
 #define CURINDIRECT     (COP+URINDIRECT)
 #define SRINDIRECT      (SOP+RINDIRECT)
@@ -217,61 +218,63 @@
 #define DRINDIRECT      (DOP+RINDIRECT)
 #define LRINDIRECT      (LOP+RINDIRECT)
 #define LURINDIRECT     (LOP+URINDIRECT)
-#define RSTRUCT	33
-#define ALLOCA 	34
-#define BUILTINP 	35
-#define BUILTIN_EXPECT 	36
-#define ATTRIBUTE 	37
-#define BIT_FIELD 	38
-#define RBIT_FIELD 	39
-#define BPREINC 	40
-#define BPOSTINC 	41
-#define CONV   	42
+#define RSTRUCT	34
+#define ALLOCA 	35
+#define BUILTINP 	36
+#define BUILTIN_EXPECT 	37
+#define ATTRIBUTE 	38
+#define BIT_FIELD 	39
+#define RBIT_FIELD 	40
+#define BPREINC 	41
+#define BPOSTINC 	42
+#define RPERIOD	43
+#define RARROW	44
+#define CONV   	45
 
 #define UNARY_ARGS(i) (ADDRESS<=(i%SOP)&&(i%SOP)<=CONV)
 
 /* binary  argments */
 
-#define MUL    	43
-#define UMUL   	44
-#define DIV    	45
-#define UDIV   	46
-#define MOD    	47
-#define UMOD   	48
-#define ADD    	49
-#define SUB    	50
-#define CMP    	51      
-#define RSHIFT 	52
-#define URSHIFT	53
-#define LSHIFT 	54
-#define ULSHIFT	55
-#define GT     	56
-#define UGT    	57
-#define GE     	58
-#define UGE    	59
-#define LT     	60
-#define ULT    	61
-#define LE     	62
-#define ULE    	63
-#define EQ     	64
-#define NEQ    	65
-#define BAND   	66
-#define EOR    	67
-#define BOR    	68
-#define LAND   	69
-#define LOR    	70
-#define ASS    	71
-#define UCMP   	72
-#define UCMPGE 	73
-#define CMPGE  	74
-#define CMPEQ  	75
-#define CMPNEQ 	76
-#define ASSOP  	77
-#define COMMA  	78
+#define MUL    	46
+#define UMUL   	47
+#define DIV    	48
+#define UDIV   	49
+#define MOD    	50
+#define UMOD   	51
+#define ADD    	52
+#define SUB    	53
+#define CMP    	54      
+#define RSHIFT 	55
+#define URSHIFT	56
+#define LSHIFT 	57
+#define ULSHIFT	58
+#define GT     	59
+#define UGT    	60
+#define GE     	61
+#define UGE    	62
+#define LT     	63
+#define ULT    	64
+#define LE     	65
+#define ULE    	66
+#define EQ     	67
+#define NEQ    	68
+#define BAND   	69
+#define EOR    	70
+#define BOR    	71
+#define LAND   	72
+#define LOR    	73
+#define ASS    	74
+#define UCMP   	75
+#define UCMPGE 	76
+#define CMPGE  	77
+#define CMPEQ  	78
+#define CMPNEQ 	79
+#define ASSOP  	80
+#define COMMA  	81
 
-#define CASS   	79
-#define CASSOP 	80
-#define CUASSOP	81
+#define CASS   	82
+#define CASSOP 	83
+#define CUASSOP	84
 
 #define SASS    (SOP+CASS)
 #define SASSOP (SOP+CASSOP)
@@ -327,19 +330,19 @@
 #define LEOR    (LOP+EOR)
 #define LBOR    (LOP+BOR)
 
-#define BASS   	82
-#define BASSOP 	83
-#define BFD_REPL 	84
+#define BASS   	85
+#define BASSOP 	86
+#define BFD_REPL 	87
 
-#define STASS  	85
+#define STASS  	88
 
 
 #define BINARY_ARGS(i) (MUL<=(i%SOP)&&(i%SOP)<=STASS)
 
 /* tarnary  argments */
 
-#define COND   	86
-#define UCOND  	87
+#define COND   	89
+#define UCOND  	90
 #define SCOND   (SOP+COND)
 #define SUCOND   (SOP+UCOND)
 #define DCOND   (DOP+COND)
@@ -351,35 +354,35 @@
 
 /* not appeared as tags */
 
-#define LPAR   	88
-#define RPAR   	89
-#define LBRA   	90
-#define RBRA   	91
-#define LC     	92
-#define RC     	93
-#define COLON  	94
-#define SM     	95
-#define PERIOD 	96
-#define ARROW  	97
-#define CNAME  	98
+#define LPAR   	91
+#define RPAR   	92
+#define LBRA   	93
+#define RBRA   	94
+#define LC     	95
+#define RC     	96
+#define COLON  	97
+#define SM     	98
+#define PERIOD 	99
+#define ARROW  	100
+#define CNAME  	101
 
-#define I2C  	99
-#define I2S  	100
-#define I2I    	101
-#define I2U    	102
-#define I2D    	103
-#define I2F    	104
-#define I2LL   	105
-#define I2ULL  	106
+#define I2C  	102
+#define I2S  	103
+#define I2I    	104
+#define I2U    	105
+#define I2D    	106
+#define I2F    	107
+#define I2LL   	108
+#define I2ULL  	109
 
-#define U2UC  	107
-#define U2US  	108
-#define U2I    	109
-#define U2U    	110
-#define U2D    	111
-#define U2F    	112
-#define U2LL   	113
-#define U2ULL  	114
+#define U2UC  	110
+#define U2US  	111
+#define U2I    	112
+#define U2U    	113
+#define U2D    	114
+#define U2F    	115
+#define U2LL   	116
+#define U2ULL  	117
 
 
 #define D2I     (DOP+I2I)
@@ -414,27 +417,27 @@
 
 /* statement start */
 
-#define ST_DECL		115
-#define ST_IF		116
-#define ST_DO		117
-#define ST_WHILE	118
-#define ST_FOR		119
-#define ST_SWITCH	120
-#define ST_COMP		121
-#define ST_BREAK	122
-#define ST_CONTINUE	123
-#define ST_CASE		124
-#define ST_DEFAULT	125
-#define ST_RETURN	126
-#define ST_GOTO		127
-#define ST_ASM		128
-#define ST_LABEL	129
-#define ST_OP		130
-#define ST_COMMENT	131
+#define ST_DECL		118
+#define ST_IF		119
+#define ST_DO		120
+#define ST_WHILE	121
+#define ST_FOR		122
+#define ST_SWITCH	123
+#define ST_COMP		124
+#define ST_BREAK	125
+#define ST_CONTINUE	126
+#define ST_CASE		127
+#define ST_DEFAULT	128
+#define ST_RETURN	129
+#define ST_GOTO		130
+#define ST_ASM		131
+#define ST_LABEL	132
+#define ST_OP		133
+#define ST_COMMENT	134
 
 #define IS_STATEMENT(i) (i==INLINE||(ST_DECL<=i&&i<=ST_COMMENT))
 
-#define HAS_ADDRESS	132
+#define HAS_ADDRESS	135
 
 /* statement end */