| 8 | namespace { |
| 9 | |
| 10 | ValueRefList apply_release(const Operator& op, Span<ValueRef> inputs) { |
| 11 | auto& context = Transformation::get_context(); |
| 12 | ValueRefList result; |
| 13 | size_t& depth = context.next_transformation; |
| 14 | mgb_assert(depth < context.transformations.size()); |
| 15 | auto& transformation = *context.transformations[depth++]; |
| 16 | CleanupGuard _{[&] { --depth; }}; |
| 17 | if (context.bt != nullptr && context.record_trans_bt) { |
| 18 | std::vector<std::string> types; |
| 19 | for (size_t i = 0; i < inputs.size(); i++) { |
| 20 | types.push_back(inputs[i].raw_type()); |
| 21 | } |
| 22 | context.bt->trans_stack_info.push_back(TransformationCallInfo{ |
| 23 | depth, op.raw_type(), transformation.name(), |
| 24 | TransformationCallInfo::get_op_attr(op), std::move(types)}); |
| 25 | } |
| 26 | result = transformation.apply_transformation(op, inputs); |
| 27 | if (context.bt != nullptr && context.record_trans_bt) { |
| 28 | std::vector<std::string> types; |
| 29 | for (size_t i = 0; i < result.size(); i++) { |
| 30 | types.push_back(result[i].raw_type()); |
| 31 | } |
| 32 | context.bt->trans_stack_info.push_back( |
| 33 | TransformationReturnInfo{depth, std::move(types)}); |
| 34 | } |
| 35 | if (depth - 1 == context.record_bt_trans_id) { |
| 36 | context.bt = nullptr; |
| 37 | } |
| 38 | return result; |
| 39 | } |
| 40 | |
| 41 | MGB_NOINLINE ValueRefList apply_debug(const Operator& op, Span<ValueRef> inputs) { |
| 42 | auto& context = Transformation::get_context(); |