mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Correct ABI for windows with LLVM
This commit is contained in:
+3
-3
@@ -239,7 +239,7 @@ i64 lb_alignof(LLVMTypeRef type) {
|
|||||||
case LLVMIntegerTypeKind:
|
case LLVMIntegerTypeKind:
|
||||||
{
|
{
|
||||||
unsigned w = LLVMGetIntTypeWidth(type);
|
unsigned w = LLVMGetIntTypeWidth(type);
|
||||||
return gb_clamp((w + 7)/8, 1, build_context.max_align);
|
return gb_clamp((w + 7)/8, 1, build_context.word_size);
|
||||||
}
|
}
|
||||||
case LLVMHalfTypeKind:
|
case LLVMHalfTypeKind:
|
||||||
return 2;
|
return 2;
|
||||||
@@ -342,7 +342,7 @@ namespace lbAbi386 {
|
|||||||
LLVMTypeRef t = arg_types[i];
|
LLVMTypeRef t = arg_types[i];
|
||||||
LLVMTypeKind kind = LLVMGetTypeKind(t);
|
LLVMTypeKind kind = LLVMGetTypeKind(t);
|
||||||
i64 sz = lb_sizeof(t);
|
i64 sz = lb_sizeof(t);
|
||||||
if (kind == LLVMStructTypeKind) {
|
if (kind == LLVMStructTypeKind || kind == LLVMArrayTypeKind) {
|
||||||
if (sz == 0) {
|
if (sz == 0) {
|
||||||
args[i] = lb_arg_type_ignore(t);
|
args[i] = lb_arg_type_ignore(t);
|
||||||
} else {
|
} else {
|
||||||
@@ -392,7 +392,7 @@ namespace lbAbiAmd64Win64 {
|
|||||||
for (unsigned i = 0; i < arg_count; i++) {
|
for (unsigned i = 0; i < arg_count; i++) {
|
||||||
LLVMTypeRef t = arg_types[i];
|
LLVMTypeRef t = arg_types[i];
|
||||||
LLVMTypeKind kind = LLVMGetTypeKind(t);
|
LLVMTypeKind kind = LLVMGetTypeKind(t);
|
||||||
if (kind == LLVMStructTypeKind) {
|
if (kind == LLVMStructTypeKind || kind == LLVMArrayTypeKind) {
|
||||||
i64 sz = lb_sizeof(t);
|
i64 sz = lb_sizeof(t);
|
||||||
switch (sz) {
|
switch (sz) {
|
||||||
case 1:
|
case 1:
|
||||||
|
|||||||
@@ -1736,10 +1736,12 @@ LLVMTypeRef lb_type_internal(lbModule *m, Type *type) {
|
|||||||
LLVMTypeRef struct_type = LLVMStructTypeInContext(ctx, fields.data, cast(unsigned)fields.count, type->Struct.is_packed);
|
LLVMTypeRef struct_type = LLVMStructTypeInContext(ctx, fields.data, cast(unsigned)fields.count, type->Struct.is_packed);
|
||||||
map_set(&m->struct_field_remapping, hash_pointer(struct_type), field_remapping);
|
map_set(&m->struct_field_remapping, hash_pointer(struct_type), field_remapping);
|
||||||
map_set(&m->struct_field_remapping, hash_pointer(type), field_remapping);
|
map_set(&m->struct_field_remapping, hash_pointer(type), field_remapping);
|
||||||
|
#if 0
|
||||||
GB_ASSERT_MSG(lb_sizeof(struct_type) == full_type_size,
|
GB_ASSERT_MSG(lb_sizeof(struct_type) == full_type_size,
|
||||||
"(%lld) %s vs (%lld) %s",
|
"(%lld) %s vs (%lld) %s",
|
||||||
cast(long long)lb_sizeof(struct_type), LLVMPrintTypeToString(struct_type),
|
cast(long long)lb_sizeof(struct_type), LLVMPrintTypeToString(struct_type),
|
||||||
cast(long long)full_type_size, type_to_string(type));
|
cast(long long)full_type_size, type_to_string(type));
|
||||||
|
#endif
|
||||||
return struct_type;
|
return struct_type;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user