summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-28 12:53:53 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-29 10:10:22 -0400
commitb75cb8388fb9b5f2393443d008bb46c522c5ec9b (patch)
tree25268fe5f71d826ee1f8f0e3a2a82aa68f9bf750
parent1b4943eb1f2a10837f56070bfe604179d0dc10e0 (diff)
downloadroux-b75cb8388fb9b5f2393443d008bb46c522c5ec9b.tar.gz
new layout, put LICENSE in root
-rw-r--r--.gitignore5
-rw-r--r--.tag (renamed from src/.tag)0
-rw-r--r--LICENSE (renamed from minic/LICENSE)4
-rw-r--r--Makefile45
-rw-r--r--README8
-rw-r--r--all.h (renamed from src/all.h)0
-rw-r--r--copy.c (renamed from src/copy.c)0
-rw-r--r--emit.c (renamed from src/emit.c)0
-rw-r--r--isel.c (renamed from src/isel.c)0
-rw-r--r--live.c (renamed from src/live.c)0
-rw-r--r--main.c (renamed from src/main.c)0
-rw-r--r--mem.c (renamed from src/mem.c)0
-rw-r--r--minic/Makefile4
-rwxr-xr-xminic/mcc2
-rw-r--r--parse.c (renamed from src/parse.c)0
-rw-r--r--rega.c (renamed from src/rega.c)0
-rw-r--r--spill.c (renamed from src/spill.c)0
-rw-r--r--src/.gitignore5
-rw-r--r--src/Makefile24
-rw-r--r--ssa.c (renamed from src/ssa.c)0
-rwxr-xr-xtools/abifuzz.sh2
-rw-r--r--tools/fptox.c18
-rw-r--r--tools/pmov.c2
-rwxr-xr-xtools/regress.sh17
-rwxr-xr-xtools/unit.sh (renamed from test/go.sh)4
-rw-r--r--util.c (renamed from src/util.c)0
26 files changed, 58 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore
index 2b1c6c0..c466bca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
-papers
+obj
+config.h
+.comfile
+*.out
diff --git a/src/.tag b/.tag
index 5b8c210..5b8c210 100644
--- a/src/.tag
+++ b/.tag
diff --git a/minic/LICENSE b/LICENSE
index 8af557b..0b358b4 100644
--- a/minic/LICENSE
+++ b/LICENSE
@@ -1,6 +1,4 @@
-MIT/X Consortium License
-
-© 2015-2016 Quentin Carbonneaux
+© 2015-2016 Quentin Carbonneaux <quentin@c9x.me>
 
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
diff --git a/Makefile b/Makefile
index 9aefa3e..7c2bec8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,41 @@
-all clean check:
-	@make -C src $@
-	@make -C minic $@
+BIN = qbe
 
-sync-papers:
-	unison -auto papers ssh://qcar@h/data/d/ssa-doc
+V = @
+OBJDIR = obj
 
-.PHONY: all clean check sync-papers
+SRC = main.c util.c parse.c mem.c ssa.c copy.c live.c isel.c spill.c rega.c emit.c
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
+
+CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
+
+$(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
+	@echo "ld $@"
+	$(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
+
+$(OBJDIR)/%.o: %.c $(OBJDIR)/timestamp
+	@echo "cc $<"
+	$(V)$(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/timestamp:
+	@mkdir -p $(OBJDIR)
+	@touch $@
+
+$(OBJ): all.h
+obj/main.o: config.h
+
+config.h:
+	@case `uname` in                                \
+	*Darwin*) echo "#define Defaultasm Gasmacho" ;; \
+	*Linux*)  echo "#define Defaultasm Gaself" ;;   \
+	esac > $@
+
+clean:
+	rm -fr $(OBJDIR)
+
+clean-gen: clean
+	rm -f config.h
+
+check: $(OBJDIR)/$(BIN)
+	tools/unit.sh all
+
+.PHONY: clean clean-gen check syndoc
diff --git a/README b/README
new file mode 100644
index 0000000..2f3d90e
--- /dev/null
+++ b/README
@@ -0,0 +1,8 @@
+QBE - Backend Compiler              http://c9x.me/compile/
+
+doc/    Documentation.
+minic/  An example C frontend for QBE.
+tools/  Miscelaneous tools (testing).
+test/   Unit tests.
+
+The LICENSE file applies to all files distributed.
diff --git a/src/all.h b/all.h
index 40c80f6..40c80f6 100644
--- a/src/all.h
+++ b/all.h
diff --git a/src/copy.c b/copy.c
index ef2d01d..ef2d01d 100644
--- a/src/copy.c
+++ b/copy.c
diff --git a/src/emit.c b/emit.c
index 9b2975d..9b2975d 100644
--- a/src/emit.c
+++ b/emit.c
diff --git a/src/isel.c b/isel.c
index 2a55733..2a55733 100644
--- a/src/isel.c
+++ b/isel.c
diff --git a/src/live.c b/live.c
index 44806e1..44806e1 100644
--- a/src/live.c
+++ b/live.c
diff --git a/src/main.c b/main.c
index c1664be..c1664be 100644
--- a/src/main.c
+++ b/main.c
diff --git a/src/mem.c b/mem.c
index bda43d7..bda43d7 100644
--- a/src/mem.c
+++ b/mem.c
diff --git a/minic/Makefile b/minic/Makefile
index 66f0f04..856f2d3 100644
--- a/minic/Makefile
+++ b/minic/Makefile
@@ -6,9 +6,7 @@ $(BIN): yacc minic.y
 	./yacc minic.y
 	$(CC) $(CFLAGS) -o $@ y.tab.c
 
-all: $(BIN)
-check:
 clean:
 	rm -f yacc minic y.*
 
-.PHONY: all check clean
+.PHONY: clean
diff --git a/minic/mcc b/minic/mcc
index 5a95042..1c54fb9 100755
--- a/minic/mcc
+++ b/minic/mcc
@@ -29,7 +29,7 @@ fi
 
 
 ../minic/minic < $file        > /tmp/minic.ssa &&
-../src/qbe < /tmp/minic.ssa   > /tmp/minic.s   &&
+../obj/qbe < /tmp/minic.ssa   > /tmp/minic.s   &&
 cc $flags /tmp/minic.s
 
 if test $? -ne 0
diff --git a/src/parse.c b/parse.c
index 2590971..2590971 100644
--- a/src/parse.c
+++ b/parse.c
diff --git a/src/rega.c b/rega.c
index 7f8edcf..7f8edcf 100644
--- a/src/rega.c
+++ b/rega.c
diff --git a/src/spill.c b/spill.c
index 72f8106..72f8106 100644
--- a/src/spill.c
+++ b/spill.c
diff --git a/src/.gitignore b/src/.gitignore
deleted file mode 100644
index 5c8ecc2..0000000
--- a/src/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-qbe
-config.h
-.comfile
-*.o
-*.out
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644
index 6adfbd3..0000000
--- a/src/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-BIN = qbe
-OBJ = main.o util.o parse.o mem.o ssa.o copy.o live.o isel.o spill.o rega.o emit.o
-
-CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
-
-$(BIN): $(OBJ)
-	$(CC) $(LDFLAGS) $(OBJ) -o $@
-
-$(OBJ): all.h config.h
-
-config.h:
-	@case `uname` in                                \
-	*Darwin*) echo "#define Defaultasm Gasmacho" ;; \
-	*Linux*)  echo "#define Defaultasm Gaself" ;;   \
-	esac > $@
-
-
-all: $(BIN)
-clean:
-	rm -f $(BIN) $(OBJ)
-check: $(BIN)
-	../test/go.sh all
-
-.PHONY: all clean check syndoc
diff --git a/src/ssa.c b/ssa.c
index 0c163aa..0c163aa 100644
--- a/src/ssa.c
+++ b/ssa.c
diff --git a/tools/abifuzz.sh b/tools/abifuzz.sh
index 57930fb..e715b3d 100755
--- a/tools/abifuzz.sh
+++ b/tools/abifuzz.sh
@@ -2,7 +2,7 @@
 
 OCAMLC=${OCAMLC:-/usr/bin/ocamlc}
 DIR=`cd $(dirname "$0"); pwd`
-QBE=$DIR/../src/qbe
+QBE=$DIR/../obj/qbe
 
 failure() {
 	echo "Failure at stage:" $1 >&2
diff --git a/tools/fptox.c b/tools/fptox.c
deleted file mode 100644
index a2bc155..0000000
--- a/tools/fptox.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-int
-main(int ac, char *av[])
-{
-	double d;
-	float f;
-
-	if (ac < 2) {
-	usage:
-		fputs("usage: fptox NUMBER\n", stderr);
-		return 1;
-	}
-	f = d = strtod(av[1], 0);
-	printf("0x%08x 0x%016llx\n", *(unsigned *)&f, *(unsigned long long*)&d);
-	return 0;
-}
diff --git a/tools/pmov.c b/tools/pmov.c
index 9136374..62d3921 100644
--- a/tools/pmov.c
+++ b/tools/pmov.c
@@ -13,7 +13,7 @@
 
 static void assert_test(char *, int), fail(void), iexec(int *);
 
-#include "../src/rega.c"
+#include "../../rega.c"
 
 static void bsinit_(BSet *, uint);
 
diff --git a/tools/regress.sh b/tools/regress.sh
deleted file mode 100755
index 5aaea35..0000000
--- a/tools/regress.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-for t in ../test/*
-do
-	printf "Test $t ... "
-
-	./qbe   $t >/tmp/out.0 2>&1
-	./qbe.1 $t >/tmp/out.1 2>&1
-
-	if diff /tmp/out.0 /tmp/out.1 > /dev/null
-	then
-		echo "OK"
-	else
-		echo "KO"
-		break
-	fi
-done
diff --git a/test/go.sh b/tools/unit.sh
index d2563d4..c4a85d2 100755
--- a/test/go.sh
+++ b/tools/unit.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 DIR=`cd $(dirname "$0"); pwd`
-QBE=$DIR/../src/qbe
+QBE=$DIR/../obj/qbe
 
 TMP=/tmp/qbe.zzzz
 
@@ -98,7 +98,7 @@ fi
 case $1 in
 	"all")
 		F=0
-		for T in $DIR/[!_]*.ssa
+		for T in $DIR/../test/[!_]*.ssa
 		do
 			once $T
 			F=`expr $F + $?`
diff --git a/src/util.c b/util.c
index 65b3ff8..65b3ff8 100644
--- a/src/util.c
+++ b/util.c