diff options
| author | Brendan Punsky <bpunsky@gmail.com> | 2019-03-13 16:45:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-13 16:45:46 -0400 |
| commit | eadb66c9efc19ad1deaee6ca5a141cbd7206fcce (patch) | |
| tree | 01eb1a33ffba203c45460e0e50da4b5f4ca31076 /src/check_type.cpp | |
| parent | 9d7e1c17cc4a9b0d6cfd4c741c800b5732eb9948 (diff) | |
| parent | bdab5e00da6dee80b7582135815f2183def935bb (diff) | |
Merge branch 'master' into master
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 953eebdda..451a388fb 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -1783,13 +1783,21 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type) { Type *new_type = original_type; if (is_type_boolean(original_type)) { - return t_llvm_bool; + Type *t = core_type(base_type(new_type)); + if (t == t_bool) { + return t_llvm_bool; + } + return new_type; } if (build_context.ODIN_ARCH == "386") { return new_type; } + if (is_type_simd_vector(original_type)) { + return new_type; + } + if (build_context.ODIN_OS == "windows") { // 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 @@ -1893,7 +1901,11 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type) { } GB_ASSERT(is_type_tuple(original_type)); + Type *single_type = reduce_tuple_to_single_type(original_type); + if (is_type_simd_vector(single_type)) { + return new_type; + } if (build_context.ODIN_OS == "windows") { Type *bt = core_type(reduce_tuple_to_single_type(original_type)); @@ -1941,15 +1953,16 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type) { return new_type; } -bool abi_compat_return_by_value(gbAllocator a, ProcCallingConvention cc, Type *abi_return_type) { +bool abi_compat_return_by_pointer(gbAllocator a, ProcCallingConvention cc, Type *abi_return_type) { if (abi_return_type == nullptr) { return false; } - // switch (cc) { - // case ProcCC_Odin: - // case ProcCC_Contextless: - // return false; - // } + + Type *single_type = reduce_tuple_to_single_type(abi_return_type); + + if (is_type_simd_vector(single_type)) { + return false; + } if (build_context.ODIN_OS == "windows") { @@ -2036,6 +2049,7 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, type->Proc.is_polymorphic = pt->generic; type->Proc.specialization_count = specialization_count; type->Proc.diverging = pt->diverging; + type->Proc.tags = pt->tags; if (param_count > 0) { Entity *end = params->Tuple.variables[param_count-1]; @@ -2075,7 +2089,7 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, // NOTE(bill): The types are the same type->Proc.abi_compat_result_type = type_to_abi_compat_result_type(c->allocator, type->Proc.results); - type->Proc.return_by_pointer = abi_compat_return_by_value(c->allocator, pt->calling_convention, type->Proc.abi_compat_result_type); + type->Proc.return_by_pointer = abi_compat_return_by_pointer(c->allocator, pt->calling_convention, type->Proc.abi_compat_result_type); return success; } |