Quellcode durchsuchen

made counting for register messages depending on a #define,
adapted makefile to make version with peephole optimizer library

ceriel vor 36 Jahren
Ursprung
Commit
a74e933a03

+ 4 - 0
lang/cem/cemcom/BigPars

@@ -129,3 +129,7 @@
 #undef NOCROSS		1	/* if NOT defined, cross compiler */
 
 
+!File: regcount.h
+#undef REGCOUNT		1	/* count occurrences for register messages */
+
+

+ 3 - 1
lang/cem/cemcom/Makefile

@@ -87,7 +87,8 @@ GHSRC =	botch_free.h dataflow.h debug.h density.h errout.h \
 	idfsize.h ifdepth.h inputtype.h lapbuf.h \
 	nobitfield.h nofloat.h nopp.h noRoption.h nocross.h \
 	nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
-	strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h
+	strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
+	regcount.h
 
 HSRC = LLlex.h align.h arith.h assert.h atw.h class.h faulty.h \
 	 input.h interface.h label.h level.h mes.h sizes.h specials.h \
@@ -681,6 +682,7 @@ conversion.o: type.h
 util.o: align.h
 util.o: nocross.h
 util.o: nofloat.h
+util.o: regcount.h
 util.o: sizes.h
 util.o: stack.h
 util.o: target_sizes.h

+ 514 - 11
lang/cem/cemcom/Makefile.erik

@@ -61,9 +61,17 @@ CFLAGS =	$(CDEFS) $(COPTIONS) -O# we cannot pass the COPTIONS to lint!
 
 # Grammar files and their objects
 LSRC =	tokenfile.g declar.g statement.g expression.g program.g ival.g
-GLCSRC = tokenfile.c declar.c statement.c expression.c program.c ival.c
+GLCSRC = tokenfile.c declar.c statement.c expression.c program.c Lpars.c ival.c
 LOBJ =	tokenfile.o declar.o statement.o expression.o program.o Lpars.o ival.o
 
+CSRC =  main.c idf.c declarator.c decspecs.c struct.c \
+        expr.c ch7.c ch7bin.c cstoper.c arith.c \
+        asm.c code.c dumpidf.c error.c field.c\
+        tokenname.c LLlex.c LLmessage.c \
+        input.c domacro.c replace.c init.c options.c \
+        scan.c skip.c stack.c type.c ch7mon.c label.c eval.c \
+        switch.c conversion.c util.c \
+        blocks.c dataflow.c Version.c
 # Objects of hand-written C files
 COBJ =	main.o idf.o declarator.o decspecs.o struct.o \
 	expr.o ch7.o ch7bin.o cstoper.o arith.o \
@@ -71,10 +79,11 @@ COBJ =	main.o idf.o declarator.o decspecs.o struct.o \
 	tokenname.o LLlex.o LLmessage.o \
 	input.o domacro.o replace.o init.o options.o \
 	scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \
-	switch.o conversion.o \
-	blocks.o dataflow.o Version.o util.o
+	switch.o conversion.o util.o \
+	blocks.o dataflow.o Version.o
 
 # Objects of other generated C files
+GCSRC = char.c symbol2str.c next.c
 GOBJ =	char.o symbol2str.o next.o
 
 # generated source files
@@ -87,7 +96,8 @@ GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \
 	idfsize.h ifdepth.h inputtype.h inumlength.h lapbuf.h \
 	nobitfield.h nofloat.h nopp.h noRoption.h nocross.h \
 	nparams.h numsize.h parbufsize.h pathlength.h \
-	strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h
+	strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
+	reg_count.h
 
 # Other generated files, for 'make clean' only
 GENERATED = tab tokenfile.g Lpars.h LLfiles LL.output lint.out \
@@ -153,6 +163,7 @@ util.h:		make.allocd
 
 # Objects needed for 'main'
 OBJ =	$(COBJ) $(LOBJ) $(GOBJ)
+SRC =	$(CSRC) $(LCSRC) $(GCSRC)
 
 main:	$(OBJ) Makefile
 	$(CC) $(COPTIONS) $(LFLAGS) $(OBJ) $(LIBS) -o main 
@@ -173,13 +184,13 @@ print:	files
 	pr `cat files` > print
 
 tags:	cfiles
-	ctags `sources $(OBJ)`
+	ctags $(SRC)
 
 shar:	files
 	shar `cat files`
 
 listcfiles:
-	@echo `sources $(OBJ)`
+	@echo $(SRC)
 
 listobjects:
 	@echo $(OBJ)
@@ -187,7 +198,7 @@ listobjects:
 depend:	cfiles
 	sed '/^#AUTOAUTO/,$$d' Makefile >Makefile.new
 	echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >>Makefile.new
-	$(MKDEP) `sources $(OBJ)` | sed 's/\.c:/.o:/' >>Makefile.new
+	$(MKDEP) $(SRC) | sed 's/\.c:/.o:/' >>Makefile.new
 	mv Makefile Makefile.old
 	mv Makefile.new Makefile
 	
@@ -200,13 +211,13 @@ lxref:
 lint:	lint.main lint.cem lint.tab
 
 lint.main: cfiles
-	$(LINT) -bx $(CDEFS) `sources $(OBJ)` $(LINTLIBS) >lint.out
+	$(LINT) -bx $(CDEFS) $(SRC) $(LINTLIBS) >lint.out
 
 cchk:
-	cchk `sources $(COBJ)`
+	cchk $(SRC)
 
 clean:
-	rm -f `sources $(LOBJ)` $(OBJ) $(GENERATED) $(GSRC) $(GHSRC)
+	rm -f $(LCSRC) $(OBJ) $(GENERATED) $(GSRC) $(GHSRC)
 
 tab:
 	$(CC) tab.c -o tab
@@ -215,6 +226,498 @@ lint.tab:
 	$(LINT) -abx tab.c
 
 sim:	cfiles
-	$(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC)
+	$(SIM) $(SIMFLAGS) $(CSRC) $(GSRC) $(LSRC)
 
 #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
+main.o: LLlex.h
+main.o: Lpars.h
+main.o: align.h
+main.o: arith.h
+main.o: debug.h
+main.o: declar.h
+main.o: file_info.h
+main.o: idf.h
+main.o: input.h
+main.o: inputtype.h
+main.o: level.h
+main.o: noRoption.h
+main.o: nobitfield.h
+main.o: nocross.h
+main.o: nofloat.h
+main.o: nopp.h
+main.o: sizes.h
+main.o: spec_arith.h
+main.o: specials.h
+main.o: target_sizes.h
+main.o: tokenname.h
+main.o: type.h
+main.o: use_tmp.h
+idf.o: LLlex.h
+idf.o: Lpars.h
+idf.o: align.h
+idf.o: arith.h
+idf.o: assert.h
+idf.o: botch_free.h
+idf.o: debug.h
+idf.o: declar.h
+idf.o: decspecs.h
+idf.o: def.h
+idf.o: file_info.h
+idf.o: idf.h
+idf.o: idfsize.h
+idf.o: label.h
+idf.o: level.h
+idf.o: noRoption.h
+idf.o: nobitfield.h
+idf.o: nocross.h
+idf.o: nofloat.h
+idf.o: nopp.h
+idf.o: sizes.h
+idf.o: spec_arith.h
+idf.o: specials.h
+idf.o: stack.h
+idf.o: struct.h
+idf.o: target_sizes.h
+idf.o: type.h
+declarator.o: Lpars.h
+declarator.o: arith.h
+declarator.o: botch_free.h
+declarator.o: declar.h
+declarator.o: expr.h
+declarator.o: idf.h
+declarator.o: label.h
+declarator.o: nobitfield.h
+declarator.o: nocross.h
+declarator.o: nofloat.h
+declarator.o: nopp.h
+declarator.o: sizes.h
+declarator.o: spec_arith.h
+declarator.o: target_sizes.h
+declarator.o: type.h
+decspecs.o: Lpars.h
+decspecs.o: arith.h
+decspecs.o: decspecs.h
+decspecs.o: def.h
+decspecs.o: level.h
+decspecs.o: noRoption.h
+decspecs.o: nobitfield.h
+decspecs.o: nofloat.h
+decspecs.o: spec_arith.h
+decspecs.o: type.h
+struct.o: LLlex.h
+struct.o: Lpars.h
+struct.o: align.h
+struct.o: arith.h
+struct.o: assert.h
+struct.o: botch_free.h
+struct.o: debug.h
+struct.o: def.h
+struct.o: field.h
+struct.o: file_info.h
+struct.o: idf.h
+struct.o: level.h
+struct.o: noRoption.h
+struct.o: nobitfield.h
+struct.o: nocross.h
+struct.o: nofloat.h
+struct.o: nopp.h
+struct.o: sizes.h
+struct.o: spec_arith.h
+struct.o: stack.h
+struct.o: struct.h
+struct.o: target_sizes.h
+struct.o: type.h
+expr.o: LLlex.h
+expr.o: Lpars.h
+expr.o: arith.h
+expr.o: botch_free.h
+expr.o: declar.h
+expr.o: decspecs.h
+expr.o: def.h
+expr.o: expr.h
+expr.o: file_info.h
+expr.o: idf.h
+expr.o: label.h
+expr.o: level.h
+expr.o: noRoption.h
+expr.o: nobitfield.h
+expr.o: nocross.h
+expr.o: nofloat.h
+expr.o: nopp.h
+expr.o: sizes.h
+expr.o: spec_arith.h
+expr.o: target_sizes.h
+expr.o: type.h
+ch7.o: Lpars.h
+ch7.o: arith.h
+ch7.o: assert.h
+ch7.o: debug.h
+ch7.o: def.h
+ch7.o: expr.h
+ch7.o: idf.h
+ch7.o: label.h
+ch7.o: nobitfield.h
+ch7.o: nofloat.h
+ch7.o: nopp.h
+ch7.o: spec_arith.h
+ch7.o: struct.h
+ch7.o: type.h
+ch7bin.o: Lpars.h
+ch7bin.o: arith.h
+ch7bin.o: botch_free.h
+ch7bin.o: expr.h
+ch7bin.o: idf.h
+ch7bin.o: label.h
+ch7bin.o: noRoption.h
+ch7bin.o: nobitfield.h
+ch7bin.o: nofloat.h
+ch7bin.o: nopp.h
+ch7bin.o: spec_arith.h
+ch7bin.o: struct.h
+ch7bin.o: type.h
+cstoper.o: Lpars.h
+cstoper.o: arith.h
+cstoper.o: assert.h
+cstoper.o: debug.h
+cstoper.o: expr.h
+cstoper.o: idf.h
+cstoper.o: label.h
+cstoper.o: nobitfield.h
+cstoper.o: nocross.h
+cstoper.o: nofloat.h
+cstoper.o: nopp.h
+cstoper.o: sizes.h
+cstoper.o: spec_arith.h
+cstoper.o: target_sizes.h
+cstoper.o: type.h
+arith.o: Lpars.h
+arith.o: arith.h
+arith.o: botch_free.h
+arith.o: expr.h
+arith.o: field.h
+arith.o: idf.h
+arith.o: label.h
+arith.o: mes.h
+arith.o: noRoption.h
+arith.o: nobitfield.h
+arith.o: nofloat.h
+arith.o: nopp.h
+arith.o: spec_arith.h
+arith.o: type.h
+code.o: LLlex.h
+code.o: Lpars.h
+code.o: align.h
+code.o: arith.h
+code.o: assert.h
+code.o: atw.h
+code.o: botch_free.h
+code.o: code.h
+code.o: dataflow.h
+code.o: debug.h
+code.o: declar.h
+code.o: decspecs.h
+code.o: def.h
+code.o: expr.h
+code.o: file_info.h
+code.o: idf.h
+code.o: label.h
+code.o: level.h
+code.o: mes.h
+code.o: noRoption.h
+code.o: nobitfield.h
+code.o: nocross.h
+code.o: nofloat.h
+code.o: nopp.h
+code.o: sizes.h
+code.o: spec_arith.h
+code.o: specials.h
+code.o: stack.h
+code.o: stmt.h
+code.o: target_sizes.h
+code.o: type.h
+code.o: use_tmp.h
+dumpidf.o: Lpars.h
+dumpidf.o: arith.h
+dumpidf.o: debug.h
+dumpidf.o: def.h
+dumpidf.o: expr.h
+dumpidf.o: field.h
+dumpidf.o: idf.h
+dumpidf.o: label.h
+dumpidf.o: nobitfield.h
+dumpidf.o: nofloat.h
+dumpidf.o: nopp.h
+dumpidf.o: spec_arith.h
+dumpidf.o: stack.h
+dumpidf.o: static.h
+dumpidf.o: struct.h
+dumpidf.o: type.h
+error.o: LLlex.h
+error.o: arith.h
+error.o: debug.h
+error.o: errout.h
+error.o: expr.h
+error.o: file_info.h
+error.o: label.h
+error.o: nofloat.h
+error.o: nopp.h
+error.o: spec_arith.h
+error.o: tokenname.h
+field.o: Lpars.h
+field.o: align.h
+field.o: arith.h
+field.o: assert.h
+field.o: code.h
+field.o: debug.h
+field.o: expr.h
+field.o: field.h
+field.o: idf.h
+field.o: label.h
+field.o: nobitfield.h
+field.o: nocross.h
+field.o: nofloat.h
+field.o: nopp.h
+field.o: sizes.h
+field.o: spec_arith.h
+field.o: target_sizes.h
+field.o: type.h
+tokenname.o: LLlex.h
+tokenname.o: Lpars.h
+tokenname.o: arith.h
+tokenname.o: file_info.h
+tokenname.o: idf.h
+tokenname.o: nofloat.h
+tokenname.o: nopp.h
+tokenname.o: spec_arith.h
+tokenname.o: tokenname.h
+LLlex.o: LLlex.h
+LLlex.o: Lpars.h
+LLlex.o: arith.h
+LLlex.o: assert.h
+LLlex.o: class.h
+LLlex.o: debug.h
+LLlex.o: def.h
+LLlex.o: file_info.h
+LLlex.o: idf.h
+LLlex.o: idfsize.h
+LLlex.o: input.h
+LLlex.o: nocross.h
+LLlex.o: nofloat.h
+LLlex.o: nopp.h
+LLlex.o: numsize.h
+LLlex.o: sizes.h
+LLlex.o: spec_arith.h
+LLlex.o: strsize.h
+LLlex.o: target_sizes.h
+LLmessage.o: LLlex.h
+LLmessage.o: Lpars.h
+LLmessage.o: arith.h
+LLmessage.o: file_info.h
+LLmessage.o: idf.h
+LLmessage.o: nofloat.h
+LLmessage.o: nopp.h
+LLmessage.o: spec_arith.h
+input.o: file_info.h
+input.o: input.h
+input.o: inputtype.h
+input.o: nopp.h
+domacro.o: LLlex.h
+domacro.o: Lpars.h
+domacro.o: arith.h
+domacro.o: assert.h
+domacro.o: botch_free.h
+domacro.o: class.h
+domacro.o: debug.h
+domacro.o: file_info.h
+domacro.o: idf.h
+domacro.o: idfsize.h
+domacro.o: ifdepth.h
+domacro.o: input.h
+domacro.o: interface.h
+domacro.o: macro.h
+domacro.o: nofloat.h
+domacro.o: nopp.h
+domacro.o: nparams.h
+domacro.o: parbufsize.h
+domacro.o: spec_arith.h
+domacro.o: textsize.h
+replace.o: LLlex.h
+replace.o: arith.h
+replace.o: assert.h
+replace.o: class.h
+replace.o: debug.h
+replace.o: file_info.h
+replace.o: idf.h
+replace.o: input.h
+replace.o: interface.h
+replace.o: macro.h
+replace.o: nofloat.h
+replace.o: nopp.h
+replace.o: pathlength.h
+replace.o: spec_arith.h
+replace.o: static.h
+replace.o: strsize.h
+init.o: class.h
+init.o: idf.h
+init.o: interface.h
+init.o: macro.h
+init.o: nopp.h
+options.o: align.h
+options.o: arith.h
+options.o: botch_free.h
+options.o: class.h
+options.o: dataflow.h
+options.o: idf.h
+options.o: idfsize.h
+options.o: macro.h
+options.o: noRoption.h
+options.o: nobitfield.h
+options.o: nocross.h
+options.o: nofloat.h
+options.o: nopp.h
+options.o: sizes.h
+options.o: spec_arith.h
+options.o: target_sizes.h
+options.o: use_tmp.h
+scan.o: class.h
+scan.o: idf.h
+scan.o: input.h
+scan.o: interface.h
+scan.o: lapbuf.h
+scan.o: macro.h
+scan.o: nopp.h
+scan.o: nparams.h
+skip.o: LLlex.h
+skip.o: arith.h
+skip.o: class.h
+skip.o: file_info.h
+skip.o: input.h
+skip.o: interface.h
+skip.o: nofloat.h
+skip.o: nopp.h
+skip.o: spec_arith.h
+stack.o: Lpars.h
+stack.o: arith.h
+stack.o: botch_free.h
+stack.o: debug.h
+stack.o: def.h
+stack.o: idf.h
+stack.o: level.h
+stack.o: mes.h
+stack.o: noRoption.h
+stack.o: nobitfield.h
+stack.o: nofloat.h
+stack.o: nopp.h
+stack.o: spec_arith.h
+stack.o: stack.h
+stack.o: struct.h
+stack.o: type.h
+type.o: Lpars.h
+type.o: align.h
+type.o: arith.h
+type.o: botch_free.h
+type.o: def.h
+type.o: idf.h
+type.o: nobitfield.h
+type.o: nocross.h
+type.o: nofloat.h
+type.o: nopp.h
+type.o: sizes.h
+type.o: spec_arith.h
+type.o: target_sizes.h
+type.o: type.h
+ch7mon.o: Lpars.h
+ch7mon.o: arith.h
+ch7mon.o: botch_free.h
+ch7mon.o: def.h
+ch7mon.o: expr.h
+ch7mon.o: idf.h
+ch7mon.o: label.h
+ch7mon.o: nobitfield.h
+ch7mon.o: nofloat.h
+ch7mon.o: nopp.h
+ch7mon.o: spec_arith.h
+ch7mon.o: type.h
+label.o: Lpars.h
+label.o: arith.h
+label.o: def.h
+label.o: idf.h
+label.o: label.h
+label.o: level.h
+label.o: noRoption.h
+label.o: nobitfield.h
+label.o: nofloat.h
+label.o: nopp.h
+label.o: spec_arith.h
+label.o: type.h
+eval.o: Lpars.h
+eval.o: align.h
+eval.o: arith.h
+eval.o: assert.h
+eval.o: atw.h
+eval.o: code.h
+eval.o: dataflow.h
+eval.o: debug.h
+eval.o: def.h
+eval.o: expr.h
+eval.o: idf.h
+eval.o: label.h
+eval.o: level.h
+eval.o: mes.h
+eval.o: nobitfield.h
+eval.o: nocross.h
+eval.o: nofloat.h
+eval.o: nopp.h
+eval.o: sizes.h
+eval.o: spec_arith.h
+eval.o: stack.h
+eval.o: target_sizes.h
+eval.o: type.h
+switch.o: Lpars.h
+switch.o: arith.h
+switch.o: assert.h
+switch.o: botch_free.h
+switch.o: code.h
+switch.o: debug.h
+switch.o: density.h
+switch.o: expr.h
+switch.o: idf.h
+switch.o: label.h
+switch.o: noRoption.h
+switch.o: nobitfield.h
+switch.o: nofloat.h
+switch.o: nopp.h
+switch.o: spec_arith.h
+switch.o: switch.h
+switch.o: type.h
+conversion.o: Lpars.h
+conversion.o: arith.h
+conversion.o: nobitfield.h
+conversion.o: nocross.h
+conversion.o: nofloat.h
+conversion.o: sizes.h
+conversion.o: spec_arith.h
+conversion.o: target_sizes.h
+conversion.o: type.h
+util.o: align.h
+util.o: nocross.h
+util.o: nofloat.h
+util.o: regcount.h
+util.o: sizes.h
+util.o: stack.h
+util.o: target_sizes.h
+util.o: use_tmp.h
+util.o: util.h
+blocks.o: align.h
+blocks.o: arith.h
+blocks.o: atw.h
+blocks.o: label.h
+blocks.o: nocross.h
+blocks.o: nofloat.h
+blocks.o: sizes.h
+blocks.o: spec_arith.h
+blocks.o: stack.h
+blocks.o: target_sizes.h
+dataflow.o: dataflow.h
+char.o: class.h
+symbol2str.o: Lpars.h

+ 4 - 0
lang/cem/cemcom/Parameters

@@ -129,3 +129,7 @@
 #undef NOCROSS		1	/* if NOT defined, cross compiler */
 
 
+!File: regcount.h
+#undef REGCOUNT		1	/* count occurrences for register messages */
+
+

+ 6 - 1
lang/cem/cemcom/Resolve

@@ -10,10 +10,15 @@ case $# in
 	;;
 esac
 PW=`pwd`
+options=
 case $1 in
 main|emain)
 	target=$PW/$1
 	;;
+omain)
+	target=$PW/$1
+	options=-DPEEPHOLE
+	;;
 Xlint)
 	target=$1
 	;;
@@ -55,4 +60,4 @@ ed - $PW/makefile <<'EOF'
 w makefile
 q
 EOF
-make EMHOME=$EMHOME CURRDIR=$PW $target
+make EMHOME=$EMHOME COPTIONS=$options CURRDIR=$PW $target

+ 4 - 0
lang/cem/cemcom/SmallPars

@@ -129,3 +129,7 @@
 #undef NOCROSS		1	/* if NOT defined, cross compiler */
 
 
+!File: regcount.h
+#undef REGCOUNT		1	/* count occurrences for register messages */
+
+

+ 10 - 0
lang/cem/cemcom/util.c

@@ -18,6 +18,7 @@
 
 #include	"util.h"
 #include	"use_tmp.h"
+#include	"regcount.h"
 #include	"sizes.h"
 #include	"align.h"
 #include	"stack.h"
@@ -27,6 +28,11 @@ static struct localvar	*FreeTmps;
 static int	loc_id;
 #endif USE_TMP
 
+#ifdef PEEPHOLE
+#undef REGCOUNTING
+#define REGCOUNTING 1
+#endif
+
 extern char options[];
 
 LocalInit()
@@ -179,7 +185,9 @@ LoadLocal(off, sz)
 	register struct localvar *p = find_reg(off);
 
 #ifdef USE_TMP
+#ifdef REGCOUNTING
 	if (p) p->t_count++;
+#endif
 #endif
 	if (sz == word_size) C_lol(off);
 	else if (sz == dword_size) C_ldl(off);
@@ -196,7 +204,9 @@ StoreLocal(off, sz)
 	register struct localvar *p = find_reg(off);
 
 #ifdef USE_TMP
+#ifdef REGCOUNTING
 	if (p) p->t_count++;
+#endif
 #endif
 	if (sz == word_size) C_stl(off);
 	else if (sz == dword_size) C_sdl(off);