mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Calling convention, change from bitcast to transmute
This commit is contained in:
+2
-2
@@ -4,8 +4,8 @@ Any :: struct #ordered {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String :: struct #ordered {
|
String :: struct #ordered {
|
||||||
data: ^byte,
|
data: ^byte,
|
||||||
len: int,
|
len: int,
|
||||||
};
|
};
|
||||||
|
|
||||||
Slice :: struct #ordered {
|
Slice :: struct #ordered {
|
||||||
|
|||||||
@@ -1018,6 +1018,7 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type) {
|
|||||||
Type *new_type = original_type;
|
Type *new_type = original_type;
|
||||||
// NOTE(bill): Changing the passing parameter value type is to match C's ABI
|
// NOTE(bill): Changing the passing parameter value type is to match C's ABI
|
||||||
// IMPORTANT TODO(bill): This only matches the ABI on MSVC at the moment
|
// IMPORTANT TODO(bill): This only matches the ABI on MSVC at the moment
|
||||||
|
// SEE: https://msdn.microsoft.com/en-us/library/zthk2dkh.aspx
|
||||||
Type *bt = core_type(original_type);
|
Type *bt = core_type(original_type);
|
||||||
switch (bt->kind) {
|
switch (bt->kind) {
|
||||||
// Okay to pass by value
|
// Okay to pass by value
|
||||||
|
|||||||
@@ -1436,6 +1436,8 @@ irValue *ir_emit_bitcast(irProcedure *proc, irValue *data, Type *type) {
|
|||||||
return ir_emit(proc, ir_instr_conv(proc, irConv_bitcast, data, ir_type(data), type));
|
return ir_emit(proc, ir_instr_conv(proc, irConv_bitcast, data, ir_type(data), type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
irValue *ir_emit_transmute(irProcedure *proc, irValue *value, Type *t);
|
||||||
|
|
||||||
irValue *ir_emit_call(irProcedure *p, irValue *value, irValue **args, isize arg_count) {
|
irValue *ir_emit_call(irProcedure *p, irValue *value, irValue **args, isize arg_count) {
|
||||||
Type *pt = base_type(ir_type(value));
|
Type *pt = base_type(ir_type(value));
|
||||||
GB_ASSERT(pt->kind == Type_Proc);
|
GB_ASSERT(pt->kind == Type_Proc);
|
||||||
@@ -1450,7 +1452,7 @@ irValue *ir_emit_call(irProcedure *p, irValue *value, irValue **args, isize arg_
|
|||||||
if (is_type_pointer(new_type)) {
|
if (is_type_pointer(new_type)) {
|
||||||
args[i] = ir_copy_value_to_ptr(p, args[i], 16);
|
args[i] = ir_copy_value_to_ptr(p, args[i], 16);
|
||||||
} else if (is_type_integer(new_type)) {
|
} else if (is_type_integer(new_type)) {
|
||||||
args[i] = ir_emit_bitcast(p, args[i], new_type);
|
args[i] = ir_emit_transmute(p, args[i], new_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user