Bladeren bron

new layout, put LICENSE in root

Quentin Carbonneaux 9 jaren geleden
bovenliggende
commit
b75cb8388f
26 gewijzigde bestanden met toevoegingen van 58 en 82 verwijderingen
  1. 4 1
      .gitignore
  2. 0 0
      .tag
  3. 1 3
      LICENSE
  4. 39 6
      Makefile
  5. 8 0
      README
  6. 0 0
      all.h
  7. 0 0
      copy.c
  8. 0 0
      emit.c
  9. 0 0
      isel.c
  10. 0 0
      live.c
  11. 0 0
      main.c
  12. 0 0
      mem.c
  13. 1 3
      minic/Makefile
  14. 1 1
      minic/mcc
  15. 0 0
      parse.c
  16. 0 0
      rega.c
  17. 0 0
      spill.c
  18. 0 5
      src/.gitignore
  19. 0 24
      src/Makefile
  20. 0 0
      ssa.c
  21. 1 1
      tools/abifuzz.sh
  22. 0 18
      tools/fptox.c
  23. 1 1
      tools/pmov.c
  24. 0 17
      tools/regress.sh
  25. 2 2
      tools/unit.sh
  26. 0 0
      util.c

+ 4 - 1
.gitignore

@@ -1 +1,4 @@
-papers
+obj
+config.h
+.comfile
+*.out

+ 0 - 0
src/.tag → .tag


+ 1 - 3
minic/LICENSE → LICENSE

@@ -1,6 +1,4 @@
-MIT/X Consortium License
-
-© 2015-2016 Quentin Carbonneaux
+© 2015-2016 Quentin Carbonneaux <[email protected]>
 
 
 Permission is hereby granted, free of charge, to any person obtaining a
 Permission is hereby granted, free of charge, to any person obtaining a
 copy of this software and associated documentation files (the "Software"),
 copy of this software and associated documentation files (the "Software"),

+ 39 - 6
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

+ 8 - 0
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.

+ 0 - 0
src/all.h → all.h


+ 0 - 0
src/copy.c → copy.c


+ 0 - 0
src/emit.c → emit.c


+ 0 - 0
src/isel.c → isel.c


+ 0 - 0
src/live.c → live.c


+ 0 - 0
src/main.c → main.c


+ 0 - 0
src/mem.c → mem.c


+ 1 - 3
minic/Makefile

@@ -6,9 +6,7 @@ $(BIN): yacc minic.y
 	./yacc minic.y
 	./yacc minic.y
 	$(CC) $(CFLAGS) -o $@ y.tab.c
 	$(CC) $(CFLAGS) -o $@ y.tab.c
 
 
-all: $(BIN)
-check:
 clean:
 clean:
 	rm -f yacc minic y.*
 	rm -f yacc minic y.*
 
 
-.PHONY: all check clean
+.PHONY: clean

+ 1 - 1
minic/mcc

@@ -29,7 +29,7 @@ fi
 
 
 
 
 ../minic/minic < $file        > /tmp/minic.ssa &&
 ../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
 cc $flags /tmp/minic.s
 
 
 if test $? -ne 0
 if test $? -ne 0

+ 0 - 0
src/parse.c → parse.c


+ 0 - 0
src/rega.c → rega.c


+ 0 - 0
src/spill.c → spill.c


+ 0 - 5
src/.gitignore

@@ -1,5 +0,0 @@
-qbe
-config.h
-.comfile
-*.o
-*.out

+ 0 - 24
src/Makefile

@@ -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

+ 0 - 0
src/ssa.c → ssa.c


+ 1 - 1
tools/abifuzz.sh

@@ -2,7 +2,7 @@
 
 
 OCAMLC=${OCAMLC:-/usr/bin/ocamlc}
 OCAMLC=${OCAMLC:-/usr/bin/ocamlc}
 DIR=`cd $(dirname "$0"); pwd`
 DIR=`cd $(dirname "$0"); pwd`
-QBE=$DIR/../src/qbe
+QBE=$DIR/../obj/qbe
 
 
 failure() {
 failure() {
 	echo "Failure at stage:" $1 >&2
 	echo "Failure at stage:" $1 >&2

+ 0 - 18
tools/fptox.c

@@ -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;
-}

+ 1 - 1
tools/pmov.c

@@ -13,7 +13,7 @@
 
 
 static void assert_test(char *, int), fail(void), iexec(int *);
 static void assert_test(char *, int), fail(void), iexec(int *);
 
 
-#include "../src/rega.c"
+#include "../../rega.c"
 
 
 static void bsinit_(BSet *, uint);
 static void bsinit_(BSet *, uint);
 
 

+ 0 - 17
tools/regress.sh

@@ -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

+ 2 - 2
test/go.sh → tools/unit.sh

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 
 
 DIR=`cd $(dirname "$0"); pwd`
 DIR=`cd $(dirname "$0"); pwd`
-QBE=$DIR/../src/qbe
+QBE=$DIR/../obj/qbe
 
 
 TMP=/tmp/qbe.zzzz
 TMP=/tmp/qbe.zzzz
 
 
@@ -98,7 +98,7 @@ fi
 case $1 in
 case $1 in
 	"all")
 	"all")
 		F=0
 		F=0
-		for T in $DIR/[!_]*.ssa
+		for T in $DIR/../test/[!_]*.ssa
 		do
 		do
 			once $T
 			once $T
 			F=`expr $F + $?`
 			F=`expr $F + $?`

+ 0 - 0
src/util.c → util.c