Commit 7c15aefe authored by Ronald Charles Moore's avatar Ronald Charles Moore
Browse files

Updated for LLVM 11 (NOT for LLVM 12 - yet)


Signed-off-by: Ronald Charles Moore's avatarProf. Ronald Moore <ronald.moore@h-da.de>
parent 678ccf32
......@@ -17,29 +17,38 @@ CC := clang++
# clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core` -o toy
# based on that, and some experimentation, we got, for LLVM 3.6...
# CFLAGS=-std=c++11 `llvm-config --cxxflags --ldflags --system-libs --libs all` -rdynamic -O3
# Now, for llvm >= 3.7.1, further experience has brought us to....
# At one time, we piped the output of llvm-config to sed s/no-maybe/no/ .
# Hopefully this is no longer necessary... ?
# Later, for a while, we piped the output of llvm-config to sed s/no-maybe/no/
# (sed was used to hide an incompatibility between llvm-config and clang)
# Hopefully this seems to no longer be necessary.
# So, the current solution is...
LLVM_FLAGS := `llvm-config --cxxflags --ldflags --system-libs --libs all `
CFLAGS := $(LLVM_FLAGS) -rdynamic -O3
## More preliminaries
# See https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
### Gnu Make Preliminaries -- See also
# https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
# In this makefile, we want to keep going even if we find errors
.IGNORE :
# Update: Let's only ignore errors in the tests, not in the build.
.IGNORE : $(TESTS)
# Further, we do not want multiple things built at once, even if make called with -j2
.NOTPARALLEL :
# Tell make that the following "targets" are "phony"
# Cf. https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY : all tests clean testclean
# We define the list of tests how, so that we can declare them "phony".
# WARNING: test9 is included, but seems to be broken... ?!?
TESTS := testModuleMaker testFibonacci test2 test3 test4 test5 test6 test7 test8 test9
# "A phony target is one that is not really the name of a file;
# rather it is just a name for a recipe to be executed
# when you make an explicit request".
# Quote from (see also)
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets
.PHONY : all tests clean testclean $(TESTS)
## Now, the targets -- the things that will get made!
#### Now, the targets -- the things that will get made!
all: $(PROGS)
......@@ -52,12 +61,13 @@ clean: testclean
testclean:
rm -fv *~ *.output test8.o test9
tests: $(TESTS)
testModuleMaker: ModuleMaker
echo && echo "Testing ModuleMaker (expect 5)...\n"
@./ModuleMaker >ModuleMaker.bc
@lli ModuleMaker.bc || echo $$?
# WARNING: testFibonacci broken (with LLVM and clang 3.7.1)
testFibonacci: fibonacci
echo && echo "\n===================> Testing fibonacci (expect 46368)...\n"
-./fibonacci
......@@ -97,7 +107,3 @@ test9: toy9 tests/test9.kal
-./toy9 <tests/test9.kal |& clang -x ir - -o test9
-./test9
# WARNING: test9 removed since broken (with LLVM and clang <= 3.9)
# NOTE: fibonacci added BACK to tests since it's working again!
tests: testModuleMaker testFibonacci test2 test3 test4 test5 test6 test7 test8
......@@ -4,4 +4,4 @@ def fib(x)
else
fib(x-1)+fib(x-2);
fib(10)
fib(2)
......@@ -802,7 +802,7 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
SourceLocation FnLoc = CurLoc;
if (auto E = ParseExpression()) {
// Make an anonymous proto.
auto Proto = std::make_unique<PrototypeAST>(FnLoc, "__anon_expr",
auto Proto = std::make_unique<PrototypeAST>(FnLoc, "main", // "__anon_expr",
std::vector<std::string>());
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
......
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