aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2014-05-28 00:51:10 +0800
committerGav Wood <i@gavwood.com>2014-05-28 00:51:10 +0800
commitd48033009a04d09a8066e7a90d42ccd8dac38358 (patch)
tree15456b66c50c25d852aeeada1fb1dfaa9dd472fa
parent36370900bb74d8be916178c39997a260ea37009f (diff)
downloaddexon-solidity-d48033009a04d09a8066e7a90d42ccd8dac38358.tar.gz
dexon-solidity-d48033009a04d09a8066e7a90d42ccd8dac38358.tar.zst
dexon-solidity-d48033009a04d09a8066e7a90d42ccd8dac38358.zip
Pinhole optimise working fairly well...
-rw-r--r--main.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.cpp b/main.cpp
index f9ef4197..bfe51b35 100644
--- a/main.cpp
+++ b/main.cpp
@@ -55,6 +55,7 @@ enum Mode { Binary, Hex, Assembly, ParseTree };
int main(int argc, char** argv)
{
+ unsigned optimise = 1;
string infile;
Mode mode = Hex;
@@ -71,6 +72,8 @@ int main(int argc, char** argv)
mode = Assembly;
else if (arg == "-t" || arg == "--parse-tree")
mode = ParseTree;
+ else if ((arg == "-o" || arg == "--optimise") && argc > i + 1)
+ optimise = atoi(argv[++i]);
else if (arg == "-V" || arg == "--version")
version();
else
@@ -95,7 +98,7 @@ int main(int argc, char** argv)
cerr << "Empty file." << endl;
else if (mode == Binary || mode == Hex)
{
- auto bs = compileLLL(src, &errors);
+ auto bs = compileLLL(src, optimise ? true : false, &errors);
if (mode == Hex)
cout << toHex(bs) << endl;
else if (mode == Binary)
@@ -104,7 +107,7 @@ int main(int argc, char** argv)
else if (mode == ParseTree)
cout << parseLLL(src) << endl;
else if (mode == Assembly)
- cout << compileLLLToAsm(src, &errors) << endl;
+ cout << compileLLLToAsm(src, optimise ? true : false, &errors) << endl;
for (auto const& i: errors)
cerr << i << endl;