---
source: crates/mun_codegen/src/test.rs
expression: "\n struct(gc) GcStruct(f32, f32);\n struct(value) ValueStruct(f32, f32);\n\n struct(gc) GcWrapper(GcStruct, ValueStruct)\n struct(value) ValueWrapper(GcStruct, ValueStruct);\n\n pub fn new_gc_struct(a: f32, b: f32) -> GcStruct {\n GcStruct(a, b)\n }\n\n pub fn new_value_struct(a: f32, b: f32) -> ValueStruct {\n ValueStruct(a, b)\n }\n\n pub fn new_gc_wrapper(a: GcStruct, b: ValueStruct) -> GcWrapper {\n GcWrapper(a, b)\n }\n\n pub fn new_value_wrapper(a: GcStruct, b: ValueStruct) -> ValueWrapper {\n ValueWrapper(a, b)\n }\n "
---
; == FILE IR (mod) =====================================
; ModuleID = 'mod'
source_filename = "mod"
%DispatchTable = type { i8** (i8*, i8*)* }
%"mun_codegen::ir::types::TypeInfo" = type <{ [0 x i64], [16 x i8], [0 x i64], i8*, [0 x i64], i32, [0 x i64], i8, [3 x i8], %"mun_codegen::ir::types::TypeInfoData", [0 x i64] }>
%"mun_codegen::ir::types::TypeInfoData" = type <{ [0 x i8], i8, [39 x i8] }>
%GcStruct = type { float, float }
%ValueStruct = type { float, float }
%GcWrapper = type { %GcStruct**, %ValueStruct }
%ValueWrapper = type { %GcStruct**, %ValueStruct }
@allocatorHandle = external global i8*
@dispatchTable = external global %DispatchTable
@global_type_table = external global [8 x %"mun_codegen::ir::types::TypeInfo"*]
define %GcStruct** @new_gc_struct(float %0, float %1) {
body:
%init = insertvalue %GcStruct undef, float %0, 0
%init3 = insertvalue %GcStruct %init, float %1, 1
%new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0), align 8
%GcStruct_ptr = load %"mun_codegen::ir::types::TypeInfo"*, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([8 x %"mun_codegen::ir::types::TypeInfo"*], [8 x %"mun_codegen::ir::types::TypeInfo"*]* @global_type_table, i64 0, i64 5), align 8
%type_info_ptr_to_i8_ptr = bitcast %"mun_codegen::ir::types::TypeInfo"* %GcStruct_ptr to i8*
%allocator_handle = load i8*, i8** @allocatorHandle, align 8
%new = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle)
%GcStruct_ptr_ptr = bitcast i8** %new to %GcStruct**
%GcStruct_mem_ptr = load %GcStruct*, %GcStruct** %GcStruct_ptr_ptr, align 8
store %GcStruct %init3, %GcStruct* %GcStruct_mem_ptr, align 4
ret %GcStruct** %GcStruct_ptr_ptr
}
define %ValueStruct @new_value_struct(float %0, float %1) {
body:
%init = insertvalue %ValueStruct undef, float %0, 0
%init3 = insertvalue %ValueStruct %init, float %1, 1
ret %ValueStruct %init3
}
define %ValueStruct** @new_value_struct_wrapper(float %0, float %1) {
body:
%new_value_struct = call %ValueStruct @new_value_struct(float %0, float %1)
%new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0), align 8
%ValueStruct_ptr = load %"mun_codegen::ir::types::TypeInfo"*, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([8 x %"mun_codegen::ir::types::TypeInfo"*], [8 x %"mun_codegen::ir::types::TypeInfo"*]* @global_type_table, i64 0, i64 4), align 8
%type_info_ptr_to_i8_ptr = bitcast %"mun_codegen::ir::types::TypeInfo"* %ValueStruct_ptr to i8*
%allocator_handle = load i8*, i8** @allocatorHandle, align 8
%new = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle)
%ValueStruct_ptr_ptr = bitcast i8** %new to %ValueStruct**
%ValueStruct_mem_ptr = load %ValueStruct*, %ValueStruct** %ValueStruct_ptr_ptr, align 8
store %ValueStruct %new_value_struct, %ValueStruct* %ValueStruct_mem_ptr, align 4
ret %ValueStruct** %ValueStruct_ptr_ptr
}
define %GcWrapper** @new_gc_wrapper(%GcStruct** %0, %ValueStruct %1) {
body:
%.fca.0.extract = extractvalue %ValueStruct %1, 0
%.fca.1.extract = extractvalue %ValueStruct %1, 1
%init = insertvalue %GcWrapper undef, %GcStruct** %0, 0
%init3 = insertvalue %GcWrapper %init, %ValueStruct %1, 1
%new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0), align 8
%GcWrapper_ptr = load %"mun_codegen::ir::types::TypeInfo"*, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([8 x %"mun_codegen::ir::types::TypeInfo"*], [8 x %"mun_codegen::ir::types::TypeInfo"*]* @global_type_table, i64 0, i64 0), align 8
%type_info_ptr_to_i8_ptr = bitcast %"mun_codegen::ir::types::TypeInfo"* %GcWrapper_ptr to i8*
%allocator_handle = load i8*, i8** @allocatorHandle, align 8
%new = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle)
%GcWrapper_ptr_ptr = bitcast i8** %new to %GcWrapper**
%GcWrapper_mem_ptr = load %GcWrapper*, %GcWrapper** %GcWrapper_ptr_ptr, align 8
store %GcWrapper %init3, %GcWrapper* %GcWrapper_mem_ptr, align 8
ret %GcWrapper** %GcWrapper_ptr_ptr
}
define %GcWrapper** @new_gc_wrapper_wrapper(%GcStruct** %0, %ValueStruct** %1) {
body:
%mem_ptr = load %ValueStruct*, %ValueStruct** %1, align 8
%deref = load %ValueStruct, %ValueStruct* %mem_ptr, align 4
%new_gc_wrapper = call %GcWrapper** @new_gc_wrapper(%GcStruct** %0, %ValueStruct %deref)
ret %GcWrapper** %new_gc_wrapper
}
define %ValueWrapper @new_value_wrapper(%GcStruct** %0, %ValueStruct %1) {
body:
%.fca.0.extract = extractvalue %ValueStruct %1, 0
%.fca.1.extract = extractvalue %ValueStruct %1, 1
%init = insertvalue %ValueWrapper undef, %GcStruct** %0, 0
%init3 = insertvalue %ValueWrapper %init, %ValueStruct %1, 1
ret %ValueWrapper %init3
}
define %ValueWrapper** @new_value_wrapper_wrapper(%GcStruct** %0, %ValueStruct** %1) {
body:
%mem_ptr = load %ValueStruct*, %ValueStruct** %1, align 8
%deref = load %ValueStruct, %ValueStruct* %mem_ptr, align 4
%new_value_wrapper = call %ValueWrapper @new_value_wrapper(%GcStruct** %0, %ValueStruct %deref)
%new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0), align 8
%ValueWrapper_ptr = load %"mun_codegen::ir::types::TypeInfo"*, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([8 x %"mun_codegen::ir::types::TypeInfo"*], [8 x %"mun_codegen::ir::types::TypeInfo"*]* @global_type_table, i64 0, i64 2), align 8
%type_info_ptr_to_i8_ptr = bitcast %"mun_codegen::ir::types::TypeInfo"* %ValueWrapper_ptr to i8*
%allocator_handle = load i8*, i8** @allocatorHandle, align 8
%new = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle)
%ValueWrapper_ptr_ptr = bitcast i8** %new to %ValueWrapper**
%ValueWrapper_mem_ptr = load %ValueWrapper*, %ValueWrapper** %ValueWrapper_ptr_ptr, align 8
store %ValueWrapper %new_value_wrapper, %ValueWrapper* %ValueWrapper_mem_ptr, align 8
ret %ValueWrapper** %ValueWrapper_ptr_ptr
}
; == GROUP IR (mod) ====================================
; ModuleID = 'group_name'
source_filename = "group_name"
%DispatchTable = type { i8** (i8*, i8*)* }
%"mun_codegen::ir::types::TypeInfo" = type <{ [0 x i64], [16 x i8], [0 x i64], i8*, [0 x i64], i32, [0 x i64], i8, [3 x i8], %"mun_codegen::ir::types::TypeInfoData", [0 x i64] }>
%"mun_codegen::ir::types::TypeInfoData" = type <{ [0 x i8], i8, [39 x i8] }>
@dispatchTable = global %DispatchTable zeroinitializer
@"type_info::<GcWrapper>::name" = private unnamed_addr constant [10 x i8] c"GcWrapper\00"
@"struct_info::<GcWrapper>::field_names.0" = private unnamed_addr constant [2 x i8] c"0\00"
@"struct_info::<GcWrapper>::field_names.1" = private unnamed_addr constant [2 x i8] c"1\00"
@"struct_info::<GcWrapper>::field_names" = private unnamed_addr constant [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<GcWrapper>::field_names.0", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<GcWrapper>::field_names.1", i32 0, i32 0)]
@"type_info::<GcStruct>::name" = private unnamed_addr constant [9 x i8] c"GcStruct\00"
@"struct_info::<GcStruct>::field_names.0" = private unnamed_addr constant [2 x i8] c"0\00"
@"struct_info::<GcStruct>::field_names.1" = private unnamed_addr constant [2 x i8] c"1\00"
@"struct_info::<GcStruct>::field_names" = private unnamed_addr constant [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<GcStruct>::field_names.0", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<GcStruct>::field_names.1", i32 0, i32 0)]
@"type_info::<core::f32>::name" = private unnamed_addr constant [10 x i8] c"core::f32\00"
@"type_info::<core::f32>" = private unnamed_addr constant <{ [16 x i8], i8*, [48 x i8] }> <{ [16 x i8] c"P\19b7\A8k\F2\81P\FB\83\F5P\B0\82!", i8* getelementptr inbounds ([10 x i8], [10 x i8]* @"type_info::<core::f32>::name", i32 0, i32 0), [48 x i8] c" \00\00\00\04\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }>
@"struct_info::<GcStruct>::field_types" = private unnamed_addr constant [2 x %"mun_codegen::ir::types::TypeInfo"*] [%"mun_codegen::ir::types::TypeInfo"* @"type_info::<core::f32>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<core::f32>"]
@"struct_info::<GcStruct>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 4]
@"type_info::<GcStruct>" = private unnamed_addr constant <{ [16 x i8], i8*, [16 x i8], i8**, [0 x i8], %"mun_codegen::ir::types::TypeInfo"**, [0 x i8], i16*, [8 x i8] }> <{ [16 x i8] c"\B9)lg\01\95k@E\B4(\CB\CAGX\E1", i8* getelementptr inbounds ([9 x i8], [9 x i8]* @"type_info::<GcStruct>::name", i32 0, i32 0), [16 x i8] c"@\00\00\00\04\00\00\00\01\00\00\00\00\00\00\00", i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @"struct_info::<GcStruct>::field_names", i32 0, i32 0), [0 x i8] zeroinitializer, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([2 x %"mun_codegen::ir::types::TypeInfo"*], [2 x %"mun_codegen::ir::types::TypeInfo"*]* @"struct_info::<GcStruct>::field_types", i32 0, i32 0), [0 x i8] zeroinitializer, i16* getelementptr inbounds ([2 x i16], [2 x i16]* @"struct_info::<GcStruct>::field_offsets", i32 0, i32 0), [8 x i8] c"\02\00\00\00\00\00\00\00" }>
@"type_info::<ValueStruct>::name" = private unnamed_addr constant [12 x i8] c"ValueStruct\00"
@"struct_info::<ValueStruct>::field_names.0" = private unnamed_addr constant [2 x i8] c"0\00"
@"struct_info::<ValueStruct>::field_names.1" = private unnamed_addr constant [2 x i8] c"1\00"
@"struct_info::<ValueStruct>::field_names" = private unnamed_addr constant [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<ValueStruct>::field_names.0", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<ValueStruct>::field_names.1", i32 0, i32 0)]
@"struct_info::<ValueStruct>::field_types" = private unnamed_addr constant [2 x %"mun_codegen::ir::types::TypeInfo"*] [%"mun_codegen::ir::types::TypeInfo"* @"type_info::<core::f32>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<core::f32>"]
@"struct_info::<ValueStruct>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 4]
@"type_info::<ValueStruct>" = private unnamed_addr constant <{ [16 x i8], i8*, [16 x i8], i8**, [0 x i8], %"mun_codegen::ir::types::TypeInfo"**, [0 x i8], i16*, [8 x i8] }> <{ [16 x i8] c"U0{\87\\\04Q/\95!$\A2\F1\A9\F9W", i8* getelementptr inbounds ([12 x i8], [12 x i8]* @"type_info::<ValueStruct>::name", i32 0, i32 0), [16 x i8] c"@\00\00\00\04\00\00\00\01\00\00\00\00\00\00\00", i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @"struct_info::<ValueStruct>::field_names", i32 0, i32 0), [0 x i8] zeroinitializer, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([2 x %"mun_codegen::ir::types::TypeInfo"*], [2 x %"mun_codegen::ir::types::TypeInfo"*]* @"struct_info::<ValueStruct>::field_types", i32 0, i32 0), [0 x i8] zeroinitializer, i16* getelementptr inbounds ([2 x i16], [2 x i16]* @"struct_info::<ValueStruct>::field_offsets", i32 0, i32 0), [8 x i8] c"\02\00\01\00\00\00\00\00" }>
@"struct_info::<GcWrapper>::field_types" = private unnamed_addr constant [2 x %"mun_codegen::ir::types::TypeInfo"*] [%"mun_codegen::ir::types::TypeInfo"* @"type_info::<GcStruct>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<ValueStruct>"]
@"struct_info::<GcWrapper>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 8]
@"type_info::<GcWrapper>" = private unnamed_addr constant <{ [16 x i8], i8*, [16 x i8], i8**, [0 x i8], %"mun_codegen::ir::types::TypeInfo"**, [0 x i8], i16*, [8 x i8] }> <{ [16 x i8] c"!\14\93\A7H1?90\B7\EA\DB0\82\A0\C7", i8* getelementptr inbounds ([10 x i8], [10 x i8]* @"type_info::<GcWrapper>::name", i32 0, i32 0), [16 x i8] c"\80\00\00\00\08\00\00\00\01\00\00\00\00\00\00\00", i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @"struct_info::<GcWrapper>::field_names", i32 0, i32 0), [0 x i8] zeroinitializer, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([2 x %"mun_codegen::ir::types::TypeInfo"*], [2 x %"mun_codegen::ir::types::TypeInfo"*]* @"struct_info::<GcWrapper>::field_types", i32 0, i32 0), [0 x i8] zeroinitializer, i16* getelementptr inbounds ([2 x i16], [2 x i16]* @"struct_info::<GcWrapper>::field_offsets", i32 0, i32 0), [8 x i8] c"\02\00\00\00\00\00\00\00" }>
@"type_info::<*const TypeInfo>::name" = private unnamed_addr constant [16 x i8] c"*const TypeInfo\00"
@"type_info::<*const TypeInfo>" = private unnamed_addr constant <{ [16 x i8], i8*, [48 x i8] }> <{ [16 x i8] c"=\A1-\1F\C2\A7\88`d\90\F4\B5\BEE}x", i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"type_info::<*const TypeInfo>::name", i32 0, i32 0), [48 x i8] c"@\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }>
@"type_info::<ValueWrapper>::name" = private unnamed_addr constant [13 x i8] c"ValueWrapper\00"
@"struct_info::<ValueWrapper>::field_names.0" = private unnamed_addr constant [2 x i8] c"0\00"
@"struct_info::<ValueWrapper>::field_names.1" = private unnamed_addr constant [2 x i8] c"1\00"
@"struct_info::<ValueWrapper>::field_names" = private unnamed_addr constant [2 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<ValueWrapper>::field_names.0", i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @"struct_info::<ValueWrapper>::field_names.1", i32 0, i32 0)]
@"struct_info::<ValueWrapper>::field_types" = private unnamed_addr constant [2 x %"mun_codegen::ir::types::TypeInfo"*] [%"mun_codegen::ir::types::TypeInfo"* @"type_info::<GcStruct>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<ValueStruct>"]
@"struct_info::<ValueWrapper>::field_offsets" = private unnamed_addr constant [2 x i16] [i16 0, i16 8]
@"type_info::<ValueWrapper>" = private unnamed_addr constant <{ [16 x i8], i8*, [16 x i8], i8**, [0 x i8], %"mun_codegen::ir::types::TypeInfo"**, [0 x i8], i16*, [8 x i8] }> <{ [16 x i8] c"@j\D8\CD~-\12\87|A\E8\DBp\EC}\AA", i8* getelementptr inbounds ([13 x i8], [13 x i8]* @"type_info::<ValueWrapper>::name", i32 0, i32 0), [16 x i8] c"\80\00\00\00\08\00\00\00\01\00\00\00\00\00\00\00", i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @"struct_info::<ValueWrapper>::field_names", i32 0, i32 0), [0 x i8] zeroinitializer, %"mun_codegen::ir::types::TypeInfo"** getelementptr inbounds ([2 x %"mun_codegen::ir::types::TypeInfo"*], [2 x %"mun_codegen::ir::types::TypeInfo"*]* @"struct_info::<ValueWrapper>::field_types", i32 0, i32 0), [0 x i8] zeroinitializer, i16* getelementptr inbounds ([2 x i16], [2 x i16]* @"struct_info::<ValueWrapper>::field_offsets", i32 0, i32 0), [8 x i8] c"\02\00\01\00\00\00\00\00" }>
@"type_info::<*const *mut core::void>::name" = private unnamed_addr constant [23 x i8] c"*const *mut core::void\00"
@"type_info::<*const *mut core::void>" = private unnamed_addr constant <{ [16 x i8], i8*, [48 x i8] }> <{ [16 x i8] c"\C5fO\BD\84\DF\06\BFd+\B1\9Abv\CE\00", i8* getelementptr inbounds ([23 x i8], [23 x i8]* @"type_info::<*const *mut core::void>::name", i32 0, i32 0), [48 x i8] c"@\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }>
@"type_info::<*mut core::void>::name" = private unnamed_addr constant [16 x i8] c"*mut core::void\00"
@"type_info::<*mut core::void>" = private unnamed_addr constant <{ [16 x i8], i8*, [48 x i8] }> <{ [16 x i8] c"\F0Y\22\FC\95\9E\7F\CE\08T\B1\A2\CD\A7\FAz", i8* getelementptr inbounds ([16 x i8], [16 x i8]* @"type_info::<*mut core::void>::name", i32 0, i32 0), [48 x i8] c"@\00\00\00\08\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" }>
@global_type_table = constant [8 x %"mun_codegen::ir::types::TypeInfo"*] [%"mun_codegen::ir::types::TypeInfo"* @"type_info::<GcWrapper>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<*const TypeInfo>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<ValueWrapper>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<core::f32>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<ValueStruct>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<GcStruct>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<*const *mut core::void>", %"mun_codegen::ir::types::TypeInfo"* @"type_info::<*mut core::void>"]
@allocatorHandle = unnamed_addr global i8* null