mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Remove the need for LLVM_BACKEND_SUPPORT
This commit is contained in:
@@ -8,11 +8,11 @@ OS=$(shell uname)
|
|||||||
|
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
LDFLAGS:=$(LDFLAGS) -liconv
|
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
|
LDFLAGS:=$(LDFLAGS) -lLLVM-C
|
||||||
endif
|
endif
|
||||||
ifeq ($(OS), Linux)
|
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)
|
LDFLAGS:=$(LDFLAGS) $(shell llvm-config-11 --libs core native --system-libs)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if "%2" == "1" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF
|
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
|
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%\"
|
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 *.pdb > NUL 2> NUL
|
||||||
del *.ilk > 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 %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
|
del *.obj > NUL 2> NUL
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#if defined(LLVM_BACKEND_SUPPORT)
|
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
#include "llvm-c/Core.h"
|
#include "llvm-c/Core.h"
|
||||||
#include "llvm-c/ExecutionEngine.h"
|
#include "llvm-c/ExecutionEngine.h"
|
||||||
@@ -30,7 +29,6 @@
|
|||||||
#include <llvm-c/Transforms/Utils.h>
|
#include <llvm-c/Transforms/Utils.h>
|
||||||
#include <llvm-c/Transforms/Vectorize.h>
|
#include <llvm-c/Transforms/Vectorize.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
struct lbProcedure;
|
struct lbProcedure;
|
||||||
|
|
||||||
|
|||||||
+3
-15
@@ -10,13 +10,11 @@
|
|||||||
|
|
||||||
gb_global Timings global_timings = {0};
|
gb_global Timings global_timings = {0};
|
||||||
|
|
||||||
#if defined(LLVM_BACKEND_SUPPORT)
|
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
#include "llvm-c/Types.h"
|
#include "llvm-c/Types.h"
|
||||||
#else
|
#else
|
||||||
#include <llvm-c/Types.h>
|
#include <llvm-c/Types.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "parser.hpp"
|
#include "parser.hpp"
|
||||||
#include "checker.hpp"
|
#include "checker.hpp"
|
||||||
@@ -26,7 +24,6 @@ gb_global Timings global_timings = {0};
|
|||||||
#include "docs.cpp"
|
#include "docs.cpp"
|
||||||
|
|
||||||
|
|
||||||
#if defined(LLVM_BACKEND_SUPPORT)
|
|
||||||
#include "llvm_backend.cpp"
|
#include "llvm_backend.cpp"
|
||||||
|
|
||||||
#if defined(GB_SYSTEM_OSX)
|
#if defined(GB_SYSTEM_OSX)
|
||||||
@@ -36,8 +33,6 @@ gb_global Timings global_timings = {0};
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ir.cpp"
|
#include "ir.cpp"
|
||||||
#include "ir_opt.cpp"
|
#include "ir_opt.cpp"
|
||||||
#include "ir_print.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 linker_stage(lbGenerator *gen) {
|
||||||
i32 result = 0;
|
i32 result = 0;
|
||||||
Timings *timings = &global_timings;
|
Timings *timings = &global_timings;
|
||||||
@@ -470,7 +464,6 @@ i32 linker_stage(lbGenerator *gen) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Array<String> setup_args(int argc, char const **argv) {
|
Array<String> setup_args(int argc, char const **argv) {
|
||||||
gbAllocator a = heap_allocator();
|
gbAllocator a = heap_allocator();
|
||||||
@@ -2190,7 +2183,6 @@ int main(int arg_count, char const **arg_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (build_context.use_llvm_api) {
|
if (build_context.use_llvm_api) {
|
||||||
#if defined(LLVM_BACKEND_SUPPORT)
|
|
||||||
timings_start_section(timings, str_lit("LLVM API Code Gen"));
|
timings_start_section(timings, str_lit("LLVM API Code Gen"));
|
||||||
lbGenerator gen = {};
|
lbGenerator gen = {};
|
||||||
if (!lb_init_generator(&gen, &checker)) {
|
if (!lb_init_generator(&gen, &checker)) {
|
||||||
@@ -2204,9 +2196,9 @@ int main(int arg_count, char const **arg_ptr) {
|
|||||||
case BuildMode_Executable:
|
case BuildMode_Executable:
|
||||||
case BuildMode_DynamicLibrary:
|
case BuildMode_DynamicLibrary:
|
||||||
i32 result = linker_stage(&gen);
|
i32 result = linker_stage(&gen);
|
||||||
if(result != 0) {
|
if (result != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2257,10 +2249,6 @@ int main(int arg_count, char const **arg_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
gb_printf_err("LLVM C API backend is not supported on this platform yet\n");
|
|
||||||
return 1;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
irGen ir_gen = {0};
|
irGen ir_gen = {0};
|
||||||
if (!ir_gen_init(&ir_gen, &checker)) {
|
if (!ir_gen_init(&ir_gen, &checker)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user