Skip to content

Commit 1401089

Browse files
committed
Export literal assignments as operation
1 parent 7bbdd9a commit 1401089

File tree

4 files changed

+72
-70
lines changed

4 files changed

+72
-70
lines changed

libyul/YulControlFlowGraphExporter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Json YulControlFlowGraphExporter::toJson(Json& _ret, SSACFG const& _cfg, SSACFG:
187187
{
188188
yulAssert(_operation.inputs.size() == 1);
189189
yulAssert(_cfg.isLiteralValue(_operation.inputs.back()));
190-
_ret["type"] = "LiteralAssignment";
190+
opJson["op"] = "LiteralAssignment";
191191
},
192192
[&](SSACFG::BuiltinCall const& _call)
193193
{
@@ -210,7 +210,7 @@ Json YulControlFlowGraphExporter::toJson(Json& _ret, SSACFG const& _cfg, SSACFG:
210210
}
211211

212212
if (!builtinArgsJson.empty())
213-
opJson["builtinArgs"] = builtinArgsJson;
213+
opJson["literalArgs"] = builtinArgsJson;
214214

215215
opJson["op"] = _call.builtin.get().name;
216216
},

test/cmdlineTests/standard_yul_cfg_json_export/output.json

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"id": "Block0",
1818
"instructions": [
1919
{
20-
"builtinArgs": [
20+
"in": [],
21+
"literalArgs": [
2122
"0x80"
2223
],
23-
"in": [],
2424
"op": "memoryguard",
2525
"out": [
2626
"v0"
@@ -57,20 +57,20 @@
5757
"id": "Block2",
5858
"instructions": [
5959
{
60-
"builtinArgs": [
60+
"in": [],
61+
"literalArgs": [
6162
"C_19_deployed"
6263
],
63-
"in": [],
6464
"op": "datasize",
6565
"out": [
6666
"v4"
6767
]
6868
},
6969
{
70-
"builtinArgs": [
70+
"in": [],
71+
"literalArgs": [
7172
"C_19_deployed"
7273
],
73-
"in": [],
7474
"op": "dataoffset",
7575
"out": [
7676
"v5"
@@ -140,10 +140,10 @@
140140
"id": "Block0",
141141
"instructions": [
142142
{
143-
"builtinArgs": [
143+
"in": [],
144+
"literalArgs": [
144145
"0x80"
145146
],
146-
"in": [],
147147
"op": "memoryguard",
148148
"out": [
149149
"v0"
@@ -464,10 +464,10 @@
464464
"id": "Block0",
465465
"instructions": [
466466
{
467-
"builtinArgs": [
467+
"in": [],
468+
"literalArgs": [
468469
"0x80"
469470
],
470-
"in": [],
471471
"op": "memoryguard",
472472
"out": [
473473
"v0"
@@ -504,20 +504,20 @@
504504
"id": "Block2",
505505
"instructions": [
506506
{
507-
"builtinArgs": [
507+
"in": [],
508+
"literalArgs": [
508509
"D_38_deployed"
509510
],
510-
"in": [],
511511
"op": "datasize",
512512
"out": [
513513
"v4"
514514
]
515515
},
516516
{
517-
"builtinArgs": [
517+
"in": [],
518+
"literalArgs": [
518519
"D_38_deployed"
519520
],
520-
"in": [],
521521
"op": "dataoffset",
522522
"out": [
523523
"v5"
@@ -587,10 +587,10 @@
587587
"id": "Block0",
588588
"instructions": [
589589
{
590-
"builtinArgs": [
590+
"in": [],
591+
"literalArgs": [
591592
"0x80"
592593
],
593-
"in": [],
594594
"op": "memoryguard",
595595
"out": [
596596
"v0"
@@ -845,10 +845,10 @@
845845
"id": "Block9",
846846
"instructions": [
847847
{
848-
"builtinArgs": [
848+
"in": [],
849+
"literalArgs": [
849850
"C_19"
850851
],
851-
"in": [],
852852
"op": "datasize",
853853
"out": [
854854
"v18"
@@ -940,10 +940,10 @@
940940
"id": "Block12",
941941
"instructions": [
942942
{
943-
"builtinArgs": [
943+
"in": [],
944+
"literalArgs": [
944945
"C_19"
945946
],
946-
"in": [],
947947
"op": "dataoffset",
948948
"out": [
949949
"v35"
@@ -1226,6 +1226,7 @@
12261226
"in": [
12271227
"0x00"
12281228
],
1229+
"op": "LiteralAssignment",
12291230
"out": [
12301231
"v64"
12311232
]
@@ -1240,8 +1241,7 @@
12401241
"v46",
12411242
"v64"
12421243
]
1243-
},
1244-
"type": "LiteralAssignment"
1244+
}
12451245
},
12461246
{
12471247
"exit": {
@@ -1365,6 +1365,7 @@
13651365
"in": [
13661366
"0x20"
13671367
],
1368+
"op": "LiteralAssignment",
13681369
"out": [
13691370
"v67"
13701371
]
@@ -1710,10 +1711,10 @@
17101711
"id": "Block0",
17111712
"instructions": [
17121713
{
1713-
"builtinArgs": [
1714+
"in": [],
1715+
"literalArgs": [
17141716
"0x80"
17151717
],
1716-
"in": [],
17171718
"op": "memoryguard",
17181719
"out": [
17191720
"v0"
@@ -1750,20 +1751,20 @@
17501751
"id": "Block2",
17511752
"instructions": [
17521753
{
1753-
"builtinArgs": [
1754+
"in": [],
1755+
"literalArgs": [
17541756
"C_19_deployed"
17551757
],
1756-
"in": [],
17571758
"op": "datasize",
17581759
"out": [
17591760
"v4"
17601761
]
17611762
},
17621763
{
1763-
"builtinArgs": [
1764+
"in": [],
1765+
"literalArgs": [
17641766
"C_19_deployed"
17651767
],
1766-
"in": [],
17671768
"op": "dataoffset",
17681769
"out": [
17691770
"v5"
@@ -1833,10 +1834,10 @@
18331834
"id": "Block0",
18341835
"instructions": [
18351836
{
1836-
"builtinArgs": [
1837+
"in": [],
1838+
"literalArgs": [
18371839
"0x80"
18381840
],
1839-
"in": [],
18401841
"op": "memoryguard",
18411842
"out": [
18421843
"v0"

test/cmdlineTests/strict_asm_yul_cfg_json_export/output

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Yul Control Flow Graph:
1717
"id": "Block0",
1818
"instructions": [
1919
{
20-
"builtinArgs": [
20+
"in": [],
21+
"literalArgs": [
2122
"0x80"
2223
],
23-
"in": [],
2424
"op": "memoryguard",
2525
"out": [
2626
"v0"
@@ -57,20 +57,20 @@ Yul Control Flow Graph:
5757
"id": "Block2",
5858
"instructions": [
5959
{
60-
"builtinArgs": [
60+
"in": [],
61+
"literalArgs": [
6162
"C_19_deployed"
6263
],
63-
"in": [],
6464
"op": "datasize",
6565
"out": [
6666
"v4"
6767
]
6868
},
6969
{
70-
"builtinArgs": [
70+
"in": [],
71+
"literalArgs": [
7172
"C_19_deployed"
7273
],
73-
"in": [],
7474
"op": "dataoffset",
7575
"out": [
7676
"v5"
@@ -140,10 +140,10 @@ Yul Control Flow Graph:
140140
"id": "Block0",
141141
"instructions": [
142142
{
143-
"builtinArgs": [
143+
"in": [],
144+
"literalArgs": [
144145
"0x80"
145146
],
146-
"in": [],
147147
"op": "memoryguard",
148148
"out": [
149149
"v0"

0 commit comments

Comments
 (0)