---
source: crates/mun_codegen/src/test.rs
assertion_line: 1080
expression: "\n pub struct(value) Value(i32, i32);\n pub struct(gc) Heap(f64, f64);\n\n pub fn assign_value(a: Value, b: Value) -> Value {\n a = b;\n a\n }\n\n pub fn assign_heap(a: Heap, b: Heap) -> Heap {\n a = b;\n a\n }\n // TODO: Add errors\n // a += b;\n // a *= b;\n // a -= b;\n // a /= b;\n // a %= b;\n "
---
; == FILE IR (mod) =====================================
; ModuleID = 'mod'
source_filename = "mod"
%DispatchTable = type { i8** (i8*, i8*)* }
%Value = type { i32, i32 }
%Heap = type { double, double }
@allocatorHandle = external global i8*
@dispatchTable = external global %DispatchTable
@global_type_lookup_table = external global [4 x i64*]
define %Value @assign_value(%Value %0, %Value %1) {
body:
%.fca.0.extract3 = extractvalue %Value %1, 0
%.fca.1.extract4 = extractvalue %Value %1, 1
ret %Value %1
}
define %Value** @assign_value_wrapper(%Value** %0, %Value** %1) {
body:
%"->data" = load %Value*, %Value** %0, align 8
%deref = load %Value, %Value* %"->data", align 4
%"->data1" = load %Value*, %Value** %1, align 8
%deref2 = load %Value, %Value* %"->data1", align 4
%assign_value = call %Value @assign_value(%Value %deref, %Value %deref2)
%new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0), align 8
%Value_ptr = load i64*, i64** getelementptr inbounds ([4 x i64*], [4 x i64*]* @global_type_lookup_table, i64 0, i64 1), align 8
%type_info_ptr_to_i8_ptr = bitcast i64* %Value_ptr to i8*
%allocator_handle = load i8*, i8** @allocatorHandle, align 8
%ref = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle)
%"ref<Value>" = bitcast i8** %ref to %Value**
%"ref<Value>->data" = load %Value*, %Value** %"ref<Value>", align 8
store %Value %assign_value, %Value* %"ref<Value>->data", align 4
ret %Value** %"ref<Value>"
}
define %Heap** @assign_heap(%Heap** %0, %Heap** %1) {
body:
ret %Heap** %1
}
; == GROUP IR (mod) ====================================
; ModuleID = 'group_name'
source_filename = "group_name"
%DispatchTable = type { i8** (i8*, i8*)* }
@dispatchTable = global %DispatchTable zeroinitializer
@global_type_lookup_table = global [4 x i64*] zeroinitializer
@allocatorHandle = unnamed_addr global i8* null