From cd125c0f416af055bc9fadc2fb46f7b8865f87ad Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 25 Apr 2021 19:46:48 +0100 Subject: Override `-llvm-api` to always be true --- src/build_settings.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/build_settings.cpp') diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 92ac5d284..0be18a0d4 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -782,6 +782,8 @@ void init_build_context(TargetMetrics *cross_target) { bc->link_flags = str_lit(" "); bc->opt_flags = str_lit(" "); + bc->use_llvm_api = true; + gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64); if (bc->ODIN_DEBUG) { -- cgit v1.2.3 From cb2e6ea31db90ca80314e5ff8ce8f43371fade7c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 25 Apr 2021 20:03:05 +0100 Subject: Remove `use_llvm_api` related checks and other related things --- core/runtime/internal.odin | 40 ++++++++++------------------------------ core/sys/cpu/cpu.odin | 2 -- src/build_settings.cpp | 8 -------- src/check_builtin.cpp | 40 ---------------------------------------- src/check_expr.cpp | 4 ---- src/check_stmt.cpp | 3 --- src/checker.cpp | 24 +++--------------------- src/main.cpp | 1 - 8 files changed, 13 insertions(+), 109 deletions(-) (limited to 'src/build_settings.cpp') diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 3c05fb6a7..e2f8c7287 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -107,22 +107,12 @@ mem_copy :: proc "contextless" (dst, src: rawptr, len: int) -> rawptr { } // NOTE(bill): This _must_ be implemented like C's memmove foreign _ { - when ODIN_USE_LLVM_API { - when size_of(rawptr) == 8 { - @(link_name="llvm.memmove.p0i8.p0i8.i64") - llvm_memmove :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; - } else { - @(link_name="llvm.memmove.p0i8.p0i8.i32") - llvm_memmove :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; - } + when size_of(rawptr) == 8 { + @(link_name="llvm.memmove.p0i8.p0i8.i64") + llvm_memmove :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; } else { - when size_of(rawptr) == 8 { - @(link_name="llvm.memmove.p0i8.p0i8.i64") - llvm_memmove :: proc "none" (dst, src: rawptr, len: int, align: i32 = 1, is_volatile: bool = false) ---; - } else { - @(link_name="llvm.memmove.p0i8.p0i8.i32") - llvm_memmove :: proc "none" (dst, src: rawptr, len: int, align: i32 = 1, is_volatile: bool = false) ---; - } + @(link_name="llvm.memmove.p0i8.p0i8.i32") + llvm_memmove :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; } } llvm_memmove(dst, src, len); @@ -135,22 +125,12 @@ mem_copy_non_overlapping :: proc "contextless" (dst, src: rawptr, len: int) -> r } // NOTE(bill): This _must_ be implemented like C's memcpy foreign _ { - when ODIN_USE_LLVM_API { - when size_of(rawptr) == 8 { - @(link_name="llvm.memcpy.p0i8.p0i8.i64") - llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; - } else { - @(link_name="llvm.memcpy.p0i8.p0i8.i32") - llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; - } + when size_of(rawptr) == 8 { + @(link_name="llvm.memcpy.p0i8.p0i8.i64") + llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; } else { - when size_of(rawptr) == 8 { - @(link_name="llvm.memcpy.p0i8.p0i8.i64") - llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, align: i32 = 1, is_volatile: bool = false) ---; - } else { - @(link_name="llvm.memcpy.p0i8.p0i8.i32") - llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, align: i32 = 1, is_volatile: bool = false) ---; - } + @(link_name="llvm.memcpy.p0i8.p0i8.i32") + llvm_memcpy :: proc "none" (dst, src: rawptr, len: int, is_volatile: bool = false) ---; } } llvm_memcpy(dst, src, len); diff --git a/core/sys/cpu/cpu.odin b/core/sys/cpu/cpu.odin index b6f770aed..b99fe01d8 100644 --- a/core/sys/cpu/cpu.odin +++ b/core/sys/cpu/cpu.odin @@ -1,7 +1,5 @@ package sys_cpu -#assert(ODIN_USE_LLVM_API); - Cache_Line_Pad :: struct {_: [_cache_line_size]byte}; initialized: bool; diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 0be18a0d4..461b1610c 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -204,8 +204,6 @@ struct BuildContext { bool ignore_warnings; bool warnings_as_errors; - bool use_llvm_api; - bool use_subsystem_windows; bool ignore_microsoft_magic; bool linker_map_file; @@ -782,8 +780,6 @@ void init_build_context(TargetMetrics *cross_target) { bc->link_flags = str_lit(" "); bc->opt_flags = str_lit(" "); - bc->use_llvm_api = true; - gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64); if (bc->ODIN_DEBUG) { @@ -841,10 +837,6 @@ void init_build_context(TargetMetrics *cross_target) { bc->link_flags = str_lit("-arch arm64 "); break; } - if ((bc->command_kind & Command__does_build) != 0 && !bc->use_llvm_api) { - gb_printf_err("The arm64 architecture is only supported with -llvm-api\n");; - gb_exit(1); - } } else if (bc->metrics.arch == TargetArch_wasm32) { bc->link_flags = str_lit("--no-entry --export-table --export-all --allow-undefined "); diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 5f4411b90..94e8dcee6 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -614,9 +614,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 } else if (type->kind == Type_SimdVector) { max_count = type->SimdVector.count; elem_type = type->SimdVector.elem; - if (!build_context.use_llvm_api) { - error(call, "'swizzle' with #simd vector is not supported on this backend"); - } } i64 arg_count = 0; @@ -1529,11 +1526,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 } case BuiltinProc_soa_zip: { - if (!build_context.use_llvm_api) { - error(call, "'soa_zip' is not supported with this backend"); - return false; - } - auto types = array_make(temporary_allocator(), 0, ce->args.count); auto names = array_make(temporary_allocator(), 0, ce->args.count); @@ -1681,11 +1673,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 } case BuiltinProc_soa_unzip: { - if (!build_context.use_llvm_api) { - error(call, "'soa_unzip' is not supported with this backend"); - return false; - } - Operand x = {}; check_expr(c, &x, ce->args[0]); if (x.mode == Addressing_Invalid) { @@ -1927,16 +1914,10 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 case BuiltinProc_trap: case BuiltinProc_debug_trap: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - } operand->mode = Addressing_NoValue; break; case BuiltinProc_read_cycle_counter: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - } operand->mode = Addressing_Value; operand->type = t_i64; break; @@ -1944,10 +1925,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 case BuiltinProc_count_ones: case BuiltinProc_trailing_zeros: case BuiltinProc_reverse_bits: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - // continue anyway - } { Operand x = {}; check_expr(c, &x, ce->args[0]); @@ -1971,10 +1948,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 break; case BuiltinProc_byte_swap: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - // continue anyway - } { Operand x = {}; check_expr(c, &x, ce->args[0]); @@ -2006,10 +1979,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 case BuiltinProc_overflow_add: case BuiltinProc_overflow_sub: case BuiltinProc_overflow_mul: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - // continue anyway - } { Operand x = {}; Operand y = {}; @@ -2189,11 +2158,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 case BuiltinProc_fixed_point_mul_sat: case BuiltinProc_fixed_point_div_sat: { - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - // continue anyway - } - Operand x = {}; Operand y = {}; Operand z = {}; @@ -2255,10 +2219,6 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 case BuiltinProc_expect: - if (!build_context.use_llvm_api) { - error(ce->args[0], "'%.*s' is not supported on this backend", LIT(builtin_procs[id].name)); - // continue anyway - } { Operand x = {}; Operand y = {}; diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 61cdf7822..2c83565a4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7903,10 +7903,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type error(node, "Inline asm expressions are only allowed within a procedure body"); } - if (!build_context.use_llvm_api) { - error(node, "Inline asm expressions are only currently allowed with -llvm-api"); - } - auto param_types = array_make(heap_allocator(), ia->param_types.count); Type *return_type = nullptr; for_array(i, ia->param_types) { diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index cad2be85b..a3c9a529c 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -1795,9 +1795,6 @@ void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) { if (is_ptr) use_by_reference_for_value = true; array_add(&vals, t->Struct.soa_elem); array_add(&vals, t_int); - if (!build_context.use_llvm_api) { - error(operand.expr, "#soa structures do not yet support for in loop iteration"); - } } break; } diff --git a/src/checker.cpp b/src/checker.cpp index 5a2203cfb..ecd9b5ea4 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -755,7 +755,6 @@ void init_universal(void) { add_global_constant(str_lit("ODIN_DEBUG"), t_untyped_bool, exact_value_bool(bc->ODIN_DEBUG)); add_global_constant(str_lit("ODIN_DISABLE_ASSERT"), t_untyped_bool, exact_value_bool(bc->ODIN_DISABLE_ASSERT)); add_global_constant(str_lit("ODIN_DEFAULT_TO_NIL_ALLOCATOR"), t_untyped_bool, exact_value_bool(bc->ODIN_DEFAULT_TO_NIL_ALLOCATOR)); - add_global_constant(str_lit("ODIN_USE_LLVM_API"), t_untyped_bool, exact_value_bool(bc->use_llvm_api)); add_global_constant(str_lit("ODIN_NO_DYNAMIC_LITERALS"), t_untyped_bool, exact_value_bool(bc->no_dynamic_literals)); add_global_constant(str_lit("ODIN_TEST"), t_untyped_bool, exact_value_bool(bc->command_kind == Command_test)); @@ -1774,23 +1773,6 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) { force_add_dependency_entity(c, c->info.runtime_package->scope, required_runtime_entities[i]); } - if (!build_context.use_llvm_api) { - String other_required_runtime_entities[] = { - str_lit("bswap_16"), - str_lit("bswap_32"), - str_lit("bswap_64"), - str_lit("bswap_128"), - - str_lit("bswap_f16"), - str_lit("bswap_f32"), - str_lit("bswap_f64"), - }; - - for (isize i = 0; i < gb_count_of(other_required_runtime_entities); i++) { - force_add_dependency_entity(c, c->info.runtime_package->scope, other_required_runtime_entities[i]); - } - } - if (build_context.no_crt) { String required_no_crt_entities[] = { // NOTE(bill): Only if these exist @@ -2741,7 +2723,7 @@ DECL_ATTRIBUTE_PROC(type_decl_attribute) { } } - if (valid && build_context.use_llvm_api) { + if (valid) { if (ac->atom_op_table == nullptr) { ac->atom_op_table = gb_alloc_item(permanent_allocator(), TypeAtomOpTable); } @@ -2800,7 +2782,7 @@ DECL_ATTRIBUTE_PROC(type_decl_attribute) { } } - if (valid && build_context.use_llvm_api) { + if (valid) { if (ac->atom_op_table == nullptr) { ac->atom_op_table = gb_alloc_item(permanent_allocator(), TypeAtomOpTable); } @@ -2882,7 +2864,7 @@ DECL_ATTRIBUTE_PROC(type_decl_attribute) { } } - if (valid && build_context.use_llvm_api) { + if (valid) { if (ac->atom_op_table == nullptr) { ac->atom_op_table = gb_alloc_item(permanent_allocator(), TypeAtomOpTable); } diff --git a/src/main.cpp b/src/main.cpp index 02a9b50f7..d2f84b29d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1185,7 +1185,6 @@ bool parse_build_flags(Array args) { case BuildFlag_UseLLVMApi: gb_printf_err("-llvm-api flag is not required any more\n"); - build_context.use_llvm_api = true; bad_flags = true; break; -- cgit v1.2.3 From 2af8e956a60a35bb9eab8b6c50d82de2dfe10a9b Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 25 Apr 2021 22:09:22 +0100 Subject: Change versioning system from `v0.13.1` to `dev-2021-04` --- build.bat | 8 ++++++++ src/build_settings.cpp | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/build_settings.cpp') diff --git a/build.bat b/build.bat index e76ae0c38..782ce4e91 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,10 @@ @echo off +setlocal EnableDelayedExpansion + +set curr_year=%DATE:~-4% +set curr_month=%DATE:~3,2% + :: Make sure this is a decent name and not generic set exe_name=odin.exe @@ -19,8 +24,11 @@ if "%2" == "1" ( set nightly=0 ) +set odin_version_raw="dev-%curr_year%-%curr_month%" + set compiler_flags= -nologo -Oi -TP -fp:precise -Gm- -MP -FC -EHsc- -GR- -GF set compiler_defines= +rem -DODIN_VERSION_RAW=%odin_version_raw% 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%\" diff --git a/src/build_settings.cpp b/src/build_settings.cpp index 461b1610c..ee6b04d44 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -71,9 +71,11 @@ TargetEndianKind target_endians[TargetArch_COUNT] = { TargetEndian_Little, }; +#ifndef ODIN_VERSION_RAW +#define ODIN_VERSION_RAW "dev-2021-unknown" +#endif - -String const ODIN_VERSION = str_lit("0.13.1"); +String const ODIN_VERSION = str_lit(ODIN_VERSION_RAW); -- cgit v1.2.3 From 5a88fef483a49bd0c909b1286b2ea548d7e63fa8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 26 Apr 2021 18:07:34 +0100 Subject: Make corrections --- build.bat | 5 +---- src/build_settings.cpp | 2 +- src/main.cpp | 33 --------------------------------- 3 files changed, 2 insertions(+), 38 deletions(-) (limited to 'src/build_settings.cpp') diff --git a/build.bat b/build.bat index 9ecc23391..c6a634aeb 100644 --- a/build.bat +++ b/build.bat @@ -66,10 +66,7 @@ set linker_settings=%libs% %linker_flags% del *.pdb > NUL 2> NUL del *.ilk > NUL 2> NUL -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 +cl %compiler_settings% "src\main.cpp" /link %linker_settings% -OUT:%exe_name% if %errorlevel% neq 0 goto end_of_build if %release_mode% EQU 0 odin run examples/demo/demo.odin diff --git a/src/build_settings.cpp b/src/build_settings.cpp index ee6b04d44..72b72a738 100644 --- a/src/build_settings.cpp +++ b/src/build_settings.cpp @@ -72,7 +72,7 @@ TargetEndianKind target_endians[TargetArch_COUNT] = { }; #ifndef ODIN_VERSION_RAW -#define ODIN_VERSION_RAW "dev-2021-unknown" +#define ODIN_VERSION_RAW "dev-unknown-unknown" #endif String const ODIN_VERSION = str_lit(ODIN_VERSION_RAW); diff --git a/src/main.cpp b/src/main.cpp index 72586974b..f1563477e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2183,44 +2183,11 @@ int main(int arg_count, char const **arg_ptr) { remove_temp_files(gen.output_base); -#if defined(GB_COMPILER_MSVC) - if (false) { - PROCESS_MEMORY_COUNTERS_EX pmc = {}; - GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc)); - SIZE_T virtual_mem_used_by_me = pmc.PrivateUsage; - gb_printf_err("virtual_memory_used: %tu B\n", virtual_mem_used_by_me); - - Parser *p = checker.parser; - isize lines = p->total_line_count; - isize tokens = p->total_token_count; - isize files = 0; - isize packages = p->packages.count; - isize total_file_size = 0; - for_array(i, p->packages) { - files += p->packages[i]->files.count; - for_array(j, p->packages[i]->files) { - AstFile *file = p->packages[i]->files[j]; - total_file_size += file->tokenizer.end - file->tokenizer.start; - } - } - gb_printf_err("total_file_size: %lld B\n", total_file_size); - gb_printf_err("lines: %lld\n", lines); - gb_printf_err("files: %lld\n", files); - gb_printf_err("tokens: %lld\n", tokens); - gb_printf_err("packages: %lld\n", packages); - } -#endif - if (run_output) { - #if defined(GB_SYSTEM_WINDOWS) - return system_exec_command_line_app("odin run", "%.*s.exe %.*s", LIT(gen.output_base), LIT(run_args_string)); - #else - //NOTE(thebirk): This whole thing is a little leaky String output_ext = {}; String complete_path = concatenate_strings(heap_allocator(), gen.output_base, output_ext); complete_path = path_to_full_path(heap_allocator(), complete_path); return system_exec_command_line_app("odin run", "\"%.*s\" %.*s", LIT(complete_path), LIT(run_args_string)); - #endif } return 0; -- cgit v1.2.3