-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.sh
More file actions
executable file
·28 lines (21 loc) · 1.02 KB
/
Copy pathcompiler.sh
File metadata and controls
executable file
·28 lines (21 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
echo "Clean up old generated files..."
rm src/generated/*
echo "Generate parser..."
bison src/grammar.in -o src/generated/c-parser-generated.cpp
echo "Generate lexer..."
flex -d -o src/generated/c-lexer-generated.cpp src/c.flex
echo "Compile the compiler..."
# g++ -D DEBUG_PARSING -O3 src/generated/*.cpp src/*.cpp src/ast-types/*.cpp `llvm-config --system-libs --cppflags --ldflags --libs core` -o out/compiler
g++ -O3 src/generated/*.cpp src/*.cpp src/ast-types/*.cpp src/ast-visitors/*.cpp `llvm-config --system-libs --cppflags --ldflags --libs core` -o out/compiler
echo "Generate LLVM IR..."
./out/compiler < test-files/test.c
# valgrind --track-origins=yes ./out/compiler < test-files/test.c
# valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./out/compiler < test-files/test.c
echo "Generate binary (from .ll)..."
llc -filetype=obj out/test.ll -o out/test
# ./out/test
# echo "Generate assembly..."
# llc -filetype=asm out/test.ll -o out/test.s
echo ""
echo "Valid symbols in the executable:"
nm -g out/test