aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_proc.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-06-07 02:20:06 +0100
committerGitHub <noreply@github.com>2023-06-07 02:20:06 +0100
commit907ef82d4b32b3ec1d4958a505c2b4445e219ee4 (patch)
tree5e2ca080af929ec750e0192ced8737e16c54e99c /src/llvm_backend_proc.cpp
parent6a2ff3a3711e3da6bc9f2be9d9a67361b3ff9bd5 (diff)
parent7a1ab62987e2c980261f9d4fa10f5677d84dc4c9 (diff)
Merge pull request #2470 from odin-lang/separate-int-word-sizes
Separate int size from word/pointer size
Diffstat (limited to 'src/llvm_backend_proc.cpp')
-rw-r--r--src/llvm_backend_proc.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp
index b8353a466..f7298a4a6 100644
--- a/src/llvm_backend_proc.cpp
+++ b/src/llvm_backend_proc.cpp
@@ -14,7 +14,7 @@ gb_internal void lb_mem_copy_overlapping(lbProcedure *p, lbValue dst, lbValue sr
char const *name = "llvm.memmove";
if (LLVMIsConstant(len.value)) {
i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value);
- if (const_len <= 4*build_context.word_size) {
+ if (const_len <= 4*build_context.int_size) {
name = "llvm.memmove.inline";
}
}
@@ -43,7 +43,7 @@ gb_internal void lb_mem_copy_non_overlapping(lbProcedure *p, lbValue dst, lbValu
char const *name = "llvm.memcpy";
if (LLVMIsConstant(len.value)) {
i64 const_len = cast(i64)LLVMConstIntGetSExtValue(len.value);
- if (const_len <= 4*build_context.word_size) {
+ if (const_len <= 4*build_context.int_size) {
name = "llvm.memcpy.inline";
}
}
@@ -2890,7 +2890,7 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
{
char const *name = "llvm.wasm.memory.grow";
LLVMTypeRef types[1] = {
- lb_type(p->module, t_uintptr),
+ lb_type(p->module, t_i32),
};
LLVMValueRef args[2] = {};
@@ -2898,24 +2898,24 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
args[1] = lb_emit_conv(p, lb_build_expr(p, ce->args[1]), t_uintptr).value;
lbValue res = {};
- res.type = tv.type;
+ res.type = t_i32;
res.value = lb_call_intrinsic(p, name, args, gb_count_of(args), types, gb_count_of(types));
- return res;
+ return lb_emit_conv(p, res, tv.type);
}
case BuiltinProc_wasm_memory_size:
{
char const *name = "llvm.wasm.memory.size";
LLVMTypeRef types[1] = {
- lb_type(p->module, t_uintptr),
+ lb_type(p->module, t_i32),
};
LLVMValueRef args[1] = {};
args[0] = lb_emit_conv(p, lb_build_expr(p, ce->args[0]), t_uintptr).value;
lbValue res = {};
- res.type = tv.type;
+ res.type = t_i32;
res.value = lb_call_intrinsic(p, name, args, gb_count_of(args), types, gb_count_of(types));
- return res;
+ return lb_emit_conv(p, res, tv.type);
}
case BuiltinProc_wasm_memory_atomic_wait32: