diff options
| author | gingerBill <bill@gingerbill.org> | 2020-11-23 12:20:04 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-11-23 12:20:04 +0000 |
| commit | 9e42cb159543546ca549eeba6c943cf0f4c8410b (patch) | |
| tree | b9a50bd93397d677f3487f796cbd26f76c4ce33d /src/llvm_abi.cpp | |
| parent | 4379917c7d37e9af3aebe239d8efa33fd575324a (diff) | |
Add comparisons to structs where all fields are comparable `==` and `!=`
Diffstat (limited to 'src/llvm_abi.cpp')
| -rw-r--r-- | src/llvm_abi.cpp | 60 |
1 files changed, 10 insertions, 50 deletions
diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 7521ba2f7..77d4b42b0 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -267,56 +267,6 @@ i64 lb_alignof(LLVMTypeRef type) { return 1; } -Type *alloc_type_struct_from_field_types(Type **field_types, isize field_count, bool is_packed) { - Type *t = alloc_type_struct(); - t->Struct.fields = array_make<Entity *>(heap_allocator(), field_count); - - Scope *scope = nullptr; - for_array(i, t->Struct.fields) { - t->Struct.fields[i] = alloc_entity_field(scope, blank_token, field_types[i], false, cast(i32)i, EntityState_Resolved); - } - t->Struct.is_packed = is_packed; - - return t; -} - -Type *alloc_type_tuple_from_field_types(Type **field_types, isize field_count, bool is_packed, bool must_be_tuple) { - if (field_count == 0) { - return nullptr; - } - if (!must_be_tuple && field_count == 1) { - return field_types[0]; - } - - Type *t = alloc_type_tuple(); - t->Tuple.variables = array_make<Entity *>(heap_allocator(), field_count); - - Scope *scope = nullptr; - for_array(i, t->Tuple.variables) { - t->Tuple.variables[i] = alloc_entity_param(scope, blank_token, field_types[i], false, false); - } - t->Tuple.is_packed = is_packed; - - return t; -} - -Type *alloc_type_proc_from_types(Type **param_types, unsigned param_count, Type *results, bool is_c_vararg) { - - Type *params = alloc_type_tuple_from_field_types(param_types, param_count, false, true); - isize results_count = 0; - if (results != nullptr) { - if (results->kind != Type_Tuple) { - results = alloc_type_tuple_from_field_types(&results, 1, false, true); - } - results_count = results->Tuple.variables.count; - } - - Scope *scope = nullptr; - Type *t = alloc_type_proc(scope, params, param_count, results, results_count, false, /*not sure what to put here*/ProcCC_CDecl); - t->Proc.c_vararg = is_c_vararg; - return t; -} - #if 0 Type *lb_abi_to_odin_type(lbModule *m, LLVMTypeRef type, bool is_return, u32 level = 0) { Type **found = map_get(&m->llvm_types, hash_pointer(type)); @@ -959,6 +909,16 @@ namespace lbAbiAmd64SysV { }; +namespace lbAbiAarch64 { + LB_ABI_INFO(abi_info) { + lbFunctionType *ft = gb_alloc_item(heap_allocator(), lbFunctionType); + ft->ctx = c; + // ft->args = compute_arg_types(c, arg_types, arg_count); + // ft->ret = lbAbi386::compute_return_type(c, return_type, return_is_defined); + // ft->calling_convention = calling_convention; + return ft; + } +} LB_ABI_INFO(lb_get_abi_info) { |