Skip to content

Commit

Permalink
iiiiiiiiiiii
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlt committed Apr 18, 2024
1 parent 3c676d3 commit e953eca
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/libyul/YulOptimizerAssemblyTest.cpp
Expand Up @@ -97,13 +97,30 @@ TestCase::TestResult YulOptimizerAssemblyTest::run(std::ostream& _stream, std::s
}

m_obtainedResult = "step: " + m_optimizerStep + "\n\n" + printed + "\n";

OptimiserSettings settings = OptimiserSettings::none();
YulStack stack(
EVMVersion{},
std::nullopt,
YulStack::Language::StrictAssembly,
settings,
DebugInfoSelection::All()
);
if (!stack.parseAndAnalyze("", printed))
{
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << std::endl;
SourceReferenceFormatter{_stream, stack, true, false}
.printErrorInformation(stack.errors());
return TestResult::FatalError;
}

evmasm::Assembly assembly{solidity::test::CommonOptions::get().evmVersion(), false, {}};
EthAssemblyAdapter adapter(assembly);
EVMObjectCompiler::compile(
*m_object,
*stack.parserResult(),
adapter,
EVMDialect::strictAssemblyForEVMObjects(EVMVersion{}),
true,
settings.optimizeStackAllocation,
std::nullopt
);

Expand Down
37 changes: 37 additions & 0 deletions test/libyul/yulOptimizerAssemblyTests/blockFlattener/basic.yul
Expand Up @@ -23,3 +23,40 @@
// let z := mload(2)
// }
// }
//
// Assembly:
// /* "":32:33 */
// 0x00
// /* "":26:34 */
// mload
// /* "":60:61 */
// 0x01
// /* "":54:62 */
// mload
// /* "":71:78 */
// 0x00
// /* "":100:103 */
// dup2
// /* "":94:104 */
// mload
// /* "":87:104 */
// swap2
// pop
// /* "":129:143 */
// calldatasize
// /* "":124:127 */
// dup3
// /* "":120:144 */
// add
// /* "":113:144 */
// swap1
// pop
// /* "":168:169 */
// 0x02
// /* "":162:170 */
// mload
// /* "":6:176 */
// pop
// pop
// pop
// pop

0 comments on commit e953eca

Please sign in to comment.