mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Add procs for wasm32
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
//+build wasm32
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
@(link_name="__ashlti3")
|
||||||
|
__ashlti3 :: proc "c" (a: i64, b: i32) -> i64 {
|
||||||
|
return a
|
||||||
|
}
|
||||||
@@ -2011,6 +2011,9 @@ void generate_minimum_dependency_set(Checker *c, Entity *start) {
|
|||||||
str_lit("gnu_h2f_ieee"),
|
str_lit("gnu_h2f_ieee"),
|
||||||
str_lit("gnu_f2h_ieee"),
|
str_lit("gnu_f2h_ieee"),
|
||||||
str_lit("extendhfsf2"),
|
str_lit("extendhfsf2"),
|
||||||
|
|
||||||
|
// WASM Specific
|
||||||
|
str_lit("__ashlti3"),
|
||||||
};
|
};
|
||||||
for (isize i = 0; i < gb_count_of(required_runtime_entities); i++) {
|
for (isize i = 0; i < gb_count_of(required_runtime_entities); i++) {
|
||||||
force_add_dependency_entity(c, c->info.runtime_package->scope, required_runtime_entities[i]);
|
force_add_dependency_entity(c, c->info.runtime_package->scope, required_runtime_entities[i]);
|
||||||
|
|||||||
@@ -1053,6 +1053,11 @@ namespace lbAbiWasm32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lbArgType non_struct(LLVMContextRef c, LLVMTypeRef type, bool is_return) {
|
lbArgType non_struct(LLVMContextRef c, LLVMTypeRef type, bool is_return) {
|
||||||
|
if (!is_return && type == LLVMIntTypeInContext(c, 128)) {
|
||||||
|
LLVMTypeRef cast_type = LLVMVectorType(LLVMInt64TypeInContext(c), 2);
|
||||||
|
return lb_arg_type_direct(type, cast_type, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_return && lb_sizeof(type) > 8) {
|
if (!is_return && lb_sizeof(type) > 8) {
|
||||||
return lb_arg_type_indirect(type, nullptr);
|
return lb_arg_type_indirect(type, nullptr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,6 +388,12 @@ void lb_run_remove_unused_function_pass(LLVMModuleRef mod) {
|
|||||||
name == "memcpy") {
|
name == "memcpy") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (is_arch_wasm()) {
|
||||||
|
if (name == "__ashlti3") {
|
||||||
|
LLVMSetLinkage(curr_func, LLVMExternalLinkage);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LLVMLinkage linkage = LLVMGetLinkage(curr_func);
|
LLVMLinkage linkage = LLVMGetLinkage(curr_func);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user