mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 01:14:40 +00:00
Remove use_llvm_api related checks and other related things
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package sys_cpu
|
||||
|
||||
#assert(ODIN_USE_LLVM_API);
|
||||
|
||||
Cache_Line_Pad :: struct {_: [_cache_line_size]byte};
|
||||
|
||||
initialized: bool;
|
||||
|
||||
@@ -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 ");
|
||||
|
||||
@@ -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<Type *>(temporary_allocator(), 0, ce->args.count);
|
||||
auto names = array_make<String>(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 = {};
|
||||
|
||||
@@ -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<Type *>(heap_allocator(), ia->param_types.count);
|
||||
Type *return_type = nullptr;
|
||||
for_array(i, ia->param_types) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1185,7 +1185,6 @@ bool parse_build_flags(Array<String> 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user