@@ -68,20 +68,7 @@ BuiltinFunctionForEVM createEVMFunction(
68
68
f.numParameters = static_cast <size_t >(info.args );
69
69
f.numReturns = static_cast <size_t >(info.ret );
70
70
f.sideEffects = EVMDialect::sideEffectsOfInstruction (_instruction);
71
- if (evmasm::SemanticInformation::terminatesControlFlow (_instruction))
72
- {
73
- f.controlFlowSideEffects .canContinue = false ;
74
- if (evmasm::SemanticInformation::reverts (_instruction))
75
- {
76
- f.controlFlowSideEffects .canTerminate = false ;
77
- f.controlFlowSideEffects .canRevert = true ;
78
- }
79
- else
80
- {
81
- f.controlFlowSideEffects .canTerminate = true ;
82
- f.controlFlowSideEffects .canRevert = false ;
83
- }
84
- }
71
+ f.controlFlowSideEffects = ControlFlowSideEffects::fromInstruction (_instruction);
85
72
f.isMSize = _instruction == evmasm::Instruction::MSIZE;
86
73
f.literalArguments .clear ();
87
74
f.instruction = _instruction;
@@ -100,6 +87,7 @@ BuiltinFunctionForEVM createFunction(
100
87
size_t _params,
101
88
size_t _returns,
102
89
SideEffects _sideEffects,
90
+ ControlFlowSideEffects _controlFlowSideEffects,
103
91
std::vector<std::optional<LiteralKind>> _literalArguments,
104
92
std::function<void (FunctionCall const &, AbstractAssembly&, BuiltinContext&)> _generateCode
105
93
)
@@ -111,6 +99,7 @@ BuiltinFunctionForEVM createFunction(
111
99
f.numParameters = _params;
112
100
f.numReturns = _returns;
113
101
f.sideEffects = _sideEffects;
102
+ f.controlFlowSideEffects = _controlFlowSideEffects;
114
103
f.literalArguments = std::move (_literalArguments);
115
104
f.isMSize = false ;
116
105
f.instruction = {};
@@ -231,16 +220,17 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
231
220
size_t _params,
232
221
size_t _returns,
233
222
SideEffects _sideEffects,
223
+ ControlFlowSideEffects _controlFlowSideEffects,
234
224
std::vector<std::optional<LiteralKind>> _literalArguments,
235
225
std::function<void (FunctionCall const &, AbstractAssembly&, BuiltinContext&)> _generateCode
236
226
) -> std::optional<BuiltinFunctionForEVM>
237
227
{
238
228
if (!_objectAccess)
239
229
return std::nullopt;
240
- return createFunction (_name, _params, _returns, _sideEffects, std::move (_literalArguments), std::move (_generateCode));
230
+ return createFunction (_name, _params, _returns, _sideEffects, _controlFlowSideEffects, std::move (_literalArguments), std::move (_generateCode));
241
231
};
242
232
243
- builtins.emplace_back (createIfObjectAccess (" linkersymbol" , 1 , 1 , SideEffects{}, {LiteralKind::String}, [](
233
+ builtins.emplace_back (createIfObjectAccess (" linkersymbol" , 1 , 1 , SideEffects{}, ControlFlowSideEffects{}, {LiteralKind::String}, [](
244
234
FunctionCall const & _call,
245
235
AbstractAssembly& _assembly,
246
236
BuiltinContext&
@@ -254,6 +244,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
254
244
1 ,
255
245
1 ,
256
246
SideEffects{},
247
+ ControlFlowSideEffects{},
257
248
{LiteralKind::Number},
258
249
[](
259
250
FunctionCall const & _call,
@@ -268,7 +259,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
268
259
);
269
260
if (!_eofVersion.has_value ())
270
261
{
271
- builtins.emplace_back (createIfObjectAccess (" datasize" , 1 , 1 , SideEffects{}, {LiteralKind::String}, [](
262
+ builtins.emplace_back (createIfObjectAccess (" datasize" , 1 , 1 , SideEffects{}, ControlFlowSideEffects{}, {LiteralKind::String}, [](
272
263
FunctionCall const & _call,
273
264
AbstractAssembly& _assembly,
274
265
BuiltinContext& _context
@@ -289,7 +280,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
289
280
_assembly.appendDataSize (subIdPath);
290
281
}
291
282
}));
292
- builtins.emplace_back (createIfObjectAccess (" dataoffset" , 1 , 1 , SideEffects{}, {LiteralKind::String}, [](
283
+ builtins.emplace_back (createIfObjectAccess (" dataoffset" , 1 , 1 , SideEffects{}, ControlFlowSideEffects{}, {LiteralKind::String}, [](
293
284
FunctionCall const & _call,
294
285
AbstractAssembly& _assembly,
295
286
BuiltinContext& _context
@@ -325,6 +316,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
325
316
SideEffects::Write, // memory
326
317
SideEffects::None // transientStorage
327
318
},
319
+ ControlFlowSideEffects::fromInstruction (evmasm::Instruction::CODECOPY),
328
320
{},
329
321
[](
330
322
FunctionCall const &,
@@ -349,6 +341,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
349
341
SideEffects::Write, // memory
350
342
SideEffects::None // transientStorage
351
343
},
344
+ ControlFlowSideEffects{},
352
345
{std::nullopt, LiteralKind::String, std::nullopt},
353
346
[](
354
347
FunctionCall const & _call,
@@ -365,6 +358,7 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
365
358
1 ,
366
359
1 ,
367
360
SideEffects{},
361
+ ControlFlowSideEffects{},
368
362
{LiteralKind::String},
369
363
[](
370
364
FunctionCall const & _call,
@@ -382,7 +376,8 @@ std::vector<std::optional<BuiltinFunctionForEVM>> createBuiltins(langutil::EVMVe
382
376
" auxdataloadn" ,
383
377
1 ,
384
378
1 ,
385
- SideEffects{},
379
+ EVMDialect::sideEffectsOfInstruction (evmasm::Instruction::DATALOADN),
380
+ ControlFlowSideEffects::fromInstruction (evmasm::Instruction::DATALOADN),
386
381
{LiteralKind::Number},
387
382
[](
388
383
FunctionCall const & _call,
@@ -531,6 +526,7 @@ BuiltinFunctionForEVM EVMDialect::createVerbatimFunction(size_t _arguments, size
531
526
1 + _arguments,
532
527
_returnVariables,
533
528
SideEffects::worst (),
529
+ ControlFlowSideEffects{},
534
530
std::vector<std::optional<LiteralKind>>{LiteralKind::String} + std::vector<std::optional<LiteralKind>>(_arguments),
535
531
[=](
536
532
FunctionCall const & _call,
0 commit comments