# HG changeset patch # User kono # Date 1482548577 0 # Node ID 7672a37e75455b46876afcb6d7ec17a45d7a95e8 # Parent b7f4ff38a3bf3dee2c72d1fe025da509e035afd1 Raspbery PI ARM support begin diff -r b7f4ff38a3bf -r 7672a37e7545 Makefile --- a/Makefile Sat Dec 24 11:00:47 2016 +0900 +++ b/Makefile Sat Dec 24 03:02:57 2016 +0000 @@ -1,17 +1,16 @@ -GCC = clang -CC = $(GCC) -std=c99 $(CCEXT) $(M) -fgnu89-inline +CC = gcc # -O3 # MCFLAG = -DUSE_CODE_KEYWORD CFLAGS = -g -Wall -Wno-nullability-completeness -I. $(MCFLAG) # -O # CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage # LDFLAGS = -pg # for Linux Zaurus -# CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include -CFLAGS1 = -g -I. +CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include -DUSE_CODE_KEYWORD +CFLAGS1 = -g -pipe -I. -fsigned-char -DUSE_CODE_KEYWORD BASE=0 STAGE=1 MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE) -ARCH=i64 +ARCH=arm MC=mc-$(ARCH) MLIB = -lm PRINTF= # printf.c @@ -19,46 +18,34 @@ 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 -GCC_INCLUDE=`perl tools/find-gcc-include-path -p $(CC)` -# # TARGET=test/simp -all: mc tags - -predefined: - $(CC) -xc -E -dM /dev/null - -ppc: - make ARCH=powerpc CCEXT="-arch ppc" check-all +all: mc -ia32: - make ARCH=ia32 CCEXT="-m32" check-all - -ia32-make-code-check: - make ARCH=ia32 CCEXT="-m32" MK=-make check-all-code - -mc: mc-$(ARCH) +mc: mc-include.c mc-$(ARCH) cp mc-$(ARCH) mc -mc-i64 :conv/conv.h mc-include.c mc-code-i64.o $(COMPLIB) $(CONVERTER) - $(CC) $(LDFLAGS) -g mc-code-i64.o $(COMPLIB) $(CONVERTER) -o $@ +TAGS: + ctags mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h \ + mc-macro.c \ + mc-parse.c mc-tree.c mc-switch.c mc-switch.h \ + mc.h conv/c.c conv/c.h \ + mc-inline.h mc-inline.c \ + conv/conv.h conv/convdef.h conv/null.c -mc-powerpc :conv/conv.h mc-include.c mc-code-powerpc.o $(COMPLIB) $(CONVERTER) +mc-powerpc : mc-code-powerpc.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@ -mc-ia32 :conv/conv.h mc-include.c mc-code-ia32.o $(COMPLIB) $(CONVERTER) +mc-ia32 : mc-code-ia32.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@ -mc-mips :conv/conv.h mc-include.c mc-code-mips.o $(COMPLIB) $(CONVERTER) +mc-mips : mc-code-mips.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@ -mc-arm :conv/conv.h mc-include.c mc-code-arm.o $(COMPLIB) $(CONVERTER) +mc-arm : mc-code-arm.o $(COMPLIB) $(CONVERTER) $(CC) $(LDFLAGS) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@ -mc-spu :conv/conv.h mc-include.c mc-code-spu.o $(COMPLIB) $(CONVERTER) - $(CC) $(LDFLAGS) -g mc-code-spu.o $(COMPLIB) $(CONVERTER) -o $@ - conv/conv.h: conv_func.tbl tools/conv_func.pl perl tools/conv_func.pl conv/convdef.h: conv_func.tbl tools/conv_func.pl @@ -66,12 +53,9 @@ conv/null.c: conv_func.tbl tools/conv_func.pl perl tools/conv_func.pl -mc-include.c: stdio.h +mc-include.c: perl tools/find-gcc-include-path -l $(CC) > mc-include.c -stdio.h: - perl tools/find-gcc-include-path -s $(CC) > stdio.h - mc.h-new: perl tools/mc-h-renum.pl mc.h > mc.h.1 mv mc.h.1 mc.h @@ -93,14 +77,12 @@ make check TARGET=test/simp0 make check TARGET=test/simp1 make check TARGET=test/static - make check-inline TARGET=test/static make check TARGET=test/tmp make check TARGET=test/tmp10 make check TARGET=test/tmp11 make check TARGET=test/tmp12 make check TARGET=test/tmp5 make check TARGET=test/tmp7 - make check-inline TARGET=test/tmp7 make check TARGET=test/tmp8 make check TARGET=test/tmp9 make check TARGET=test/enum @@ -109,9 +91,7 @@ make check TARGET=test/long make check TARGET=test/tstdarg make check TARGET=test/switch - make check-inline TARGET=test/switch make check TARGET=test/strinit - make check-inline TARGET=test/strinit make check TARGET=test/code-gen-all make check-inline TARGET=test/code-gen-all make check TARGET=test/bitfield @@ -122,13 +102,9 @@ make check TARGET=test/void_code make check TARGET=test/putenemy make check TARGET=test/inline + make check TARGET=test/offset make check TARGET=test/ps2 - make check-inline TARGET=test/ps2 - make check TARGET=test/offset make check TARGET=test/multi - make check-inline TARGET=test/multi - make check TARGET=test/comp - make check-inline TARGET=test/comp # make check TARGET=test/scope STDFLAG="-std=gnu99" # make check-inline TARGET=test/scope STDFLAG="-std=gnu99" #MK =-make @@ -148,18 +124,15 @@ make check-code$(MK) TARGET=test/tmp4 make check-code$(MK) TARGET=test/tmp6 make check-code$(MK) TARGET=test/tmpb - make check-code-inline TARGET=test/tmpb make check-code$(MK) TARGET=test/scope - make check-code-inline TARGET=test/scope - # make check-code$(MK) TARGET=test/throw + make check-code$(MK) TARGET=test/throw make check-code$(MK) TARGET=test/too-long-argument -check-nkf: mc +check-nkf: ( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c ) - ( cd nkf203; ../mc-$(ARCH) nkf.c utf8tbl.c ) + ( cd nkf203; ../mc-$(ARCH) -s nkf.c utf8tbl.c ) ( cd nkf203; $(CC) -g -o nkf nkf.s utf8tbl.s ) ( cd nkf203; perl test.pl ) - # -./$(MC) -Itest/ $(TARGET).c ifeq ($(GCC),clang) @@ -169,59 +142,42 @@ endif check: mc $(MC) $(TARGET).c - -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) $(NOWARN) + -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) -./b.out > $(TARGET).gcc.out - -./$(MC) $(MCFLAG) $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).gcc.out $(TARGET).$(MC).out check-inline: mc $(MC) $(TARGET).c - -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) $(NOWARN) + -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) -./b.out > $(TARGET).gcc.out - -./$(MC) $(MCFLAG) -DINLINE=inline $(TARGET).c + -./$(MC) -s -DINLINE=inline $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).gcc.out $(TARGET).$(MC).out check-code: mc $(MC) - -./$(MC) $(MCFLAG) $(TARGET).c - -$(CC) $(TARGET).s $(MLIB) - -./a.out > $(TARGET).$(MC).out - -diff $(TARGET).code-out $(TARGET).$(MC).out -check-code-inline: mc $(MC) - -./$(MC) $(MCFLAG) -DINLINE=inline $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).$(MC).out -diff $(TARGET).code-out $(TARGET).$(MC).out check-code-make: mc $(MC) - -./$(MC) $(MCFLAG) $(TARGET).c + -./$(MC) -s $(TARGET).c -$(CC) $(TARGET).s $(MLIB) -./a.out > $(TARGET).code-out -check-flip: mc $(MC) - -$(CC) -DFLIP -c test/basic2.c - -$(CC) basic2.o test/basic2.c - ./a.out - -./$(MC) test/basic2.c - -$(CC) test/basic2.s -DFLIP test/basic2.c - ./a.out - -./$(MC) -DFLIP test/basic2.c - -$(CC) test/basic2.s test/basic2.c - ./a.out - test/code-gen-all.c: test/code-gen.pl test/code-gen.c perl test/code-gen.pl < test/code-gen.c > test/code-gen-all.c incpri: perl tools/incpri.pl test/*.c -tags: # tags-$(ARCH) +tags: tags-$(ARCH) tags-$(ARCH): - -ctags -w mc.h mc-code.h mc-code-$(ARCH).c mc-codegen.c mc-codegen.h \ - mc-parse.h mc-tree.c mc-inline.h mc-switch.h \ - mc-macro.h mc-macro.c \ + ctags mc.h mc-code.h mc-code-$(ARCH).c mc-codegen.c mc-codegen.h \ + mc-parse.c mc-tree.c \ conv/c.c conv/c.h \ conv/conv.h conv/convdef.h @@ -229,8 +185,8 @@ make clean tar cBf - . | gzip > ../comp.tgz -depend : mc.h mc-include.c - makedepend -I$(GCC_INCLUDE) mc-code-ia32.c mc-code.h mc-codegen.c mc-codegen.h \ +depend : mc-include.c + 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-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 \ @@ -240,7 +196,7 @@ mc-code-mips.c clean : - -rm -rf mc mc-spu mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.c *.dSYM stdio.h + -rm -f mc mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.h mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) $(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) @@ -249,37 +205,37 @@ $(CC) -g -o $@ $(PRINTF) b00.s b01.s b02.s b03.s b04.s mc-macro.o mc-inline.o $(CONVERTER) b00.s : mc-parse.c $(MC) - ./$(MC) $(MCFLAG) -ob00.s mc-parse.c + ./$(MC) -s -ob00.s mc-parse.c b01.s : $(CODE) $(MC) - ./$(MC) $(MCFLAG) -ob01.s $(CODE) + ./$(MC) -s -ob01.s $(CODE) b02.s : mc-codegen.c $(MC) - ./$(MC) $(MCFLAG) -ob02.s mc-codegen.c + ./$(MC) -s -ob02.s mc-codegen.c b03.s : mc-tree.c $(MC) - ./$(MC) $(MCFLAG) -ob03.s mc-tree.c + ./$(MC) -s -ob03.s mc-tree.c b04.s : mc-switch.c $(MC) - ./$(MC) $(MCFLAG) -ob04.s mc-switch.c + ./$(MC) -s -ob04.s mc-switch.c b10.s : mc-parse.c mc1 - ./mc1 $(MCFLAG) -ob10.s mc-parse.c + ./mc1 -s -ob10.s mc-parse.c b11.s : $(CODE) $(PRINTF) mc1 - ./mc1 $(MCFLAG) -ob11.s $(CODE) + ./mc1 -s -ob11.s $(CODE) b12.s : mc-codegen.c mc1 - ./mc1 $(MCFLAG) -ob12.s mc-codegen.c + ./mc1 -s -ob12.s mc-codegen.c b13.s : mc-tree.c mc1 - ./mc1 $(MCFLAG) -ob13.s mc-tree.c + ./mc1 -s -ob13.s mc-tree.c b14.s : mc-switch.c mc1 - ./mc1 $(MCFLAG) -ob14.s mc-switch.c + ./mc1 -s -ob14.s mc-switch.c b20.s : mc-parse.c mc2 - ./mc2 $(MCFLAG) -ob20.s mc-parse.c + ./mc2 -s -ob20.s mc-parse.c b21.s : $(CODE) $(PRINTF) mc2 - ./mc2 $(MCFLAG) -ob21.s $(CODE) + ./mc2 -s -ob21.s $(CODE) b22.s : mc-codegen.c mc2 - ./mc2 $(MCFLAG) -ob22.s mc-codegen.c + ./mc2 -s -ob22.s mc-codegen.c b23.s : mc-tree.c mc2 - ./mc2 $(MCFLAG) -ob23.s mc-tree.c + ./mc2 -s -ob23.s mc-tree.c b24.s : mc-switch.c mc1 - ./mc2 $(MCFLAG) -ob24.s mc-switch.c + ./mc2 -s -ob24.s mc-switch.c diff : b00.s b01.s b02.s b03.s b04.s b10.s b11.s b12.s b13.s b14.s -diff b00.s b10.s diff -r b7f4ff38a3bf -r 7672a37e7545 Makefile.raspberryPi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.raspberryPi Sat Dec 24 03:02:57 2016 +0000 @@ -0,0 +1,253 @@ +CC = gcc +# -O3 +# CFLAGS = -g -Wall -I. +# CFLAGS = -g -Wall -I. -pg -fprofile-arcs -ftest-coverage +# LDFLAGS = -pg +# for Linux Zaurus +CFLAGS = -fsigned-char -pipe -g -I. -I/home/zaurus/develop/include -DUSE_CODE_KEYWORD +CFLAGS1 = -g -pipe -I. -fsigned-char -DUSE_CODE_KEYWORD +BASE=0 +STAGE=1 +MFLAGS=$(MFALGS) BASE=$(BASE) STAGE=$(STAGE) +ARCH=arm +MC=mc-$(ARCH) +MLIB = -lm +PRINTF= # printf.c +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 +# +TARGET=test/simp + +all: mc + +mc: mc-include.c mc-$(ARCH) + cp mc-$(ARCH) mc + +TAGS: + ctags mc-code-powerpc.c mc-code.h mc-codegen.c mc-codegen.h \ + mc-macro.c \ + mc-parse.c mc-tree.c mc-switch.c mc-switch.h \ + mc.h conv/c.c conv/c.h \ + mc-inline.h mc-inline.c \ + conv/conv.h conv/convdef.h conv/null.c + +predefined: + $(CC) -xc -E -dM /dev/null + + +mc-powerpc : mc-code-powerpc.o $(COMPLIB) $(CONVERTER) + $(CC) $(LDFLAGS) -g mc-code-powerpc.o $(COMPLIB) $(CONVERTER) -o $@ + +mc-ia32 : mc-code-ia32.o $(COMPLIB) $(CONVERTER) + $(CC) $(LDFLAGS) -g mc-code-ia32.o $(COMPLIB) $(CONVERTER) -o $@ + +mc-mips : mc-code-mips.o $(COMPLIB) $(CONVERTER) + $(CC) $(LDFLAGS) -g mc-code-mips.o $(COMPLIB) $(CONVERTER) -o $@ + +mc-arm : mc-code-arm.o $(COMPLIB) $(CONVERTER) + $(CC) $(LDFLAGS) -g mc-code-arm.o $(COMPLIB) $(CONVERTER) -o $@ + +conv/conv.h: conv_func.tbl tools/conv_func.pl + perl tools/conv_func.pl +conv/convdef.h: conv_func.tbl tools/conv_func.pl + perl tools/conv_func.pl +conv/null.c: conv_func.tbl tools/conv_func.pl + perl tools/conv_func.pl + +mc-include.c: conv/conv.h + perl tools/find-gcc-include-path -l $(CC) > mc-include.c + +mc.h-new: + perl tools/mc-h-renum.pl mc.h > mc.h.1 + mv mc.h.1 mc.h + +check-all: check-all-c check-all-code + +check-all-c: + make check TARGET=test/basic + make check-inline TARGET=test/basic + make check TARGET=test/call + make check TARGET=test/fact0 + make check TARGET=test/float + make check TARGET=test/ifdef + make check TARGET=test/int + make check TARGET=test/macro + make check TARGET=test/regargs + make check TARGET=test/short + make check TARGET=test/simp + make check TARGET=test/simp0 + make check TARGET=test/simp1 + make check TARGET=test/static + make check TARGET=test/tmp + make check TARGET=test/tmp10 + make check TARGET=test/tmp11 + make check TARGET=test/tmp12 + make check TARGET=test/tmp5 + make check TARGET=test/tmp7 + make check TARGET=test/tmp8 + make check TARGET=test/tmp9 + make check TARGET=test/enum + make check TARGET=test/obsf + make check TARGET=test/obsf2 + make check TARGET=test/long + make check TARGET=test/tstdarg + make check TARGET=test/switch + make check TARGET=test/strinit + make check TARGET=test/code-gen-all + make check-inline TARGET=test/code-gen-all + make check TARGET=test/bitfield + make check TARGET=test/bitfield1 + make check-inline TARGET=test/bitfield1 + make check TARGET=test/cext + make check TARGET=test/const + make check TARGET=test/void_code + make check TARGET=test/putenemy + make check TARGET=test/inline + make check TARGET=test/offset + make check TARGET=test/ps2 + make check TARGET=test/multi +# make check TARGET=test/scope STDFLAG="-std=gnu99" +# make check-inline TARGET=test/scope STDFLAG="-std=gnu99" +#MK =-make +MK= +check-all-code: + make check-code$(MK) TARGET=test/arg + make check-code$(MK) TARGET=test/conv + make check-code$(MK) TARGET=test/conv1 + make check-code$(MK) TARGET=test/fact-a + make check-code$(MK) TARGET=test/fact + make check-code$(MK) TARGET=test/goto + make check-code$(MK) TARGET=test/test1 + make check-code$(MK) TARGET=test/test2 + make check-code$(MK) TARGET=test/tmpa + make check-code$(MK) TARGET=test/tmp1 + make check-code$(MK) TARGET=test/tmp2 + make check-code$(MK) TARGET=test/tmp4 + make check-code$(MK) TARGET=test/tmp6 + make check-code$(MK) TARGET=test/tmpb + make check-code$(MK) TARGET=test/scope + make check-code$(MK) TARGET=test/throw + make check-code$(MK) TARGET=test/too-long-argument + +check-nkf: + ( cd nkf203; $(CC) -g -o nkf1 nkf.c utf8tbl.c ) + ( cd nkf203; ../mc-$(ARCH) -s nkf.c utf8tbl.c ) + ( cd nkf203; $(CC) -g -o nkf nkf.s utf8tbl.s ) + ( cd nkf203; perl test.pl ) + +# -./$(MC) -Itest/ -s $(TARGET).c + +check: mc $(MC) $(TARGET).c + -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) + -./b.out > $(TARGET).gcc.out + -./$(MC) -s $(TARGET).c + -$(CC) $(TARGET).s $(MLIB) + -./a.out > $(TARGET).$(MC).out + -diff $(TARGET).gcc.out $(TARGET).$(MC).out + +check-inline: mc $(MC) $(TARGET).c + -$(CC) $(CFLAGS1) $(STDFLAG) $(TARGET).c -o b.out $(MLIB) + -./b.out > $(TARGET).gcc.out + -./$(MC) -s -DINLINE=inline $(TARGET).c + -$(CC) $(TARGET).s $(MLIB) + -./a.out > $(TARGET).$(MC).out + -diff $(TARGET).gcc.out $(TARGET).$(MC).out + +check-code: mc $(MC) + -./$(MC) -s $(TARGET).c + -$(CC) $(TARGET).s $(MLIB) + -./a.out > $(TARGET).$(MC).out + -diff $(TARGET).code-out $(TARGET).$(MC).out +check-code-make: mc $(MC) + -./$(MC) -s $(TARGET).c + -$(CC) $(TARGET).s $(MLIB) + -./a.out > $(TARGET).code-out + +test/code-gen-all.c: test/code-gen.pl test/code-gen.c + perl test/code-gen.pl < test/code-gen.c > test/code-gen-all.c + +incpri: + perl tools/incpri.pl test/*.c + +tags: tags-$(ARCH) + +tags-$(ARCH): + ctags mc.h mc-code.h mc-code-$(ARCH).c mc-codegen.c mc-codegen.h \ + mc-parse.c mc-tree.c \ + conv/c.c conv/c.h \ + conv/conv.h conv/convdef.h + +tar : + make clean + tar cBf - . | gzip > ../comp.tgz + +depend : mc-include.c + 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-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 + +clean : + -rm -f mc mc-ia32 mc-powerpc mc-mips mc-arm *.bak *.s *.o *.cc mc mc1 mc2 a.out *~ core* */*.o *.bak test/*.s test/*.cc test/*.o test/*.bak test/*~ conv/*.s conv/*.cc conv/*.o conv/*.bak conv/*~ *.out */*.out *.i */*.i mc-include.h + +mc1 : b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) + $(CC) -g -o $@ $(PRINTF) b00.s b01.s mc-codegen.o mc-tree.o mc-switch.o mc-macro.o mc-inline.o $(CONVERTER) + +mc2 : b00.s b01.s b02.s b03.s mc-macro.o mc-inline.o $(CONVERTER) + $(CC) -g -o $@ $(PRINTF) b00.s b01.s b02.s b03.s b04.s mc-macro.o mc-inline.o $(CONVERTER) + +b00.s : mc-parse.c $(MC) + ./$(MC) -s -ob00.s mc-parse.c +b01.s : $(CODE) $(MC) + ./$(MC) -s -ob01.s $(CODE) +b02.s : mc-codegen.c $(MC) + ./$(MC) -s -ob02.s mc-codegen.c +b03.s : mc-tree.c $(MC) + ./$(MC) -s -ob03.s mc-tree.c +b04.s : mc-switch.c $(MC) + ./$(MC) -s -ob04.s mc-switch.c + +b10.s : mc-parse.c mc1 + ./mc1 -s -ob10.s mc-parse.c +b11.s : $(CODE) $(PRINTF) mc1 + ./mc1 -s -ob11.s $(CODE) +b12.s : mc-codegen.c mc1 + ./mc1 -s -ob12.s mc-codegen.c +b13.s : mc-tree.c mc1 + ./mc1 -s -ob13.s mc-tree.c +b14.s : mc-switch.c mc1 + ./mc1 -s -ob14.s mc-switch.c + +b20.s : mc-parse.c mc2 + ./mc2 -s -ob20.s mc-parse.c +b21.s : $(CODE) $(PRINTF) mc2 + ./mc2 -s -ob21.s $(CODE) +b22.s : mc-codegen.c mc2 + ./mc2 -s -ob22.s mc-codegen.c +b23.s : mc-tree.c mc2 + ./mc2 -s -ob23.s mc-tree.c +b24.s : mc-switch.c mc1 + ./mc2 -s -ob24.s mc-switch.c + +diff : b00.s b01.s b02.s b03.s b04.s b10.s b11.s b12.s b13.s b14.s + -diff b00.s b10.s + -diff b01.s b11.s + -diff b02.s b12.s + -diff b03.s b13.s + -diff b04.s b14.s + +diff2 : b00.s b01.s b02.s b03.s b04.s b20.s b21.s b22.s b23.s b24.s + -diff b00.s b20.s + -diff b01.s b21.s + -diff b02.s b22.s + -diff b03.s b23.s + -diff b04.s b24.s + + +# DO NOT DELETE diff -r b7f4ff38a3bf -r 7672a37e7545 mc-code-arm.c --- a/mc-code-arm.c Sat Dec 24 11:00:47 2016 +0900 +++ b/mc-code-arm.c Sat Dec 24 03:02:57 2016 +0000 @@ -227,15 +227,21 @@ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "sl", "lr", "ip", "fp", "sp", "pc", "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7" + // "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", + // "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", + "s0", "s2", "s4", "s6", "s8", "s10","s12", "s14", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", }; #define register_name(i) reg_name[i] #define fregister_name(i) reg_name[i] +#define dregister_name(i) reg_name[i+8] #define lregister_name_low(i) reg_name[regv_l(i)] #define lregister_name_high(i) reg_name[regv_h(i)] char *rn(int i) { return register_name(i); } char *fn(int i) { return fregister_name(i); } +char *dn(int i) { return dregister_name(i+8); } char *lln(int i) { return lregister_name_low(i); } char *lhn(int i) { return lregister_name_high(i); } int ll(int i) { return regv_l(i); } @@ -3485,14 +3491,14 @@ set_freg(RET_FREGISTER,1); #endif printf("\tmov\t%s, %s\n",register_name( - cadr(get_input_register_var(1,0,1,0)); + cadr(get_input_register_var(1,0,0)) ),register_name(REG_fp)); } else if (cadr(fnptr->ty)==DOUBLE) { #if FLOAT_CODE creg = lreg = cadr(get_input_dregister_var(0,0,1,1)); set_dreg(RET_DREGISTER,1); printf("\tmov\t%s, %s\n",register_name( - cadr(get_input_register_var(2,0,1,0)); + cadr(get_input_register_var(2,0,0)) ),register_name(REG_fp)); #endif } else if (cadr(fnptr->ty)>0&&( @@ -3504,7 +3510,7 @@ printf("\tsub\tr1, r2, fp\n"); printf("\tldr\tr0, [fp, #%d]\n",(my_func_args-1)*SIZE_OF_INT); printf("\tmov\t%s, %s\n",register_name( - cadr(get_input_register_var(1,0,1,0)); + cadr(get_input_register_var(1,0,0)) ),register_name(REG_fp)); // emit_copy(6,3,sz,0,1,1); } else if (cadr(fnptr->ty)!=VOID) { @@ -3512,7 +3518,7 @@ if (creg!=RET_REGISTER) set_ireg(RET_REGISTER,1); printf("\tmov\t%s, %s\n",register_name( - cadr(get_input_register_var(1,0,1,0)); + cadr(get_input_register_var(1,0,1)) ),register_name(REG_fp)); } code_unfix_frame_pointer(); @@ -3681,8 +3687,8 @@ return lb; } -extern void -emit_string(char *s,int t,long len) +extern void +emit_string(char *s,int t,int len) { t = type_value(t); if (car(t)==ARRAY && diff -r b7f4ff38a3bf -r 7672a37e7545 mc-parse.c --- a/mc-parse.c Sat Dec 24 11:00:47 2016 +0900 +++ b/mc-parse.c Sat Dec 24 03:02:57 2016 +0000 @@ -20,7 +20,7 @@ ***********************************************************************/ #include -// #include // for malloc +#include // for malloc // this in ./stdio.h //extern void * malloc(size_t size); //extern void * realloc(void *ptr, size_t size);