FluxML / IRTools.jl

Mike's Little Intermediate Representation
MIT License
111 stars 36 forks source link

support do blocks in @code_ir #69

Closed MasonProtter closed 4 years ago

MasonProtter commented 4 years ago
julia> @code_ir map([1,2], [3,4]) do x, y
           x + y
       end
1: (%1, %2, %3)
  %4 = Core.tuple(%2)
  %5 = Core._apply_iterate(Base.iterate, Base.Generator, %4, %3)
  %6 = Base.collect(%5)
  return %6

I think this is worth having because with a lot of dynamos, one wants to write them with do block syntax, but then you can't easily look at their @code_ir.

MikeInnes commented 4 years ago

Seems sensible, thanks!