MCPcopy Create free account
hub / github.com/argotorg/solidity / build

Method build

libyul/backends/evm/ControlFlowGraphBuilder.cpp:229–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229std::unique_ptr<CFG> ControlFlowGraphBuilder::build(
230 AsmAnalysisInfo const& _analysisInfo,
231 Dialect const& _dialect,
232 Block const& _block
233)
234{
235 std::optional<uint8_t> eofVersion;
236 if (EVMDialect const* evmDialect = dynamic_cast<EVMDialect const*>(&_dialect))
237 eofVersion = evmDialect->eofVersion();
238
239 auto result = std::make_unique<CFG>();
240 result->entry = &result->makeBlock(debugDataOf(_block));
241
242 ControlFlowSideEffectsCollector sideEffects(_dialect, _block);
243 ControlFlowGraphBuilder builder(*result, _analysisInfo, sideEffects.functionSideEffects(), _dialect);
244 builder.m_currentBlock = result->entry;
245 builder(_block);
246
247 cleanUnreachable(*result);
248 markRecursiveCalls(*result);
249 markStartsOfSubGraphs(*result);
250 markNeedsCleanStack(*result);
251
252 // TODO: It might be worthwhile to run some further simplifications on the graph itself here.
253 // E.g. if there is a jump to a node that has the jumping node as its only entry, the nodes can be fused, etc.
254
255 return result;
256}
257
258ControlFlowGraphBuilder::ControlFlowGraphBuilder(
259 CFG& _graph,

Callers

nothing calls this directly

Calls 7

debugDataOfFunction · 0.85
cleanUnreachableFunction · 0.85
markRecursiveCallsFunction · 0.85
markStartsOfSubGraphsFunction · 0.85
markNeedsCleanStackFunction · 0.85
makeBlockMethod · 0.80
eofVersionMethod · 0.45

Tested by

no test coverage detected