Closed jackalcooper closed 11 months ago
defmodule TwoFuncMod do def add_two_literal() do a = 1 + 2 b = a + 3 b end def main() do add_two_literal() end end defmodule OneFuncMod do def add_two_literal() do a = 1 + 2 b = a + 3 b end end
"builtin.module"() ({ "ex.mod"() ({ "ex.func"() ({ %0 = "ex.lit_int"() {value = 1 : i64} : () -> i64 %1 = "ex.lit_int"() {value = 2 : i64} : () -> i64 %2 = "ex.add"(%0, %1) : (i64, i64) -> !ex.dyn %3 = "ex.var"() {name = "a"} : () -> !ex.unbound %4 = "ex.bind"(%3, %2) : (!ex.unbound, !ex.dyn) -> !ex.bound %5 = "ex.var"() {name = "a"} : () -> !ex.dyn %6 = "ex.lit_int"() {value = 3 : i64} : () -> i64 %7 = "ex.add"(%5, %6) : (!ex.dyn, i64) -> !ex.dyn %8 = "ex.var"() {name = "b"} : () -> !ex.unbound %9 = "ex.bind"(%8, %7) : (!ex.unbound, !ex.dyn) -> !ex.bound %10 = "ex.var"() {name = "b"} : () -> !ex.dyn }) {name = "add_two_literal"} : () -> () "ex.func"() ({ %0 = "ex.call"() {name = "add_two_literal"} : () -> !ex.dyn }) {name = "main"} : () -> () }) {name = "TwoFuncMod"} : () -> () "ex.mod"() ({ "ex.func"() ({ %0 = "ex.lit_int"() {value = 1 : i64} : () -> i64 %1 = "ex.lit_int"() {value = 2 : i64} : () -> i64 %2 = "ex.add"(%0, %1) : (i64, i64) -> !ex.dyn %3 = "ex.var"() {name = "a"} : () -> !ex.unbound %4 = "ex.bind"(%3, %2) : (!ex.unbound, !ex.dyn) -> !ex.bound %5 = "ex.var"() {name = "a"} : () -> !ex.dyn %6 = "ex.lit_int"() {value = 3 : i64} : () -> i64 %7 = "ex.add"(%5, %6) : (!ex.dyn, i64) -> !ex.dyn %8 = "ex.var"() {name = "b"} : () -> !ex.unbound %9 = "ex.bind"(%8, %7) : (!ex.unbound, !ex.dyn) -> !ex.bound %10 = "ex.var"() {name = "b"} : () -> !ex.dyn }) {name = "add_two_literal"} : () -> () }) {name = "OneFuncMod"} : () -> () }) : () -> ()
Source
IR generated