diff options
| author | gingerBill <bill@gingerbill.org> | 2021-04-25 19:49:29 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-04-25 19:49:29 +0100 |
| commit | 66a70b9d273509b5f4d827ec0a5de66810b10e00 (patch) | |
| tree | eed7438cf495085431d27f74f1f9c8135956d2de | |
| parent | cd125c0f416af055bc9fadc2fb46f7b8865f87ad (diff) | |
Remove the need for `LLVM_BACKEND_SUPPORT`
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | build.bat | 9 | ||||
| -rw-r--r-- | src/llvm_backend.hpp | 2 | ||||
| -rw-r--r-- | src/main.cpp | 18 |
4 files changed, 11 insertions, 22 deletions
@@ -8,11 +8,11 @@ OS=$(shell uname) ifeq ($(OS), Darwin) LDFLAGS:=$(LDFLAGS) -liconv - CFLAGS:=$(CFLAGS) $(shell llvm-config --cxxflags --ldflags) -DLLVM_BACKEND_SUPPORT -DUSE_NEW_LLVM_ABI_SYSTEM + CFLAGS:=$(CFLAGS) $(shell llvm-config --cxxflags --ldflags) LDFLAGS:=$(LDFLAGS) -lLLVM-C endif ifeq ($(OS), Linux) - CFLAGS:=$(CFLAGS) $(shell llvm-config-11 --cxxflags --ldflags) -DLLVM_BACKEND_SUPPORT -DUSE_NEW_LLVM_ABI_SYSTEM + CFLAGS:=$(CFLAGS) $(shell llvm-config-11 --cxxflags --ldflags) LDFLAGS:=$(LDFLAGS) $(shell llvm-config-11 --libs core native --system-libs) endif @@ -20,7 +20,7 @@ if "%2" == "1" ( ) set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF -set compiler_defines= -DLLVM_BACKEND_SUPPORT -DUSE_NEW_LLVM_ABI_SYSTEM +set compiler_defines= for /f %%i in ('git rev-parse --short HEAD') do set GIT_SHA=%%i if %ERRORLEVEL% equ 0 set compiler_defines=%compiler_defines% -DGIT_SHA=\"%GIT_SHA%\" @@ -59,10 +59,13 @@ set linker_settings=%libs% %linker_flags% del *.pdb > NUL 2> NUL del *.ilk > NUL 2> NUL -cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% +rem cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% + +cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% ^ + && odin run examples/demo if %errorlevel% neq 0 goto end_of_build -if %release_mode% EQU 0 odin run examples/demo/demo.odin +rem if %release_mode% EQU 0 odin run examples/demo/demo.odin del *.obj > NUL 2> NUL diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index 9c8c357f0..c2202131a 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -1,4 +1,3 @@ -#if defined(LLVM_BACKEND_SUPPORT) #if defined(GB_SYSTEM_WINDOWS) #include "llvm-c/Core.h" #include "llvm-c/ExecutionEngine.h" @@ -30,7 +29,6 @@ #include <llvm-c/Transforms/Utils.h> #include <llvm-c/Transforms/Vectorize.h> #endif -#endif struct lbProcedure; diff --git a/src/main.cpp b/src/main.cpp index 3753a6cb9..16863caeb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,13 +10,11 @@ gb_global Timings global_timings = {0}; -#if defined(LLVM_BACKEND_SUPPORT) #if defined(GB_SYSTEM_WINDOWS) #include "llvm-c/Types.h" #else #include <llvm-c/Types.h> #endif -#endif #include "parser.hpp" #include "checker.hpp" @@ -26,7 +24,6 @@ gb_global Timings global_timings = {0}; #include "docs.cpp" -#if defined(LLVM_BACKEND_SUPPORT) #include "llvm_backend.cpp" #if defined(GB_SYSTEM_OSX) @@ -36,8 +33,6 @@ gb_global Timings global_timings = {0}; #endif #endif -#endif - #include "ir.cpp" #include "ir_opt.cpp" #include "ir_print.cpp" @@ -154,7 +149,6 @@ i32 system_exec_command_line_app(char const *name, char const *fmt, ...) { -#if defined(LLVM_BACKEND_SUPPORT) i32 linker_stage(lbGenerator *gen) { i32 result = 0; Timings *timings = &global_timings; @@ -470,7 +464,6 @@ i32 linker_stage(lbGenerator *gen) { return result; } -#endif Array<String> setup_args(int argc, char const **argv) { gbAllocator a = heap_allocator(); @@ -2190,7 +2183,6 @@ int main(int arg_count, char const **arg_ptr) { } if (build_context.use_llvm_api) { -#if defined(LLVM_BACKEND_SUPPORT) timings_start_section(timings, str_lit("LLVM API Code Gen")); lbGenerator gen = {}; if (!lb_init_generator(&gen, &checker)) { @@ -2204,9 +2196,9 @@ int main(int arg_count, char const **arg_ptr) { case BuildMode_Executable: case BuildMode_DynamicLibrary: i32 result = linker_stage(&gen); - if(result != 0) { - return 1; - } + if (result != 0) { + return 1; + } break; } @@ -2257,10 +2249,6 @@ int main(int arg_count, char const **arg_ptr) { } return 0; -#else - gb_printf_err("LLVM C API backend is not supported on this platform yet\n"); - return 1; -#endif } else { irGen ir_gen = {0}; if (!ir_gen_init(&ir_gen, &checker)) { |