| 1602 | } |
| 1603 | |
| 1604 | void CompilerStack::generateIR(ContractDefinition const& _contract, bool _unoptimizedOnly) |
| 1605 | { |
| 1606 | solAssert(m_stackState >= AnalysisSuccessful, ""); |
| 1607 | Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName()); |
| 1608 | if (compiledContract.yulIR) |
| 1609 | { |
| 1610 | solAssert(!compiledContract.yulIR->empty()); |
| 1611 | return; |
| 1612 | } |
| 1613 | |
| 1614 | if (!*_contract.sourceUnit().annotation().useABICoderV2) |
| 1615 | m_errorReporter.warning( |
| 1616 | 2066_error, |
| 1617 | _contract.location(), |
| 1618 | "Contract requests the ABI coder v1, which is incompatible with the IR. " |
| 1619 | "Using ABI coder v2 instead." |
| 1620 | ); |
| 1621 | |
| 1622 | std::string dependenciesSource; |
| 1623 | for (auto const& [dependency, referencee]: _contract.annotation().contractDependencies) |
| 1624 | generateIR(*dependency, _unoptimizedOnly); |
| 1625 | |
| 1626 | if (!_contract.canBeDeployed()) |
| 1627 | return; |
| 1628 | |
| 1629 | std::map<ContractDefinition const*, std::string_view const> otherYulSources; |
| 1630 | for (auto const& pair: m_contracts) |
| 1631 | otherYulSources.emplace(pair.second.contract, pair.second.yulIR ? *pair.second.yulIR : std::string_view{}); |
| 1632 | |
| 1633 | if (m_experimentalAnalysis) |
| 1634 | { |
| 1635 | experimental::IRGenerator generator( |
| 1636 | m_evmVersion, |
| 1637 | m_eofVersion, |
| 1638 | m_revertStrings, |
| 1639 | sourceIndices(), |
| 1640 | m_debugInfoSelection, |
| 1641 | this, |
| 1642 | *m_experimentalAnalysis |
| 1643 | ); |
| 1644 | compiledContract.yulIR = generator.run( |
| 1645 | _contract, |
| 1646 | {}, // TODO: createCBORMetadata(compiledContract, /* _forIR */ true), |
| 1647 | otherYulSources |
| 1648 | ); |
| 1649 | } |
| 1650 | else |
| 1651 | { |
| 1652 | IRGenerator generator( |
| 1653 | m_evmVersion, |
| 1654 | m_eofVersion, |
| 1655 | m_revertStrings, |
| 1656 | sourceIndices(), |
| 1657 | m_debugInfoSelection, |
| 1658 | this, |
| 1659 | m_optimiserSettings |
| 1660 | ); |
| 1661 | compiledContract.yulIR = generator.run( |
nothing calls this directly
no test coverage detected