From 0d044eabacde5910ef10dd18dca6d471fea0a9f2 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 3 May 2021 15:00:50 +0100 Subject: Remove non-InContext type creations --- src/llvm_abi.cpp | 104 ------------------------------------------------------- 1 file changed, 104 deletions(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 65e3b2c58..739d43d60 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -271,110 +271,6 @@ i64 lb_alignof(LLVMTypeRef type) { return 1; } -#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)); - if (found) { - return *found; - } - GB_ASSERT_MSG(level < 64, "%s %d", LLVMPrintTypeToString(type), is_return); - - LLVMTypeKind kind = LLVMGetTypeKind(type); - switch (kind) { - case LLVMVoidTypeKind: - return nullptr; - case LLVMIntegerTypeKind: - { - unsigned w = LLVMGetIntTypeWidth(type); - if (w == 1) { - return t_llvm_bool; - } - unsigned bytes = (w + 7)/8; - switch (bytes) { - case 1: return t_u8; - case 2: return t_u16; - case 4: return t_u32; - case 8: return t_u64; - case 16: return t_u128; - } - GB_PANIC("Unhandled integer type"); - } - case LLVMFloatTypeKind: - return t_f32; - case LLVMDoubleTypeKind: - return t_f64; - case LLVMPointerTypeKind: - { - LLVMTypeRef elem = LLVMGetElementType(type); - if (lb_is_type_kind(elem, LLVMFunctionTypeKind)) { - unsigned param_count = LLVMCountParamTypes(elem); - LLVMTypeRef *params = gb_alloc_array(heap_allocator(), LLVMTypeRef, param_count); - defer (gb_free(heap_allocator(), params)); - LLVMGetParamTypes(elem, params); - - Type **param_types = gb_alloc_array(heap_allocator(), Type *, param_count); - defer (gb_free(heap_allocator(), param_types)); - - for (unsigned i = 0; i < param_count; i++) { - param_types[i] = lb_abi_to_odin_type(m, params[i], false, level+1); - } - - LLVMTypeRef ret = LLVMGetReturnType(elem); - Type *ret_type = lb_abi_to_odin_type(m, ret, true, level+1); - - bool is_c_vararg = !!LLVMIsFunctionVarArg(elem); - return alloc_type_proc_from_types(param_types, param_count, ret_type, is_c_vararg); - } - return alloc_type_pointer(lb_abi_to_odin_type(m, elem, false, level+1)); - } - case LLVMFunctionTypeKind: - GB_PANIC("LLVMFunctionTypeKind should not be seen on its own"); - break; - - case LLVMStructTypeKind: - { - unsigned field_count = LLVMCountStructElementTypes(type); - Type **fields = gb_alloc_array(heap_allocator(), Type *, field_count); - for (unsigned i = 0; i < field_count; i++) { - LLVMTypeRef field_type = LLVMStructGetTypeAtIndex(type, i); - if (lb_is_type_kind(field_type, LLVMPointerTypeKind) && level > 0) { - fields[i] = t_rawptr; - } else { - fields[i] = lb_abi_to_odin_type(m, field_type, false, level+1); - } - } - if (is_return) { - return alloc_type_tuple_from_field_types(fields, field_count, !!LLVMIsPackedStruct(type), false); - } else { - return alloc_type_struct_from_field_types(fields, field_count, !!LLVMIsPackedStruct(type)); - } - } - break; - case LLVMArrayTypeKind: - { - - i64 count = LLVMGetArrayLength(type); - Type *elem = lb_abi_to_odin_type(m, LLVMGetElementType(type), false, level+1); - return alloc_type_array(elem, count); - } - break; - - case LLVMX86_MMXTypeKind: - return t_vector_x86_mmx; - case LLVMVectorTypeKind: - { - i64 count = LLVMGetVectorSize(type); - Type *elem = lb_abi_to_odin_type(m, LLVMGetElementType(type), false, level+1); - return alloc_type_simd_vector(count, elem); - } - - } - GB_PANIC("Unhandled type for lb_abi_to_odin_type -> %s", LLVMPrintTypeToString(type)); - - return 0; -} -#endif - #define LB_ABI_INFO(name) lbFunctionType *name(LLVMContextRef c, LLVMTypeRef *arg_types, unsigned arg_count, LLVMTypeRef return_type, bool return_is_defined, ProcCallingConvention calling_convention) typedef LB_ABI_INFO(lbAbiInfoType); -- cgit v1.2.3 From ff6fdc7812bce3edfbf102dddc97c5821da6e840 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 10 May 2021 21:16:26 +0100 Subject: Correct SysV ABI for `-> (f32, bool)` --- src/llvm_abi.cpp | 5 +++++ src/llvm_backend.cpp | 27 +++++++++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 739d43d60..6635423e7 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -549,6 +549,11 @@ namespace lbAbiAmd64SysV { } else if (oldv == RegClass_Memory || newv == RegClass_Memory) { return; } else if (oldv == RegClass_Int || newv == RegClass_Int) { + if (oldv == RegClass_SSEFv || oldv == RegClass_SSEFs) { + oldv = RegClass_Int; + } else if (newv == RegClass_SSEFv || newv == RegClass_SSEFs) { + oldv = RegClass_Int; + } return; } else if (oldv == RegClass_X87 || oldv == RegClass_X87Up || oldv == RegClass_ComplexX87 || newv == RegClass_X87 || newv == RegClass_X87Up || newv == RegClass_ComplexX87) { diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 9a6595b24..78ffb36e5 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -5794,9 +5794,15 @@ lbValue lb_find_value_from_entity(lbModule *m, Entity *e) { if (USE_SEPARTE_MODULES) { lbModule *other_module = lb_pkg_module(m->gen, e->pkg); + + // TODO(bill): correct this logic bool is_external = other_module != m; if (!is_external) { - other_module = e->code_gen_module; + if (e->code_gen_module != nullptr) { + other_module = e->code_gen_module; + } else { + other_module = nullptr; + } is_external = other_module != m; } @@ -5806,8 +5812,20 @@ lbValue lb_find_value_from_entity(lbModule *m, Entity *e) { lbValue g = {}; g.value = LLVMAddGlobal(m->mod, lb_type(m, e->type), alloc_cstring(permanent_allocator(), name)); g.type = alloc_type_pointer(e->type); + lb_add_entity(m, e, g); + lb_add_member(m, name, g); + LLVMSetLinkage(g.value, LLVMExternalLinkage); + // if (other_module != nullptr) { + // lbValue *other_found = string_map_get(&other_module->members, name); + // if (other_found) { + // lbValue other_g = *other_found; + // } + // } + + // LLVMSetLinkage(other_g.value, LLVMExternalLinkage); + if (e->Variable.thread_local_model != "") { LLVMSetThreadLocal(g.value, true); @@ -5827,8 +5845,7 @@ lbValue lb_find_value_from_entity(lbModule *m, Entity *e) { LLVMSetThreadLocalMode(g.value, mode); } - lb_add_entity(m, e, g); - lb_add_member(m, name, g); + return g; } } @@ -14713,9 +14730,7 @@ void lb_generate_code(lbGenerator *gen) { if (is_export) { LLVMSetLinkage(g.value, LLVMDLLExportLinkage); LLVMSetDLLStorageClass(g.value, LLVMDLLExportStorageClass); - } - - if (e->flags & EntityFlag_Static) { + } else { // LLVMSetLinkage(g.value, LLVMInternalLinkage); } -- cgit v1.2.3 From f31b09212ac33159f12ee42e01c04b5037c282f8 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 11 May 2021 12:00:27 +0100 Subject: Improve SysV ABI --- src/llvm_abi.cpp | 62 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 21 deletions(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index 6635423e7..c2298bcd0 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -419,8 +419,14 @@ namespace lbAbiAmd64SysV { switch (reg_class) { case RegClass_SSEFs: case RegClass_SSEFv: + case RegClass_SSEDs: case RegClass_SSEDv: return true; + case RegClass_SSEInt8: + case RegClass_SSEInt16: + case RegClass_SSEInt32: + case RegClass_SSEInt64: + return true; } return false; } @@ -538,35 +544,48 @@ namespace lbAbiAmd64SysV { return reg_classes; } - void unify(Array *cls, i64 i, RegClass newv) { - RegClass &oldv = (*cls)[i]; + void unify(Array *cls, i64 i, RegClass const newv) { + RegClass const oldv = (*cls)[i]; if (oldv == newv) { return; - } else if (oldv == RegClass_NoClass) { - oldv = newv; + } + + RegClass to_write = newv; + if (oldv == RegClass_NoClass) { + to_write = newv; } else if (newv == RegClass_NoClass) { return; } else if (oldv == RegClass_Memory || newv == RegClass_Memory) { - return; - } else if (oldv == RegClass_Int || newv == RegClass_Int) { - if (oldv == RegClass_SSEFv || oldv == RegClass_SSEFs) { - oldv = RegClass_Int; - } else if (newv == RegClass_SSEFv || newv == RegClass_SSEFs) { - oldv = RegClass_Int; + to_write = RegClass_Memory; + } else if (oldv == RegClass_Int || newv == RegClass_Int) { + to_write = RegClass_Int; + } else if (oldv == RegClass_X87 || oldv == RegClass_X87Up || oldv == RegClass_ComplexX87) { + to_write = RegClass_Memory; + } else if (newv == RegClass_X87 || newv == RegClass_X87Up || newv == RegClass_ComplexX87) { + to_write = RegClass_Memory; + } else if (newv == RegClass_SSEUp) { + switch (oldv) { + case RegClass_SSEFv: + case RegClass_SSEFs: + case RegClass_SSEDv: + case RegClass_SSEDs: + case RegClass_SSEInt8: + case RegClass_SSEInt16: + case RegClass_SSEInt32: + case RegClass_SSEInt64: + return; } - return; - } else if (oldv == RegClass_X87 || oldv == RegClass_X87Up || oldv == RegClass_ComplexX87 || - newv == RegClass_X87 || newv == RegClass_X87Up || newv == RegClass_ComplexX87) { - oldv = RegClass_Memory; - } else { - oldv = newv; } + + (*cls)[i] = to_write; } void fixup(LLVMTypeRef t, Array *cls) { i64 i = 0; i64 e = cls->count; - if (e > 2 && (lb_is_type_kind(t, LLVMStructTypeKind) || lb_is_type_kind(t, LLVMArrayTypeKind))) { + if (e > 2 && (lb_is_type_kind(t, LLVMStructTypeKind) || + lb_is_type_kind(t, LLVMArrayTypeKind) || + lb_is_type_kind(t, LLVMVectorTypeKind))) { RegClass &oldv = (*cls)[i]; if (is_sse(oldv)) { for (i++; i < e; i++) { @@ -610,8 +629,8 @@ namespace lbAbiAmd64SysV { unsigned llvec_len(Array const ®_classes, isize offset) { unsigned len = 1; - for (isize i = offset+1; i < reg_classes.count; i++) { - if (reg_classes[offset] != RegClass_SSEFv && reg_classes[i] != RegClass_SSEUp) { + for (isize i = offset; i < reg_classes.count; i++) { + if (reg_classes[i] != RegClass_SSEUp) { break; } len++; @@ -622,7 +641,7 @@ namespace lbAbiAmd64SysV { LLVMTypeRef llreg(LLVMContextRef c, Array const ®_classes) { auto types = array_make(heap_allocator(), 0, reg_classes.count); - for_array(i, reg_classes) { + for (isize i = 0; i < reg_classes.count; /**/) { RegClass reg_class = reg_classes[i]; switch (reg_class) { case RegClass_Int: @@ -664,7 +683,7 @@ namespace lbAbiAmd64SysV { break; } - unsigned vec_len = llvec_len(reg_classes, i); + unsigned vec_len = llvec_len(reg_classes, i+1); LLVMTypeRef vec_type = LLVMVectorType(elem_type, vec_len * elems_per_word); array_add(&types, vec_type); i += vec_len; @@ -680,6 +699,7 @@ namespace lbAbiAmd64SysV { default: GB_PANIC("Unhandled RegClass"); } + i += 1; } GB_ASSERT(types.count != 0); -- cgit v1.2.3 From d353f97f91c18fd910c4c16604dcaf3e3afbc5f2 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 11 May 2021 13:30:27 +0100 Subject: Add `byval` with `align`, `sret` attributes for SysV --- src/llvm_abi.cpp | 39 +++++++++++++++++++++++++++------------ src/llvm_backend.cpp | 27 ++++++++++++++++++++++++--- src/llvm_backend.hpp | 1 + 3 files changed, 52 insertions(+), 15 deletions(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index c2298bcd0..d8f16b451 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -10,21 +10,35 @@ struct lbArgType { LLVMTypeRef cast_type; // Optional LLVMTypeRef pad_type; // Optional LLVMAttributeRef attribute; // Optional + LLVMAttributeRef align_attribute; // Optional }; + +i64 lb_sizeof(LLVMTypeRef type); +i64 lb_alignof(LLVMTypeRef type); + lbArgType lb_arg_type_direct(LLVMTypeRef type, LLVMTypeRef cast_type, LLVMTypeRef pad_type, LLVMAttributeRef attr) { - return lbArgType{lbArg_Direct, type, cast_type, pad_type, attr}; + return lbArgType{lbArg_Direct, type, cast_type, pad_type, attr, nullptr}; } lbArgType lb_arg_type_direct(LLVMTypeRef type) { return lb_arg_type_direct(type, nullptr, nullptr, nullptr); } lbArgType lb_arg_type_indirect(LLVMTypeRef type, LLVMAttributeRef attr) { - return lbArgType{lbArg_Indirect, type, nullptr, nullptr, attr}; + return lbArgType{lbArg_Indirect, type, nullptr, nullptr, attr, nullptr}; +} + +lbArgType lb_arg_type_indirect_byval(LLVMContextRef c, LLVMTypeRef type) { + i64 alignment = lb_alignof(type); + alignment = gb_max(alignment, 8); + + LLVMAttributeRef byval_attr = lb_create_enum_attribute_with_type(c, "byval", type); + LLVMAttributeRef align_attr = lb_create_enum_attribute(c, "align", alignment); + return lbArgType{lbArg_Indirect, type, nullptr, nullptr, byval_attr, align_attr}; } lbArgType lb_arg_type_ignore(LLVMTypeRef type) { - return lbArgType{lbArg_Ignore, type, nullptr, nullptr, nullptr}; + return lbArgType{lbArg_Ignore, type, nullptr, nullptr, nullptr, nullptr}; } struct lbFunctionType { @@ -121,6 +135,9 @@ void lb_add_function_type_attributes(LLVMValueRef fn, lbFunctionType *ft, ProcCa if (arg->attribute) { LLVMAddAttributeAtIndex(fn, arg_index+1, arg->attribute); } + if (arg->align_attribute) { + LLVMAddAttributeAtIndex(fn, arg_index+1, arg->align_attribute); + } arg_index++; } @@ -145,8 +162,6 @@ void lb_add_function_type_attributes(LLVMValueRef fn, lbFunctionType *ft, ProcCa } -i64 lb_sizeof(LLVMTypeRef type); -i64 lb_alignof(LLVMTypeRef type); i64 lb_sizeof(LLVMTypeRef type) { LLVMTypeKind kind = LLVMGetTypeKind(type); @@ -328,7 +343,7 @@ namespace lbAbi386 { if (sz == 0) { args[i] = lb_arg_type_ignore(t); } else { - args[i] = lb_arg_type_indirect(t, lb_create_enum_attribute(c, "byval")); + args[i] = lb_arg_type_indirect_byval(c, t); } } else { args[i] = non_struct(c, t, false); @@ -348,7 +363,7 @@ namespace lbAbi386 { case 4: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 32), nullptr, nullptr); case 8: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 64), nullptr, nullptr); } - LLVMAttributeRef attr = lb_create_enum_attribute(c, "sret"); + LLVMAttributeRef attr = lb_create_enum_attribute_with_type(c, "sret", return_type); return lb_arg_type_indirect(return_type, attr); } return non_struct(c, return_type, true); @@ -512,9 +527,9 @@ namespace lbAbiAmd64SysV { if (is_mem_cls(cls, attribute_kind)) { LLVMAttributeRef attribute = nullptr; if (attribute_kind == Amd64TypeAttribute_ByVal) { - attribute = lb_create_enum_attribute(c, "byval"); + return lb_arg_type_indirect_byval(c, type); } else if (attribute_kind == Amd64TypeAttribute_StructRect) { - attribute = lb_create_enum_attribute(c, "sret"); + attribute = lb_create_enum_attribute_with_type(c, "sret", type); } return lb_arg_type_indirect(type, attribute); } else { @@ -814,7 +829,7 @@ namespace lbAbiAmd64SysV { if (sz == 0) { args[i] = lb_arg_type_ignore(t); } else { - args[i] = lb_arg_type_indirect(t, lb_create_enum_attribute(c, "byval")); + args[i] = lb_arg_type_indirect(t, lb_create_enum_attribute_with_type(c, "byval", t)); } } else { args[i] = non_struct(c, t); @@ -834,7 +849,7 @@ namespace lbAbiAmd64SysV { case 4: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 32), nullptr, nullptr); case 8: return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 64), nullptr, nullptr); } - LLVMAttributeRef attr = lb_create_enum_attribute(c, "sret"); + LLVMAttributeRef attr = lb_create_enum_attribute_with_type(c, "sret", return_type); return lb_arg_type_indirect(return_type, attr); } else if (build_context.metrics.os == TargetOs_windows && lb_is_type_kind(return_type, LLVMIntegerTypeKind) && lb_sizeof(return_type) == 16) { return lb_arg_type_direct(return_type, LLVMIntTypeInContext(c, 128), nullptr, nullptr); @@ -984,7 +999,7 @@ namespace lbAbiArm64 { } return lb_arg_type_direct(type, cast_type, nullptr, nullptr); } else { - LLVMAttributeRef attr = lb_create_enum_attribute(c, "sret"); + LLVMAttributeRef attr = lb_create_enum_attribute_with_type(c, "sret", type); return lb_arg_type_indirect(type, attr); } } diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index d92df5ae2..28c37be7d 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -2545,20 +2545,41 @@ lbValue lb_emit_string(lbProcedure *p, lbValue str_elem, lbValue str_len) { } } -LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char const *name, u64 value) { +LLVMAttributeRef lb_create_enum_attribute_with_type(LLVMContextRef ctx, char const *name, LLVMTypeRef type) { String s = make_string_c(name); // NOTE(2021-02-25, bill); All this attributes require a type associated with them // and the current LLVM C API does not expose this functionality yet. // It is better to ignore the attributes for the time being if (s == "byval") { - return nullptr; + // return nullptr; } else if (s == "byref") { return nullptr; } else if (s == "preallocated") { return nullptr; } else if (s == "sret") { - return nullptr; + // return nullptr; + } + + unsigned kind = LLVMGetEnumAttributeKindForName(name, s.len); + GB_ASSERT_MSG(kind != 0, "unknown attribute: %s", name); + return LLVMCreateEnumAttribute(ctx, kind, 0); +} + +LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char const *name, u64 value) { + String s = make_string_c(name); + + // NOTE(2021-02-25, bill); All this attributes require a type associated with them + // and the current LLVM C API does not expose this functionality yet. + // It is better to ignore the attributes for the time being + if (s == "byval") { + GB_PANIC("lb_create_enum_attribute_with_type should be used for %s", name); + } else if (s == "byref") { + GB_PANIC("lb_create_enum_attribute_with_type should be used for %s", name); + } else if (s == "preallocated") { + GB_PANIC("lb_create_enum_attribute_with_type should be used for %s", name); + } else if (s == "sret") { + GB_PANIC("lb_create_enum_attribute_with_type should be used for %s", name); } unsigned kind = LLVMGetEnumAttributeKindForName(name, s.len); diff --git a/src/llvm_backend.hpp b/src/llvm_backend.hpp index f212d9fc0..b35c042ee 100644 --- a/src/llvm_backend.hpp +++ b/src/llvm_backend.hpp @@ -276,6 +276,7 @@ String lb_mangle_name(lbModule *m, Entity *e); String lb_get_entity_name(lbModule *m, Entity *e, String name = {}); LLVMAttributeRef lb_create_enum_attribute(LLVMContextRef ctx, char const *name, u64 value=0); +LLVMAttributeRef lb_create_enum_attribute_with_type(LLVMContextRef ctx, char const *name, LLVMTypeRef type); void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name, u64 value); void lb_add_proc_attribute_at_index(lbProcedure *p, isize index, char const *name); lbProcedure *lb_create_procedure(lbModule *module, Entity *entity, bool ignore_body=false); -- cgit v1.2.3 From e08f39ec28eaf462ddee6c418721ce4c7a03450e Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 11 May 2021 16:20:50 +0100 Subject: Remove unneeded assert --- src/llvm_abi.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index d8f16b451..dcbd07118 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -717,7 +717,6 @@ namespace lbAbiAmd64SysV { i += 1; } - GB_ASSERT(types.count != 0); if (types.count == 1) { return types[0]; } -- cgit v1.2.3 From 8d044fd442f2f8fef678c2aef4b4de733b817f1c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 17 May 2021 17:08:25 +0100 Subject: Minor ABI change and cleanup --- src/llvm_abi.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/llvm_abi.cpp') diff --git a/src/llvm_abi.cpp b/src/llvm_abi.cpp index dcbd07118..aba85ae83 100644 --- a/src/llvm_abi.cpp +++ b/src/llvm_abi.cpp @@ -343,7 +343,7 @@ namespace lbAbi386 { if (sz == 0) { args[i] = lb_arg_type_ignore(t); } else { - args[i] = lb_arg_type_indirect_byval(c, t); + args[i] = lb_arg_type_indirect(t, nullptr); } } else { args[i] = non_struct(c, t, false); @@ -828,7 +828,7 @@ namespace lbAbiAmd64SysV { if (sz == 0) { args[i] = lb_arg_type_ignore(t); } else { - args[i] = lb_arg_type_indirect(t, lb_create_enum_attribute_with_type(c, "byval", t)); + args[i] = lb_arg_type_indirect_byval(c, t); } } else { args[i] = non_struct(c, t); -- cgit v1.2.3