ir_as_ir function

Generic to convert objects to class ir