summaryrefslogtreecommitdiff
path: root/util/romcc
diff options
context:
space:
mode:
Diffstat (limited to 'util/romcc')
-rw-r--r--util/romcc/Makefile240
-rw-r--r--util/romcc/do_tests.sh96
-rwxr-xr-xutil/romcc/test.sh4
-rw-r--r--util/romcc/tests.sh67
4 files changed, 17 insertions, 390 deletions
diff --git a/util/romcc/Makefile b/util/romcc/Makefile
index fca8112897..2c5f174cf2 100644
--- a/util/romcc/Makefile
+++ b/util/romcc/Makefile
@@ -1,240 +1,30 @@
-# Move the configuration defines to makefile.conf
CC=gcc
CPPFLAGS=
CFLAGS= -g -Wall -Werror $(CPPFLAGS)
CPROF_FLAGS=-pg -fprofile-arcs
+BUILD_DIR=build
-all: romcc test
+default: $(BUILD_DIR)/romcc
-romcc: romcc.c Makefile
+$(BUILD_DIR)/romcc: romcc.c $(BUILD_DIR)
$(CC) $(CFLAGS) -o $@ $<
-romcc_pg: romcc.c Makefile
+$(BUILD_DIR)/romcc_pg: romcc.c $(BUILD_DIR)
$(CC) $(CFLAGS) $(CPROF_FLAGS) -o $@ $<
-LINUX_TESTS=\
- linux_test1.c \
- linux_test2.c \
- linux_test3.c \
- linux_test4.c \
- linux_test5.c \
- linux_test6.c \
- linux_test7.c \
- linux_test8.c \
- linux_test9.c \
- linux_test10.c \
- linux_test11.c \
- linux_test12.c \
- linux_test13.c \
+$(BUILD_DIR):
+ mkdir -p $(BUILD_DIR)
-TESTS=\
- hello_world1.c \
- hello_world2.c \
- simple_test1.c \
- simple_test2.c \
- simple_test3.c \
- simple_test4.c \
- simple_test5.c \
- simple_test6.c \
- simple_test7.c \
- simple_test8.c \
- simple_test9.c \
- simple_test10.c \
- simple_test11.c \
- simple_test12.c \
- simple_test13.c \
- simple_test14.c \
- simple_test15.c \
- simple_test16.c \
- simple_test17.c \
- simple_test18.c \
- simple_test19.c \
- simple_test20.c \
- simple_test21.c \
- simple_test23.c \
- simple_test24.c \
- simple_test25.c \
- simple_test26.c \
- simple_test27.c \
- simple_test28.c \
- simple_test29.c \
- simple_test31.c \
- simple_test32.c \
- simple_test33.c \
- simple_test34.c \
- simple_test35.c \
- simple_test36.c \
- simple_test37.c \
- simple_test40.c \
- simple_test41.c \
- simple_test43.c \
- simple_test45.c \
- simple_test46.c \
- simple_test47.c \
- simple_test48.c \
- simple_test49.c \
- simple_test50.c \
- simple_test51.c \
- simple_test52.c \
- simple_test53.c \
- simple_test55.c \
- simple_test56.c \
- simple_test57.c \
- simple_test58.c \
- simple_test60.c \
- simple_test61.c \
- simple_test62.c \
- simple_test63.c \
- simple_test64.c \
- simple_test65.c \
- simple_test66.c \
- simple_test67.c \
- simple_test68.c \
- simple_test69.c \
- simple_test70.c \
- simple_test71.c \
- simple_test72.c \
- simple_test73.c \
- simple_test74.c \
- simple_test75.c \
- simple_test76.c \
- simple_test77.c \
- simple_test78.c \
- simple_test79.c \
- simple_test80.c \
- simple_test81.c \
- simple_test82.c \
- simple_test83.c \
- simple_test84.c \
- simple_test85.c \
- simple_test86.c \
- simple_test87.c \
- simple_test88.c \
- simple_test89.c \
- simple_test90.c \
- raminit_test1.c \
- raminit_test2.c \
- raminit_test3.c \
- raminit_test4.c \
- raminit_test5.c \
- raminit_test6.c \
- $(LINUX_TESTS)
+test: $(BUILD_DIR)/romcc
+ ./test.sh all
-FAIL_TESTS = \
- fail_test1.c \
- fail_test2.c \
- fail_test3.c \
- fail_test4.c \
- fail_test5.c \
- fail_test6.c \
- fail_test7.c \
- fail_test8.c \
- fail_test9.c \
- fail_test10.c \
- fail_test11.c \
+test-simple: $(BUILD_DIR)/romcc
+ ./test.sh simple
-TEST_SRCS:=$(patsubst %, tests/%, $(TESTS))
-TEST_ASM:=$(patsubst %.c, tests/%.S, $(TESTS))
-TEST_ASM_O:=$(patsubst %.c, tests/%.S-O, $(TESTS))
-TEST_ASM_O2:=$(patsubst %.c, tests/%.S-O2, $(TESTS))
-TEST_ASM_mmmx :=$(patsubst %.c, tests/%.S-mmmx, $(TESTS))
-TEST_ASM_msse :=$(patsubst %.c, tests/%.S-msse, $(TESTS))
-TEST_ASM_mmmx_msse:=$(patsubst %.c, tests/%.S-mmmx-msse, $(TESTS))
-TEST_ASM_O_mmmx :=$(patsubst %.c, tests/%.S-O-mmmx, $(TESTS))
-TEST_ASM_O_msse :=$(patsubst %.c, tests/%.S-O-msse, $(TESTS))
-TEST_ASM_O_mmmx_msse:=$(patsubst %.c, tests/%.S-O-mmmx-msse, $(TESTS))
-TEST_ASM_O2_mmmx :=$(patsubst %.c, tests/%.S-O2-mmmx, $(TESTS))
-TEST_ASM_O2_msse :=$(patsubst %.c, tests/%.S-O2-msse, $(TESTS))
-TEST_ASM_O2_mmmx_msse:=$(patsubst %.c, tests/%.S-O2-mmmx-msse, $(TESTS))
-TEST_ASM_O2_mmmx_call :=$(patsubst %.c, tests/%.S-O2-mmmx-call, $(TESTS))
-TEST_ASM_O2_mmmx_msse_call:=$(patsubst %.c, tests/%.S-O2-mmmx-msse-call, $(TESTS))
-TEST_ASM_ALL:= $(TEST_ASM) $(TEST_ASM_O) $(TEST_ASM_O2) $(TEST_ASM_mmmx) $(TEST_ASM_msse) $(TEST_ASM_mmmx_msse) $(TEST_ASM_O_mmmx) $(TEST_ASM_O_msse) $(TEST_ASM_O_mmmx_msse) $(TEST_ASM_O2_mmmx) $(TEST_ASM_O2_msse) $(TEST_ASM_O2_mmmx_msse) $(TEST_ASM_O2_mmmx_call) $(TEST_ASM_O2_mmmx_msse_call)
-TEST_ASM_MOST:= $(TEST_ASM_O) $(TEST_ASM_O_mmmx) $(TEST_ASM_O_msse) $(TEST_ASM_O_mmmx_msse) $(TEST_ASM_O2) $(TEST_ASM_O2_mmmx) $(TEST_ASM_O2_msse) $(TEST_ASM_O2_mmmx_msse)
-# $(TEST_ASM_O2_mmmx_call) $(TEST_ASM_O2_mmmx_msse_call)
-TEST_OBJ:=$(patsubst %.c, tests/%.o, $(TESTS))
-TEST_ELF:=$(patsubst %.c, tests/%.elf, $(TESTS))
-LINUX_ELF:=$(patsubst %.c, tests/%.elf, $(LINUX_TESTS))
-LINUX_OUT:=$(patsubst %.c, tests/%.out, $(LINUX_TESTS))
+test-linux: $(BUILD_DIR)/romcc
+ ./test.sh linux
-FAIL_SRCS:=$(patsubst %, tests/%, $(FAIL_TESTS))
-FAIL_OUT:=$(patsubst %.c, tests/%.out, $(FAIL_TESTS))
+clean distclean:
+ rm -rf $(BUILD_DIR)
-
-ROMCC_OPTS=-fmax-allocation-passes=8 -fdebug-live-range-conflicts -Itests/include
-
-$(TEST_ASM): %.S: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -o $@ $< > $*.debug
-
-$(TEST_ASM_O): %.S-O: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -o $@ $< > $*.debug
-
-$(TEST_ASM_O2): %.S-O2: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -o $@ $< > $*.debug
-
-
-$(TEST_ASM_mmmx): %.S-mmmx: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -mmmx -o $@ $< > $*.debug
-
-$(TEST_ASM_msse): %.S-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -msse -o $@ $< > $*.debug
-
-$(TEST_ASM_mmmx_msse): %.S-mmmx-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -mmmx -msse -o $@ $< > $*.debug
-
-
-$(TEST_ASM_O_mmmx): %.S-O-mmmx: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -mmmx -o $@ $< > $*.debug
-
-$(TEST_ASM_O_msse): %.S-O-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -msse -o $@ $< > $*.debug
-
-$(TEST_ASM_O_mmmx_msse): %.S-O-mmmx-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -mmmx -msse -o $@ $< > $*.debug
-
-
-$(TEST_ASM_O2_mmmx): %.S-O2-mmmx: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -o $@ $< > $*.debug
-
-$(TEST_ASM_O2_msse): %.S-O2-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -msse -o $@ $< > $*.debug
-
-$(TEST_ASM_O2_mmmx_msse): %.S-O2-mmmx-msse: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -msse -o $@ $< > $*.debug
-
-$(TEST_ASM_O2_mmmx_call): %.S-O2-mmmx-call: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -fno-always-inline -o $@ $< > $*.debug
-
-$(TEST_ASM_O2_mmmx_msse_call): %.S-O2-mmmx-msse-call: %.c romcc
- export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -msse -fno-always-inline -o $@ $< > $*.debug
-
-
-$(FAIL_OUT): %.out: %.c romcc
- export ALLOC_CHECK_=2; if ./romcc $(ROMCC_OPTS) -O2 -o $*.S $< > $*.debug 2> $@ ; then exit 1 ; else exit 0 ; fi
-
-#$(TEST_OBJ): %.o: %.S-O2-mmmx-call
-
-$(TEST_OBJ): %.o: %.S-O2-mmmx
- as $< -o $@
-
-$(TEST_ELF): %.elf: %.o tests/ldscript.ld
- ld -T tests/ldscript.ld $< -o $@
-
-$(LINUX_OUT): %.out: %.elf
- ./$< > $@
-
-test: $(TEST_ELF) $(FAIL_OUT) $(TEST_ASM_MOST)
-
-run_linux: $(LINUX_OUT)
-
-echo:
- echo "TEST_SRCS=$(TEST_SRCS)"
- echo "TEST_ASM=$(TEST_ASM)"
- echo "TEST_ASM=$(TEST_ASM_MOST)"
- echo "TEST_OBJ=$(TEST_OBJ)"
- echo "TEST_ELF=$(TEST_ELF)"
- echo ""
- echo "FAIL_SRCS=$(FAIL_SRCS)"
- echo "FAIL_ASM=$(FAIL_ASM)"
-
-clean:
- rm -f romcc romcc_pg core $(TEST_ASM_ALL) $(TEST_OBJ) $(TEST_ELF) tests/*.debug tests/*.debug2 tests/*.gmon.out tests/*.out
+.PHONY: all test test-simple test-linux clean distclean
diff --git a/util/romcc/do_tests.sh b/util/romcc/do_tests.sh
deleted file mode 100644
index 2ce39d17e1..0000000000
--- a/util/romcc/do_tests.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/sh
-type="simple"
-if [ -n "$1" ] ; then
- type=$1
-fi
-if [ "$type" = "simple" ] ; then
-LIST="18 57 21 79 77 40 62 52 65 78 63 81 80 64 12 8 9 7 53 58 37 35 48 11 75 51 49 41 71 23 70 16 13 24 31 55 19 69 67 66 17 28 68 61 32 33 43 60 45 47 36 10 46 15 3 29 50 56 76 34 74 25 26 27 20 1 14 73 5 4"
-LIST="82 83 $LIST"
-BASE="simple_test"
-#REG_SKIP="34 73 5 33 45 47 25 27 26 20 "
-#SKIP="$REG_SKIP"
-EXPECTED_BAD="34 73 5 4"
-fi
-if [ "$type" = "linux" ] ; then
-LIST="1 2 3 4 5 6 7 8 9 10 11 12"
-BASE="linux_test"
-#SKIP="5"
-EXPECTED_BAD=""
-fi
-if [ "$type" = "raminit" ] ; then
-LIST="1 2 3 4 5 6"
-BASE="raminit_test"
-#SKIP="6"
-EXPECTED_BAD=""
-fi
-if [ "$type" = "hello" ] ; then
-LIST="1 2"
-BASE="hello_world"
-EXPECTED_BAD=""
-fi
-
-
-SKIPPED=""
-GOOD=""
-BAD=""
-OLD_BAD=""
-NEW_BAD=""
-NEW_GOOD=""
-for i in $LIST ; do
- DO_SKIP=""
- for j in $SKIP ; do
- if [ "$j" = "$i" ] ; then
- DO_SKIP="yes"
- break;
- fi
- done
- if [ ! -z "$DO_SKIP" ] ; then
- SKIPPED="$SKIPPED$i "
- continue;
- fi
- PROBLEM=""
- for j in $EXPECTED_BAD ; do
- if [ "$j" = "$i" ] ; then
- PROBLEM=":("
- break;
- fi
- done
- echo -e -n "$i $PROBLEM\t"
- if ./tests.sh $BASE $i > /dev/null 2> /dev/null ; then
- echo OK
- if [ ! -z "$PROBLEM" ] ; then
- NEW_GOOD="$NEW_GOOD$i "
- fi
- GOOD="$GOOD$i "
- else
- echo -n "FAILED: "
- tail -n 1 tests/$BASE$i.debug2 | tr -d '\r\n'
- echo
- if [ -z "$PROBLEM" ] ; then
- NEW_BAD="$NEW_BAD$i "
- else
- OLD_BAD="$OLD_BAD$i "
- fi
- BAD="$BAD$i "
- fi
-done
-echo -e "SKIPPED\t\t$SKIPPED"
-echo -e "FAILED\t\t$BAD"
-if [ ! -z "$NEW_BAD" ]; then
- echo -e "NEW FAILED\t$NEW_BAD"
-fi
-echo -e "OK\t\t$GOOD"
-if [ ! -z "$NEW_GOOD" ]; then
- echo -e "NEW OK\t\t$NEW_GOOD"
-fi
-
-for i in $NEW_BAD ; do
- printf "%2d: " $i
- tail -n 1 tests/$BASE$i.debug2 | tr -d '\n\r'
- echo
-done
-echo "-----"
-for i in $OLD_BAD ; do
- printf "%2d: " $i
- tail -n 1 tests/$BASE$i.debug2
-done
diff --git a/util/romcc/test.sh b/util/romcc/test.sh
index 8aa7c53a79..7e2b7f5b12 100755
--- a/util/romcc/test.sh
+++ b/util/romcc/test.sh
@@ -79,9 +79,9 @@ init_stats() {
}
get_romcc() {
- ROMCC="$BASEDIR/romcc"
+ ROMCC="$BUILDDIR/romcc"
if [ ! -f "$ROMCC" ]; then
- echo "romcc not found! Please run \"make romcc\"."
+ echo "romcc not found! Please run \"make\"."
exit 1
fi
}
diff --git a/util/romcc/tests.sh b/util/romcc/tests.sh
deleted file mode 100644
index 846c1d02b7..0000000000
--- a/util/romcc/tests.sh
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# Allow core dumps
-ulimit -c hard
-set -x
-N=''
-root=simple_test
-#root=simple_test
-#root=linux_test
-#root=raminit_test
-if [ -n "$2" -a -n "$1" ] ; then
- root=$1
- N=$2
-elif [ -n "$1" ] ; then
- root=$1
-else
- echo "too few arguments"
- exit 1
-fi
-ROMCC=./romcc
-stem="$root$N"
-base=tests/$stem
-op="-Itests/include"
-op="$op -feliminate-inefectual-code -fsimplify -fscc-transform "
-#op="$op -O2 "
-#op="$op -mmmx -msse"
-op="$op -finline-policy=defaulton"
-#op="$op -finline-policy=nopenalty"
-#op="$op -finline-policy=never"
-op="$op -fdebug -fdebug-triples -fdebug-interference -fdebug-verification"
-op="$op -fdebug-fdominators"
-op="$op -fdebug-inline"
-op="$op -fdebug-calls"
-#op="$op -mnoop-copy"
-#op="$op -fsimplify -fno-simplify-op -fno-simplify-phi -fno-simplify-label -fno-simplify-branch -fno-simplify-copy -fno-simplify-arith -fno-simplify-shift -fno-simplify-bitwise -fno-simplify-logical"
-#op="$op -fdebug-rebuild-ssa-form"
-op="$op -fmax-allocation-passes=8"
-op="$op -fdebug-live-range-conflicts"
-op="$op -fdebug-scc-transform"
-op="$op -fdebug-scc-transform2"
-#-fdebug-coalescing
-#-fdebug-coalesing2
-#-fno-simplify-call "
-#-fno-always-inline"
-#
-#op="-O2 -mmmx -msse --debug=4294967295"
-#op="-fdebug -fdebug-triples -fdebug-inline -O2 -mmmx -msse -fno-always-inline "
-#op="-fdebug -fdebug-inline -O2 -mmmx "
-#op="-fdebug -fdebug-live-range-conflicts -fdebug-live-range-conflicts2 -fno-debug-interference -fdebug-color-graph -fdebug-coalescing -fmax-allocation-passes=10 -O2 -mmmx -msse"
-#op="-fdebug -O2 -mmmx -msse"
-#op="-fdebug -fdebug-inline -fno-eliminate-inefectual-code -fno-always-inline -mmmx"
-#op="-fdebug -fdebug-inline -fno-always-inline -mmmx"
-export ALLOC_CHECK_=2
-rm -f core $base.S $base.debug $base.debug2 $base.elf $base.out &&
-make romcc &&
-$ROMCC $op -o $base.S $base.c 2>&1 > $base.debug | tee $base.debug2
-if [ '(' -f $base.c ')' -a '(' '!' -f core ')' -a '(' -f $base.S ')' ]; then
- if [ "$stem" = "linux_test$N" ] ; then
- as $base.S -o $base.o &&
- ld -T tests/ldscript.ld $base.o -o $base.elf &&
- ./$base.elf > $base.out &&
- diff -u results/$stem.out $base.out
- else
- /bin/true
- fi
-else
- /bin/false
-fi