Commit 930fc8a1 authored by zygzagZ's avatar zygzagZ

Fix last test (bad Phi XCHG), fix test runner, update README

parent 4c49b115
...@@ -3,3 +3,15 @@ pc394130 ...@@ -3,3 +3,15 @@ pc394130
Kompilowanie: make Kompilowanie: make
Używam makefile i g++ Używam makefile i g++
Alokacja rejestrów zgodnie z algorytmem opisanym w pracy naukowej Pereira, Palsberg 2009 o alokacji rejestrów dla programów SSA (bez pre-spillingu, heurystyka "spill least-used color").
Zaplanowane rozszerzenia:
- gcse
- tablice
- klasy z dziedziczeniem i metodami wirtualnymi
- odśmiecanie
Pliki używane do kompilacji:
- runtime.o wygenerowany z runtime.c (make lib/runtime.o)
- libc.a pasujący pod i386 skopiowany z lokalnego systemu (brak na students)
...@@ -307,7 +307,7 @@ void Compiler::generatePhiXCHG(const map<VariablePtr, VariablePtr> &varMap) { ...@@ -307,7 +307,7 @@ void Compiler::generatePhiXCHG(const map<VariablePtr, VariablePtr> &varMap) {
} }
} else { } else {
append("MOVL", rj, ri); append("MOVL", rj, ri);
rj = ri; rj = 0;
} }
} }
// load from memory // load from memory
...@@ -433,6 +433,7 @@ void Compiler::generateQAssign(QAssign &q) { ...@@ -433,6 +433,7 @@ void Compiler::generateQAssign(QAssign &q) {
string jLoc = Register(j) != edx ? getRef(j) : "-4(%esp)"; string jLoc = Register(j) != edx ? getRef(j) : "-4(%esp)";
if (j->constExpr) { if (j->constExpr) {
auto free = to_set(Register::assignable) - alives; auto free = to_set(Register::assignable) - alives;
free.erase(Register("edx"));
if (!free.empty()) { if (!free.empty()) {
auto reg = *free.begin(); auto reg = *free.begin();
append("MOVL", jLoc, reg); append("MOVL", jLoc, reg);
......
...@@ -10,6 +10,7 @@ function red { ...@@ -10,6 +10,7 @@ function red {
function green { function green {
echo -e "${GREEN}$@${NONE}" echo -e "${GREEN}$@${NONE}"
} }
VALGRIND=""
make -j8 && for i in lat/lattests/good/*.lat; do make -j8 && for i in lat/lattests/good/*.lat; do
t=$((t+1)) t=$((t+1))
...@@ -25,7 +26,7 @@ make -j8 && for i in lat/lattests/good/*.lat; do ...@@ -25,7 +26,7 @@ make -j8 && for i in lat/lattests/good/*.lat; do
inp=/dev/null inp=/dev/null
fi fi
if ! diff <( timeout 2 ${i%.*} < "$inp" ) "${i%.*}.output"; then if ! diff <( $VALGRIND timeout 2 ${i%.*} < "$inp" ) "${i%.*}.output"; then
red "ERROR $i" red "ERROR $i"
exit 1 exit 1
fi fi
...@@ -39,6 +40,17 @@ done && green good OK && for ext in `ls tests/good/`; do ...@@ -39,6 +40,17 @@ done && green good OK && for ext in `ls tests/good/`; do
ok=0; ok=0;
break; break;
fi fi
if [ -f "${i%.*}.input" ]; then
inp="${i%.*}.input"
else
inp=/dev/null
fi
if ! diff <( $VALGRIND timeout 2 ${i%.*} < "$inp" ) "${i%.*}.output"; then
red "ERROR $i"
ok=0;
fi
done done
if [ $ok -eq 1 ]; then if [ $ok -eq 1 ]; then
green "OK: $ext passed!" green "OK: $ext passed!"
...@@ -69,6 +81,12 @@ done && green "OK: $t bad+ tests passed!" && for ext in `ls lat/lattests/extensi ...@@ -69,6 +81,12 @@ done && green "OK: $t bad+ tests passed!" && for ext in `ls lat/lattests/extensi
ok=0; ok=0;
break; break;
fi fi
if ! diff <( $VALGRIND timeout 2 ${i%.*} < "$inp" ) "${i%.*}.output"; then
red "ERROR $i"
exit 1
fi
done done
if [ $ok -eq 1 ]; then if [ $ok -eq 1 ]; then
green "OK: $ext passed!" green "OK: $ext passed!"
...@@ -83,6 +101,18 @@ done && for ext in `ls tests/extensions`; do ...@@ -83,6 +101,18 @@ done && for ext in `ls tests/extensions`; do
ok=0; ok=0;
break; break;
fi fi
if [ -f "${i%.*}.input" ]; then
inp="${i%.*}.input"
else
inp=/dev/null
fi
if ! diff <( $VALGRIND timeout 2 ${i%.*} < "$inp" ) "${i%.*}.output"; then
red "ERROR $i"
exit 1
fi
done done
if [ $ok -eq 1 ]; then if [ $ok -eq 1 ]; then
green "OK: $ext passed!" green "OK: $ext passed!"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment