| 574 | } |
| 575 | |
| 576 | evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabel( |
| 577 | Declaration const& _declaration, |
| 578 | CompilerContext& _context |
| 579 | ) |
| 580 | { |
| 581 | auto res = m_entryLabels.find(&_declaration); |
| 582 | if (res == m_entryLabels.end()) |
| 583 | { |
| 584 | size_t params = 0; |
| 585 | size_t returns = 0; |
| 586 | if (auto const* function = dynamic_cast<FunctionDefinition const*>(&_declaration)) |
| 587 | { |
| 588 | FunctionType functionType(*function, FunctionType::Kind::Internal); |
| 589 | params = CompilerUtils::sizeOnStack(functionType.parameterTypes()); |
| 590 | returns = CompilerUtils::sizeOnStack(functionType.returnParameterTypes()); |
| 591 | } |
| 592 | |
| 593 | // some name that cannot clash with yul function names. |
| 594 | std::string labelName = "@" + _declaration.name() + "_" + std::to_string(_declaration.id()); |
| 595 | evmasm::AssemblyItem tag = _context.namedTag( |
| 596 | labelName, |
| 597 | params, |
| 598 | returns, |
| 599 | _declaration.id() |
| 600 | ); |
| 601 | m_entryLabels.insert(std::make_pair(&_declaration, tag)); |
| 602 | m_functionsToCompile.push(&_declaration); |
| 603 | return tag.tag(); |
| 604 | } |
| 605 | else |
| 606 | return res->second.tag(); |
| 607 | |
| 608 | } |
| 609 | |
| 610 | evmasm::AssemblyItem CompilerContext::FunctionCompilationQueue::entryLabelIfExists(Declaration const& _declaration) const |
| 611 | { |