diff --git a/libyul/YulControlFlowGraphExporter.cpp b/libyul/YulControlFlowGraphExporter.cpp index 13770989b91d..e2d37e703271 100644 --- a/libyul/YulControlFlowGraphExporter.cpp +++ b/libyul/YulControlFlowGraphExporter.cpp @@ -74,9 +74,8 @@ Json YulControlFlowGraphExporter::exportFunction(SSACFG const& _cfg) Json functionJson = Json::object(); functionJson["type"] = "Function"; functionJson["entry"] = "Block" + std::to_string(_cfg.entry.value); - functionJson["arguments"] = Json::array(); - for (auto const& [arg, valueId]: _cfg.arguments) - functionJson["arguments"].emplace_back(arg.get().name.str()); + static auto constexpr argsTransform = [](auto const& arg) { return fmt::format("v{}", std::get<1>(arg).value); }; + functionJson["arguments"] = _cfg.arguments | ranges::views::transform(argsTransform) | ranges::to; functionJson["returns"] = Json::array(); for (auto const& ret: _cfg.returns) functionJson["returns"].emplace_back(ret.get().name.str()); diff --git a/test/cmdlineTests/standard_yul_cfg_json_export/output.json b/test/cmdlineTests/standard_yul_cfg_json_export/output.json index d09a6c1a5396..a43c553c4839 100644 --- a/test/cmdlineTests/standard_yul_cfg_json_export/output.json +++ b/test/cmdlineTests/standard_yul_cfg_json_export/output.json @@ -380,8 +380,8 @@ "functions": { "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -447,8 +447,8 @@ }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -485,8 +485,8 @@ }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -569,7 +569,7 @@ }, "cleanup_t_rational_42_by_1": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -591,7 +591,7 @@ }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -613,7 +613,7 @@ }, "convert_t_rational_42_by_1_to_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -811,7 +811,7 @@ }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -908,7 +908,7 @@ }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1324,8 +1324,8 @@ "functions": { "abi_decode_t_uint256_fromMemory": { "arguments": [ - "offset", - "end" + "v0", + "v1" ], "blocks": [ { @@ -1365,8 +1365,8 @@ }, "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -1432,8 +1432,8 @@ }, "abi_decode_tuple_t_uint256_fromMemory": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -1525,8 +1525,8 @@ }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -1563,7 +1563,7 @@ }, "abi_encode_tuple__to__fromStack": { "arguments": [ - "headStart" + "v0" ], "blocks": [ { @@ -1597,8 +1597,8 @@ }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -1681,7 +1681,7 @@ }, "cleanup_t_uint160": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1715,7 +1715,7 @@ }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1737,7 +1737,7 @@ }, "convert_t_contract$_C_$19_to_t_address": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1770,7 +1770,7 @@ }, "convert_t_uint160_to_t_address": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1803,7 +1803,7 @@ }, "convert_t_uint160_to_t_uint160": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1963,8 +1963,8 @@ }, "finalize_allocation": { "arguments": [ - "memPtr", - "size" + "v0", + "v1" ], "blocks": [ { @@ -2528,7 +2528,7 @@ }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2771,7 +2771,7 @@ }, "round_up_to_mul_of_32": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2824,7 +2824,7 @@ }, "shift_left_224": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2858,7 +2858,7 @@ }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2892,7 +2892,7 @@ }, "validator_revert_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3367,8 +3367,8 @@ "functions": { "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -3434,8 +3434,8 @@ }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -3472,8 +3472,8 @@ }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -3556,7 +3556,7 @@ }, "cleanup_t_rational_42_by_1": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3578,7 +3578,7 @@ }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3600,7 +3600,7 @@ }, "convert_t_rational_42_by_1_to_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3798,7 +3798,7 @@ }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3895,7 +3895,7 @@ }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ { diff --git a/test/cmdlineTests/yul_cfg_json_export/output b/test/cmdlineTests/yul_cfg_json_export/output index 3a287ee760ad..d68997bff969 100644 --- a/test/cmdlineTests/yul_cfg_json_export/output +++ b/test/cmdlineTests/yul_cfg_json_export/output @@ -379,8 +379,8 @@ Yul Control Flow Graph: "functions": { "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -446,8 +446,8 @@ Yul Control Flow Graph: }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -484,8 +484,8 @@ Yul Control Flow Graph: }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -568,7 +568,7 @@ Yul Control Flow Graph: }, "cleanup_t_rational_42_by_1": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -590,7 +590,7 @@ Yul Control Flow Graph: }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -612,7 +612,7 @@ Yul Control Flow Graph: }, "convert_t_rational_42_by_1_to_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -810,7 +810,7 @@ Yul Control Flow Graph: }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -907,7 +907,7 @@ Yul Control Flow Graph: }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1324,8 +1324,8 @@ Yul Control Flow Graph: "functions": { "abi_decode_t_uint256_fromMemory": { "arguments": [ - "offset", - "end" + "v0", + "v1" ], "blocks": [ { @@ -1365,8 +1365,8 @@ Yul Control Flow Graph: }, "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -1432,8 +1432,8 @@ Yul Control Flow Graph: }, "abi_decode_tuple_t_uint256_fromMemory": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -1525,8 +1525,8 @@ Yul Control Flow Graph: }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -1563,7 +1563,7 @@ Yul Control Flow Graph: }, "abi_encode_tuple__to__fromStack": { "arguments": [ - "headStart" + "v0" ], "blocks": [ { @@ -1597,8 +1597,8 @@ Yul Control Flow Graph: }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -1681,7 +1681,7 @@ Yul Control Flow Graph: }, "cleanup_t_uint160": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1715,7 +1715,7 @@ Yul Control Flow Graph: }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1737,7 +1737,7 @@ Yul Control Flow Graph: }, "convert_t_contract$_C_$19_to_t_address": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1770,7 +1770,7 @@ Yul Control Flow Graph: }, "convert_t_uint160_to_t_address": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1803,7 +1803,7 @@ Yul Control Flow Graph: }, "convert_t_uint160_to_t_uint160": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -1963,8 +1963,8 @@ Yul Control Flow Graph: }, "finalize_allocation": { "arguments": [ - "memPtr", - "size" + "v0", + "v1" ], "blocks": [ { @@ -2528,7 +2528,7 @@ Yul Control Flow Graph: }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2771,7 +2771,7 @@ Yul Control Flow Graph: }, "round_up_to_mul_of_32": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2824,7 +2824,7 @@ Yul Control Flow Graph: }, "shift_left_224": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2858,7 +2858,7 @@ Yul Control Flow Graph: }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -2892,7 +2892,7 @@ Yul Control Flow Graph: }, "validator_revert_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3367,8 +3367,8 @@ Yul Control Flow Graph: "functions": { "abi_decode_tuple_": { "arguments": [ - "headStart", - "dataEnd" + "v0", + "v1" ], "blocks": [ { @@ -3434,8 +3434,8 @@ Yul Control Flow Graph: }, "abi_encode_t_uint256_to_t_uint256_fromStack": { "arguments": [ - "value", - "pos" + "v0", + "v1" ], "blocks": [ { @@ -3472,8 +3472,8 @@ Yul Control Flow Graph: }, "abi_encode_tuple_t_uint256__to_t_uint256__fromStack": { "arguments": [ - "headStart", - "value0" + "v0", + "v1" ], "blocks": [ { @@ -3556,7 +3556,7 @@ Yul Control Flow Graph: }, "cleanup_t_rational_42_by_1": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3578,7 +3578,7 @@ Yul Control Flow Graph: }, "cleanup_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3600,7 +3600,7 @@ Yul Control Flow Graph: }, "convert_t_rational_42_by_1_to_t_uint256": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3798,7 +3798,7 @@ Yul Control Flow Graph: }, "identity": { "arguments": [ - "value" + "v0" ], "blocks": [ { @@ -3895,7 +3895,7 @@ Yul Control Flow Graph: }, "shift_right_224_unsigned": { "arguments": [ - "value" + "v0" ], "blocks": [ {