[nix-shell:~/dev/zig/build]$ ./zig-out/bin/zig astgen a.zig >a.zir [nix-shell:~/dev/zig/build]$ ./zig-out/bin/zig astgen b.zig >b.zir [nix-shell:~/dev/zig/build]$ ./zig-out/bin/zig changelist a.zig b.zig Instruction mappings: %14 => %14 %24 => %22 %16 => %16 %22 => %20 %47 => %45 %49 => %47 %30 => %28 %12 => %12 Extra mappings: 161 => 153 33 => 33 154 => 146 65 => 57 [nix-shell:~/dev/zig/build]$ cat a.zig pub fn main() void { print(); const S = if (cond) struct { x: i32, fn method() void { const E = enum { one }; } } else struct { x: f32, fn ok() void { const E2 = enum { two }; } }; } fn print() void { asm volatile ("syscall" : : [number] "{rax}" (1), [arg1] "{rdi}" (1), [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), [arg3] "{rdx}" (14) : "rcx", "r11", "memory" ); return; } [nix-shell:~/dev/zig/build]$ cat b.zig pub fn main() void { print(); const S = if (cond) struct { x: i32, fn method() void { const E = enum { one }; } } else struct { x: f32, fn ok() void {} }; } fn print() void { asm volatile ("syscall" : : [number] "{rax}" (1), [arg1] "{rdi}" (1), [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), [arg3] "{rdx}" (14) : "rcx", "r11", "memory" ); return; } [nix-shell:~/dev/zig/build]$ cat a.zir # Source bytes: 533B # Tokens: 123 (639B) # AST Nodes: 46 (718B) # Total ZIR bytes: 1.2841796875KiB # Instructions: 50 (450B) # String Table Bytes: 129B # Extra Data Items: 168 (672B) %49 = struct_decl({ [154] pub main line(0) hash(074c0e2d47c9d36545594c7bddf23b38): %0 = block_inline({ %30 = func([], @Ref.void_type, { %1 = dbg_stmt(1, 4) %2 = decl_val("print") token_offset:2:5 %3 = call_chkused(%2, []) node_offset:2:10 %4 = dbg_stmt(2, 4) %9 = block({ %6 = decl_val("cond") token_offset:3:19 %7 = as_node(@Ref.bool_type, %6) node_offset:3:19 %8 = condbr(%7, { %16 = struct_decl({ [33] method line(5) hash(2ca564c250c315ee1fdc364e987fee3f): %10 = block_inline({ %14 = func([], @Ref.void_type, { %11 = dbg_stmt(1, 12) %12 = enum_decl({}, {}, { one, }) node_offset:7:23 %13 = ret_coerce(@Ref.void_value) token_offset:8:9 }) (lbrace=0:17,rbrace=2:8) node_offset:6:9 %15 = break_inline(%10, %14) }) node_offset:6:9 }, {}, { x: @Ref.i32_type, }) node_offset:3:25 %17 = store_to_block_ptr(%5, %16) %26 = break(%9, %16) }, { %24 = struct_decl({ [65] ok line(11) hash(c90e92151d26cd1991636515a27b1796): %18 = block_inline({ %22 = func([], @Ref.void_type, { %19 = dbg_stmt(1, 12) %20 = enum_decl({}, {}, { two, }) node_offset:13:24 %21 = ret_coerce(@Ref.void_value) token_offset:14:9 }) (lbrace=0:13,rbrace=2:8) node_offset:12:9 %23 = break_inline(%18, %22) }) node_offset:12:9 }, {}, { x: @Ref.f32_type, }) node_offset:9:12 %25 = store_to_block_ptr(%5, %24) %27 = break(%9, %24) }) node_offset:3:15 }) node_offset:3:15 %29 = ret_coerce(@Ref.void_value) token_offset:16:1 }) (lbrace=0:19,rbrace=15:0) node_offset:1:5 %31 = break_inline(%0, %30) }) node_offset:1:5 [161] print line(17) hash(769c011edaf1727ed53de30cb52508c3): %32 = block_inline({ %47 = func([], @Ref.void_type, { %33 = dbg_stmt(1, 4) %34 = str("syscall") %35 = as_node(@Ref.const_slice_u8_type, %34) node_offset:19:19 %36 = as_node(@Ref.usize_type, @Ref.one) node_offset:21:29 %37 = as_node(@Ref.usize_type, @Ref.one) node_offset:22:27 %38 = str("Hello, World!\n") %39 = ptr_to_int(%38) node_offset:23:27 %40 = as_node(@Ref.usize_type, %39) node_offset:23:27 %41 = int(14) %42 = as_node(@Ref.usize_type, %41) node_offset:24:27 %43 = extended(asm(volatile, %35, input(number, "{rax}", %36), input(arg1, "{rdi}", %37), input(arg2, "{rsi}", %40), input(arg3, "{rdx}", %42)rcx, r11, memory)) node_offset:19:5 %44 = ensure_result_used(%43) node_offset:19:5 %45 = dbg_stmt(9, 4) %46 = ret_node(@Ref.void_value) node_offset:27:5 }) (lbrace=0:16,rbrace=10:0) node_offset:18:1 %48 = break_inline(%32, %47) }) node_offset:18:1 }, {}, {}) node_offset:1:1 [nix-shell:~/dev/zig/build]$ cat b.zir # Source bytes: 487B # Tokens: 115 (599B) # AST Nodes: 43 (679B) # Total ZIR bytes: 1.228515625KiB # Instructions: 48 (432B) # String Table Bytes: 122B # Extra Data Items: 160 (640B) %47 = struct_decl({ [146] pub main line(0) hash(d560f9b12c8f5afc0e244fe126be28d7): %0 = block_inline({ %28 = func([], @Ref.void_type, { %1 = dbg_stmt(1, 4) %2 = decl_val("print") token_offset:2:5 %3 = call_chkused(%2, []) node_offset:2:10 %4 = dbg_stmt(2, 4) %9 = block({ %6 = decl_val("cond") token_offset:3:19 %7 = as_node(@Ref.bool_type, %6) node_offset:3:19 %8 = condbr(%7, { %16 = struct_decl({ [33] method line(5) hash(2ca564c250c315ee1fdc364e987fee3f): %10 = block_inline({ %14 = func([], @Ref.void_type, { %11 = dbg_stmt(1, 12) %12 = enum_decl({}, {}, { one, }) node_offset:7:23 %13 = ret_coerce(@Ref.void_value) token_offset:8:9 }) (lbrace=0:17,rbrace=2:8) node_offset:6:9 %15 = break_inline(%10, %14) }) node_offset:6:9 }, {}, { x: @Ref.i32_type, }) node_offset:3:25 %17 = store_to_block_ptr(%5, %16) %24 = break(%9, %16) }, { %22 = struct_decl({ [57] ok line(11) hash(64638a6529d0e99e7dad955d26d3ec0d): %18 = block_inline({ %20 = func([], @Ref.void_type, { %19 = ret_coerce(@Ref.void_value) token_offset:12:23 }) (lbrace=0:13,rbrace=0:1) node_offset:12:9 %21 = break_inline(%18, %20) }) node_offset:12:9 }, {}, { x: @Ref.f32_type, }) node_offset:9:12 %23 = store_to_block_ptr(%5, %22) %25 = break(%9, %22) }) node_offset:3:15 }) node_offset:3:15 %27 = ret_coerce(@Ref.void_value) token_offset:14:1 }) (lbrace=0:19,rbrace=13:0) node_offset:1:5 %29 = break_inline(%0, %28) }) node_offset:1:5 [153] print line(15) hash(769c011edaf1727ed53de30cb52508c3): %30 = block_inline({ %45 = func([], @Ref.void_type, { %31 = dbg_stmt(1, 4) %32 = str("syscall") %33 = as_node(@Ref.const_slice_u8_type, %32) node_offset:17:19 %34 = as_node(@Ref.usize_type, @Ref.one) node_offset:19:29 %35 = as_node(@Ref.usize_type, @Ref.one) node_offset:20:27 %36 = str("Hello, World!\n") %37 = ptr_to_int(%36) node_offset:21:27 %38 = as_node(@Ref.usize_type, %37) node_offset:21:27 %39 = int(14) %40 = as_node(@Ref.usize_type, %39) node_offset:22:27 %41 = extended(asm(volatile, %33, input(number, "{rax}", %34), input(arg1, "{rdi}", %35), input(arg2, "{rsi}", %38), input(arg3, "{rdx}", %40)rcx, r11, memory)) node_offset:17:5 %42 = ensure_result_used(%41) node_offset:17:5 %43 = dbg_stmt(9, 4) %44 = ret_node(@Ref.void_value) node_offset:25:5 }) (lbrace=0:16,rbrace=10:0) node_offset:16:1 %46 = break_inline(%30, %45) }) node_offset:16:1 }, {}, {}) node_offset:1:1