From 16e468460fab786ddcdff7944e993bd852166f25 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 6 May 2015 10:43:59 +0200 Subject: Structural gas estimator. --- CommandLineInterface.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'CommandLineInterface.cpp') diff --git a/CommandLineInterface.cpp b/CommandLineInterface.cpp index e6f03a2e..944c8f68 100644 --- a/CommandLineInterface.cpp +++ b/CommandLineInterface.cpp @@ -42,6 +42,7 @@ #include #include #include +#include using namespace std; namespace po = boost::program_options; @@ -464,6 +465,17 @@ void CommandLineInterface::handleAst(string const& _argStr) // do we need AST output? if (m_args.count(_argStr)) { + StructuralGasEstimator gasEstimator; + vector asts; + for (auto const& sourceCode: m_sourceCodes) + asts.push_back(&m_compiler->getAST(sourceCode.first)); + map gasCosts; + if (m_compiler->getRuntimeAssemblyItems()) + gasCosts = gasEstimator.breakToStatementLevel( + gasEstimator.performEstimation(*m_compiler->getRuntimeAssemblyItems(), asts), + asts + ); + auto choice = m_args[_argStr].as(); if (outputToStdout(choice)) { @@ -473,7 +485,11 @@ void CommandLineInterface::handleAst(string const& _argStr) cout << endl << "======= " << sourceCode.first << " =======" << endl; if (_argStr == g_argAstStr) { - ASTPrinter printer(m_compiler->getAST(sourceCode.first), sourceCode.second); + ASTPrinter printer( + m_compiler->getAST(sourceCode.first), + sourceCode.second, + gasCosts + ); printer.print(cout); } else -- cgit v1.2.3