Skip to content
Snippets Groups Projects
Commit 7c15aefe authored by Ronald Charles Moore's avatar Ronald Charles Moore
Browse files

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

parent 678ccf32
No related branches found
No related tags found
No related merge requests found
...@@ -17,29 +17,38 @@ CC := clang++ ...@@ -17,29 +17,38 @@ CC := clang++
# clang++ -g -O3 toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core` -o toy # 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... # 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 # 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.... # Later, for a while, we piped the output of llvm-config to sed s/no-maybe/no/
# At one time, we piped the output of llvm-config to sed s/no-maybe/no/ .
# Hopefully this is no longer necessary... ?
# (sed was used to hide an incompatibility between llvm-config and clang) # (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 ` LLVM_FLAGS := `llvm-config --cxxflags --ldflags --system-libs --libs all `
CFLAGS := $(LLVM_FLAGS) -rdynamic -O3 CFLAGS := $(LLVM_FLAGS) -rdynamic -O3
## More preliminaries ### Gnu Make Preliminaries -- See also
# See https://www.gnu.org/software/make/manual/html_node/Special-Targets.html # 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 # 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 # Further, we do not want multiple things built at once, even if make called with -j2
.NOTPARALLEL : .NOTPARALLEL :
# Tell make that the following "targets" are "phony" # We define the list of tests how, so that we can declare them "phony".
# Cf. https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets # WARNING: test9 is included, but seems to be broken... ?!?
.PHONY : all tests clean testclean 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) all: $(PROGS)
...@@ -52,12 +61,13 @@ clean: testclean ...@@ -52,12 +61,13 @@ clean: testclean
testclean: testclean:
rm -fv *~ *.output test8.o test9 rm -fv *~ *.output test8.o test9
tests: $(TESTS)
testModuleMaker: ModuleMaker testModuleMaker: ModuleMaker
echo && echo "Testing ModuleMaker (expect 5)...\n" echo && echo "Testing ModuleMaker (expect 5)...\n"
@./ModuleMaker >ModuleMaker.bc @./ModuleMaker >ModuleMaker.bc
@lli ModuleMaker.bc || echo $$? @lli ModuleMaker.bc || echo $$?
# WARNING: testFibonacci broken (with LLVM and clang 3.7.1)
testFibonacci: fibonacci testFibonacci: fibonacci
echo && echo "\n===================> Testing fibonacci (expect 46368)...\n" echo && echo "\n===================> Testing fibonacci (expect 46368)...\n"
-./fibonacci -./fibonacci
...@@ -97,7 +107,3 @@ test9: toy9 tests/test9.kal ...@@ -97,7 +107,3 @@ test9: toy9 tests/test9.kal
-./toy9 <tests/test9.kal |& clang -x ir - -o test9 -./toy9 <tests/test9.kal |& clang -x ir - -o test9
-./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) ...@@ -4,4 +4,4 @@ def fib(x)
else else
fib(x-1)+fib(x-2); fib(x-1)+fib(x-2);
fib(10) fib(2)
...@@ -802,7 +802,7 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() { ...@@ -802,7 +802,7 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
SourceLocation FnLoc = CurLoc; SourceLocation FnLoc = CurLoc;
if (auto E = ParseExpression()) { if (auto E = ParseExpression()) {
// Make an anonymous proto. // 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>()); std::vector<std::string>());
return std::make_unique<FunctionAST>(std::move(Proto), std::move(E)); return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment