Remove the need for LLVM_BACKEND_SUPPORT

This commit is contained in:
gingerBill
2021-04-25 19:49:29 +01:00
parent cd125c0f41
commit 66a70b9d27
4 changed files with 11 additions and 22 deletions
+2 -2
View File
@@ -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
+6 -3
View File
@@ -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
-2
View File
@@ -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;
+3 -15
View File
@@ -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)) {