From 8ca0ae99ac3d908e96daf84a3656adec1893fbae Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 26 May 2014 11:22:19 +0200 Subject: Major reorganisation. New libs (libethsupport, libevm, liblll). New LLLC binary. --- CMakeLists.txt | 56 ++++++++++++++++++++++++++++++ main.cpp | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..ff5d672d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,56 @@ +cmake_policy(SET CMP0015 NEW) + +aux_source_directory(. SRC_LIST) + +include_directories(..) +#link_directories(../libethsupport) +#link_directories(../libethcore) +#link_directories(../liblll) + +set(EXECUTABLE lllc) + +add_executable(${EXECUTABLE} ${SRC_LIST}) + +if (JSONRPC_LS) + add_definitions(-DETH_JSONRPC) + include_directories(${JSONRPC_ID}) + target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) +endif () + +if (READLINE_LS) + add_definitions(-DETH_READLINE) + include_directories(${READLINE_ID}) + target_link_libraries(${EXECUTABLE} ${READLINE_LS}) +endif () + +if (${TARGET_PLATFORM} STREQUAL "w64") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") + target_link_libraries(${EXECUTABLE} gcc) + target_link_libraries(${EXECUTABLE} gdi32) + target_link_libraries(${EXECUTABLE} ws2_32) + target_link_libraries(${EXECUTABLE} mswsock) + target_link_libraries(${EXECUTABLE} shlwapi) + target_link_libraries(${EXECUTABLE} iphlpapi) + target_link_libraries(${EXECUTABLE} cryptopp) + target_link_libraries(${EXECUTABLE} boost_system-mt-s) + target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) + target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) + set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) +elseif (UNIX) +else () + target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LIBRARIES}) + target_link_libraries(${EXECUTABLE} boost_system) + target_link_libraries(${EXECUTABLE} boost_filesystem) + find_package(Threads REQUIRED) + target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) +endif () + +target_link_libraries(${EXECUTABLE} lll) +target_link_libraries(${EXECUTABLE} ethcore) +target_link_libraries(${EXECUTABLE} ethsupport) +target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) +target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) +target_link_libraries(${EXECUTABLE} gmp) + +install( TARGETS ${EXECUTABLE} DESTINATION bin ) + diff --git a/main.cpp b/main.cpp new file mode 100644 index 00000000..1afc3ef6 --- /dev/null +++ b/main.cpp @@ -0,0 +1,106 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file main.cpp + * @author Gav Wood + * @date 2014 + * Ethereum client. + */ + +#include +#include +#include +#include +#include +#include "BuildInfo.h" +using namespace std; +using namespace eth; + +void help() +{ + cout + << "Usage lllc [OPTIONS] " << endl + << "Options:" << endl + << " -h,--help Show this help message and exit." << endl + << " -V,--version Show the version and exit." << endl; + exit(0); +} + +void version() +{ + cout << "LLLC, the Lovely Little Language Compiler " << ETH_QUOTED(ETH_VERSION) << endl; + cout << " By Gav Wood, (c) 2014." << endl; + cout << "Build: " << ETH_QUOTED(ETH_BUILD_PLATFORM) << "/" << ETH_QUOTED(ETH_BUILD_TYPE) << endl; + exit(0); +} + +enum Mode { Binary, Hex, ParseTree }; + +int main(int argc, char** argv) +{ + string infile; + Mode mode = Hex; + + for (int i = 1; i < argc; ++i) + { + string arg = argv[i]; + if (arg == "-h" || arg == "--help") + help(); + else if (arg == "-b" || arg == "--binary") + mode = Binary; + else if (arg == "-h" || arg == "--hex") + mode = Hex; + else if (arg == "-t" || arg == "--parse-tree") + mode = ParseTree; + else if (arg == "-V" || arg == "--version") + version(); + else + infile = argv[i]; + } + + string src; + if (infile.empty()) + { + string s; + while (!cin.eof()) + { + getline(cin, s); + src.append(s); + } + } + else + src = asString(contents(infile)); + + if (src.empty()) + cerr << "Empty file." << endl; + else if (mode == Binary || mode == Hex) + { + vector errors; + auto bs = compileLLL(src, &errors); + if (mode == Hex) + cout << toHex(bs) << endl; + else if (mode == Binary) + cout.write((char const*)bs.data(), bs.size()); + for (auto const& i: errors) + cerr << i << endl; + } + else if (mode == ParseTree) + { + cout << parseLLL(src) << endl; + } + + return 0; +} -- cgit From 34c3d06883269e0d36e228e00c68dce141750b5b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 26 May 2014 11:34:43 +0200 Subject: Ever more repotting. --- main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 1afc3ef6..edad99a0 100644 --- a/main.cpp +++ b/main.cpp @@ -34,8 +34,12 @@ void help() cout << "Usage lllc [OPTIONS] " << endl << "Options:" << endl - << " -h,--help Show this help message and exit." << endl - << " -V,--version Show the version and exit." << endl; + << " -b,--binary Parse, compile and assemble; output byte code in binary." << endl + << " -x,--hex Parse, compile and assemble; output byte code in hex." << endl +// << " -a,--assembly Only parse and compile; show assembly." << endl + << " -t,--parse-tree Only parse; show parse tree." << endl + << " -h,--help Show this help message and exit." << endl + << " -V,--version Show the version and exit." << endl; exit(0); } @@ -61,7 +65,7 @@ int main(int argc, char** argv) help(); else if (arg == "-b" || arg == "--binary") mode = Binary; - else if (arg == "-h" || arg == "--hex") + else if (arg == "-x" || arg == "--hex") mode = Hex; else if (arg == "-t" || arg == "--parse-tree") mode = ParseTree; -- cgit From 36370900bb74d8be916178c39997a260ea37009f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 26 May 2014 19:41:46 +0200 Subject: New Assembler. --- main.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index edad99a0..f9ef4197 100644 --- a/main.cpp +++ b/main.cpp @@ -36,7 +36,7 @@ void help() << "Options:" << endl << " -b,--binary Parse, compile and assemble; output byte code in binary." << endl << " -x,--hex Parse, compile and assemble; output byte code in hex." << endl -// << " -a,--assembly Only parse and compile; show assembly." << endl + << " -a,--assembly Only parse and compile; show assembly." << endl << " -t,--parse-tree Only parse; show parse tree." << endl << " -h,--help Show this help message and exit." << endl << " -V,--version Show the version and exit." << endl; @@ -51,7 +51,7 @@ void version() exit(0); } -enum Mode { Binary, Hex, ParseTree }; +enum Mode { Binary, Hex, Assembly, ParseTree }; int main(int argc, char** argv) { @@ -67,6 +67,8 @@ int main(int argc, char** argv) mode = Binary; else if (arg == "-x" || arg == "--hex") mode = Hex; + else if (arg == "-a" || arg == "--assembly") + mode = Assembly; else if (arg == "-t" || arg == "--parse-tree") mode = ParseTree; else if (arg == "-V" || arg == "--version") @@ -88,23 +90,23 @@ int main(int argc, char** argv) else src = asString(contents(infile)); + vector errors; if (src.empty()) cerr << "Empty file." << endl; else if (mode == Binary || mode == Hex) { - vector errors; auto bs = compileLLL(src, &errors); if (mode == Hex) cout << toHex(bs) << endl; else if (mode == Binary) cout.write((char const*)bs.data(), bs.size()); - for (auto const& i: errors) - cerr << i << endl; } else if (mode == ParseTree) - { cout << parseLLL(src) << endl; - } + else if (mode == Assembly) + cout << compileLLLToAsm(src, &errors) << endl; + for (auto const& i: errors) + cerr << i << endl; return 0; } -- cgit From d48033009a04d09a8066e7a90d42ccd8dac38358 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 27 May 2014 18:51:10 +0200 Subject: Pinhole optimise working fairly well... --- main.cpp | 7 +++++-- 1 file 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; -- cgit From f781485d28d85de05904deec393956c58c6fca49 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 28 May 2014 16:28:41 +0200 Subject: Tests updated. Fixes to executive logging. Trie testing made considerably more rigourous. --- main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index bfe51b35..e304cb5c 100644 --- a/main.cpp +++ b/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "BuildInfo.h" using namespace std; using namespace eth; @@ -51,7 +52,7 @@ void version() exit(0); } -enum Mode { Binary, Hex, Assembly, ParseTree }; +enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble }; int main(int argc, char** argv) { @@ -74,6 +75,8 @@ int main(int argc, char** argv) mode = ParseTree; else if ((arg == "-o" || arg == "--optimise") && argc > i + 1) optimise = atoi(argv[++i]); + else if (arg == "-d" || arg == "--disassemble") + mode = Disassemble; else if (arg == "-V" || arg == "--version") version(); else @@ -96,6 +99,10 @@ int main(int argc, char** argv) vector errors; if (src.empty()) cerr << "Empty file." << endl; + else if (mode == Disassemble) + { + cout << disassemble(fromHex(src)) << endl; + } else if (mode == Binary || mode == Hex) { auto bs = compileLLL(src, optimise ? true : false, &errors); -- cgit From f996766314e2680ca83b001621d3f59ad6db4d0f Mon Sep 17 00:00:00 2001 From: Nico Cesar Date: Wed, 4 Jun 2014 21:27:29 -0400 Subject: make life easier for Makefiles --- main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index e304cb5c..be4ea8c0 100644 --- a/main.cpp +++ b/main.cpp @@ -98,7 +98,7 @@ int main(int argc, char** argv) vector errors; if (src.empty()) - cerr << "Empty file." << endl; + errors.push_back("Empty file."); else if (mode == Disassemble) { cout << disassemble(fromHex(src)) << endl; @@ -117,6 +117,7 @@ int main(int argc, char** argv) cout << compileLLLToAsm(src, optimise ? true : false, &errors) << endl; for (auto const& i: errors) cerr << i << endl; - + if ( errors.size() ) + return 1; return 0; } -- cgit From 320350e0192d2546cce9350e9334042c8c88ee53 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Wed, 11 Jun 2014 11:31:56 +0100 Subject: Protocol 20 changes. Added my new address to the premine. --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index be4ea8c0..020d137b 100644 --- a/main.cpp +++ b/main.cpp @@ -46,7 +46,7 @@ void help() void version() { - cout << "LLLC, the Lovely Little Language Compiler " << ETH_QUOTED(ETH_VERSION) << endl; + cout << "LLLC, the Lovely Little Language Compiler " << eth::EthVersion << endl; cout << " By Gav Wood, (c) 2014." << endl; cout << "Build: " << ETH_QUOTED(ETH_BUILD_PLATFORM) << "/" << ETH_QUOTED(ETH_BUILD_TYPE) << endl; exit(0); -- cgit From 7830e2acfd6ca347046c84c042ec47da8bb5d343 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 27 Jun 2014 23:47:24 +0200 Subject: Project refactor. Introduce the Serpent library. --- CMakeLists.txt | 4 ---- main.cpp | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff5d672d..1188f1b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,6 @@ cmake_policy(SET CMP0015 NEW) aux_source_directory(. SRC_LIST) include_directories(..) -#link_directories(../libethsupport) -#link_directories(../libethcore) -#link_directories(../liblll) set(EXECUTABLE lllc) @@ -47,7 +44,6 @@ endif () target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} ethcore) -target_link_libraries(${EXECUTABLE} ethsupport) target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) target_link_libraries(${EXECUTABLE} gmp) diff --git a/main.cpp b/main.cpp index 020d137b..22d40d2d 100644 --- a/main.cpp +++ b/main.cpp @@ -23,9 +23,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "BuildInfo.h" using namespace std; using namespace eth; -- cgit From f92fdf328c195dfa6a1f8cc5135bd6295f586b2d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 28 Jun 2014 19:23:32 +0200 Subject: Full python serpent support. Shared libs on all platforms. --- CMakeLists.txt | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1188f1b5..2146c192 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,18 +8,6 @@ set(EXECUTABLE lllc) add_executable(${EXECUTABLE} ${SRC_LIST}) -if (JSONRPC_LS) - add_definitions(-DETH_JSONRPC) - include_directories(${JSONRPC_ID}) - target_link_libraries(${EXECUTABLE} ${JSONRPC_LS}) -endif () - -if (READLINE_LS) - add_definitions(-DETH_READLINE) - include_directories(${READLINE_ID}) - target_link_libraries(${EXECUTABLE} ${READLINE_LS}) -endif () - if (${TARGET_PLATFORM} STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) @@ -28,24 +16,17 @@ if (${TARGET_PLATFORM} STREQUAL "w64") target_link_libraries(${EXECUTABLE} mswsock) target_link_libraries(${EXECUTABLE} shlwapi) target_link_libraries(${EXECUTABLE} iphlpapi) - target_link_libraries(${EXECUTABLE} cryptopp) - target_link_libraries(${EXECUTABLE} boost_system-mt-s) - target_link_libraries(${EXECUTABLE} boost_filesystem-mt-s) target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) elseif (UNIX) else () - target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LIBRARIES}) - target_link_libraries(${EXECUTABLE} boost_system) - target_link_libraries(${EXECUTABLE} boost_filesystem) find_package(Threads REQUIRED) target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) endif () target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} ethcore) -target_link_libraries(${EXECUTABLE} ${MINIUPNPC_LS}) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LS}) +target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} ethential) target_link_libraries(${EXECUTABLE} gmp) install( TARGETS ${EXECUTABLE} DESTINATION bin ) -- cgit From 2ffbe1c5c8432ef16dea10625f778d8d0f19e0e4 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Thu, 3 Jul 2014 15:00:22 +0200 Subject: Windows build coersions. --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2146c192..49e71707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,10 @@ set(EXECUTABLE lllc) add_executable(${EXECUTABLE} ${SRC_LIST}) +target_link_libraries(${EXECUTABLE} lll) +target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} ethential) + if (${TARGET_PLATFORM} STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) @@ -24,10 +28,5 @@ else () target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) endif () -target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) -target_link_libraries(${EXECUTABLE} gmp) - install( TARGETS ${EXECUTABLE} DESTINATION bin ) -- cgit From 5c559038083caf3d145277773c0f3715e94d3d3c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 6 Jul 2014 13:13:37 +0200 Subject: Build fixes. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 49e71707..97eaea7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) target_link_libraries(${EXECUTABLE} ethential) -if (${TARGET_PLATFORM} STREQUAL "w64") +if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") target_link_libraries(${EXECUTABLE} gcc) target_link_libraries(${EXECUTABLE} gdi32) -- cgit From 37def1ca62d84084063b16e2fe860e70f7260156 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 5 Sep 2014 17:09:58 +0200 Subject: Project-wide reorganisation of namespaces. --- main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 22d40d2d..ccdf5a11 100644 --- a/main.cpp +++ b/main.cpp @@ -28,7 +28,8 @@ #include #include "BuildInfo.h" using namespace std; -using namespace eth; +using namespace dev; +using namespace dev::eth; void help() { @@ -46,9 +47,9 @@ void help() void version() { - cout << "LLLC, the Lovely Little Language Compiler " << eth::EthVersion << endl; + cout << "LLLC, the Lovely Little Language Compiler " << dev::Version << endl; cout << " By Gav Wood, (c) 2014." << endl; - cout << "Build: " << ETH_QUOTED(ETH_BUILD_PLATFORM) << "/" << ETH_QUOTED(ETH_BUILD_TYPE) << endl; + cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl; exit(0); } -- cgit From c52b98edda0b7ed66376cd601c028c71db0ac88c Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 5 Sep 2014 18:24:29 +0200 Subject: Split ethcore off into devcrypto ready for Whisper's crypto and repot namespace. Rename ethential to devcore. --- CMakeLists.txt | 2 +- main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97eaea7a..9d5e8c5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmface) -target_link_libraries(${EXECUTABLE} ethential) +target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") diff --git a/main.cpp b/main.cpp index ccdf5a11..a4c9df78 100644 --- a/main.cpp +++ b/main.cpp @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include #include "BuildInfo.h" using namespace std; -- cgit From 239afeaffd361a62016ed71268a632e4f71d0477 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 6 Nov 2014 14:50:18 +0100 Subject: Moved instructions and assembly to new libevmcore. --- CMakeLists.txt | 2 +- main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d5e8c5f..a9b53c74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(EXECUTABLE lllc) add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/main.cpp b/main.cpp index a4c9df78..1a44ee95 100644 --- a/main.cpp +++ b/main.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "BuildInfo.h" using namespace std; using namespace dev; -- cgit From ef17bc3d8f7dc29b487ca7e30800cf782a7f7aa9 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Thu, 4 Dec 2014 09:55:54 +0100 Subject: removed automocs --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a9b53c74..3310354f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_policy(SET CMP0015 NEW) +set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) -- cgit From 6d0ed4c891fb096016210f82852db7439099980d Mon Sep 17 00:00:00 2001 From: debris Date: Fri, 5 Dec 2014 16:40:41 +0100 Subject: lll, buildinfo.h and llc compiling on windows --- CMakeLists.txt | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3310354f..0ca19fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,31 +3,22 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) +include_directories(${Boost_INCLUDE_DIRS}) include_directories(..) set(EXECUTABLE lllc) -add_executable(${EXECUTABLE} ${SRC_LIST}) +if(ETH_STATIC) + add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS}) +else() + add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS}) +endif() + +add_dependencies(${EXECUTABLE} BuildInfo.h) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) -if ("${TARGET_PLATFORM}" STREQUAL "w64") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") - target_link_libraries(${EXECUTABLE} gcc) - target_link_libraries(${EXECUTABLE} gdi32) - target_link_libraries(${EXECUTABLE} ws2_32) - target_link_libraries(${EXECUTABLE} mswsock) - target_link_libraries(${EXECUTABLE} shlwapi) - target_link_libraries(${EXECUTABLE} iphlpapi) - target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) -elseif (UNIX) -else () - find_package(Threads REQUIRED) - target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) -endif () - install( TARGETS ${EXECUTABLE} DESTINATION bin ) -- cgit From 49aa83403f1d09ac608548f5afd3dbab31397451 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 7 Dec 2014 11:29:38 +0100 Subject: solidity compiling under msvc && boosts cmake file fixed --- CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ca19fab..9549f89e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,12 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) -include_directories(${Boost_INCLUDE_DIRS}) include_directories(..) set(EXECUTABLE lllc) -if(ETH_STATIC) - add_library(${EXECUTABLE} STATIC ${SRC_LIST} ${HEADERS}) -else() - add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS}) -endif() +file(GLOB HEADERS "*.h") +add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) -- cgit From c0c2b2399e893a2ae196658fac0918eba0e62426 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 7 Dec 2014 19:55:40 +0100 Subject: serpent compiling under msvc --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9549f89e..2e76aa6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) +include_directories(${Boost_INCLUDE_DIRS}) include_directories(..) set(EXECUTABLE lllc) -- cgit From a5ce7dc28bd5ca69e2cc41fddcf9287a35283e53 Mon Sep 17 00:00:00 2001 From: debris Date: Sun, 8 Feb 2015 21:56:15 +0100 Subject: cmake mess --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e76aa6f..f41584e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) +target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) -- cgit From 037474713a40f88c508fbbddaa48be0c77a78dd4 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 11 Feb 2015 11:41:56 +0100 Subject: fixed transitive dependencies for msvc --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f41584e0..2e76aa6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${Boost_DATE_TIME_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${Boost_CHRONO_LIBRARIES}) target_link_libraries(${EXECUTABLE} lll) target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) -- cgit From ef5dce950dbe92642e0563537bf114e99fa79441 Mon Sep 17 00:00:00 2001 From: debris Date: Wed, 11 Feb 2015 16:47:56 +0100 Subject: fixed cmake include_directories --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e76aa6f..5aaca0cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) include_directories(${Boost_INCLUDE_DIRS}) +include_directories(${JSONCPP_INCLUDE_DIRS}) include_directories(..) set(EXECUTABLE lllc) -- cgit From 76253901e9c2722f58ceb25f5293630f8538dd92 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Fri, 13 Feb 2015 09:03:03 +0100 Subject: fixed issue with including wrong json/json.h file --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aaca0cc..2157fea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,9 +3,9 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) -include_directories(${Boost_INCLUDE_DIRS}) -include_directories(${JSONCPP_INCLUDE_DIRS}) include_directories(..) +include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) +include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE lllc) -- cgit From d5a2cf6491466c29891a572302ce76f11ee2a764 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Mon, 16 Feb 2015 13:48:25 +0100 Subject: fixed #1022 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2157fea7..4fdbdb85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) -include_directories(..) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) +include_directories(BEFORE ..) include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE lllc) -- cgit From f7a09848f73d23c3732bf9a7ca72d95e6d50ccb5 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 20 Feb 2015 21:59:21 +0100 Subject: Add EVMJIT. --- CMakeLists.txt | 22 ---------- main.cpp | 124 --------------------------------------------------------- 2 files changed, 146 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 4fdbdb85..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_policy(SET CMP0015 NEW) -set(CMAKE_AUTOMOC OFF) - -aux_source_directory(. SRC_LIST) - -include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) -include_directories(BEFORE ..) -include_directories(${Boost_INCLUDE_DIRS}) - -set(EXECUTABLE lllc) - -file(GLOB HEADERS "*.h") -add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -add_dependencies(${EXECUTABLE} BuildInfo.h) - -target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmcore) -target_link_libraries(${EXECUTABLE} devcore) - -install( TARGETS ${EXECUTABLE} DESTINATION bin ) - diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 1a44ee95..00000000 --- a/main.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file main.cpp - * @author Gav Wood - * @date 2014 - * Ethereum client. - */ - -#include -#include -#include -#include -#include -#include -#include "BuildInfo.h" -using namespace std; -using namespace dev; -using namespace dev::eth; - -void help() -{ - cout - << "Usage lllc [OPTIONS] " << endl - << "Options:" << endl - << " -b,--binary Parse, compile and assemble; output byte code in binary." << endl - << " -x,--hex Parse, compile and assemble; output byte code in hex." << endl - << " -a,--assembly Only parse and compile; show assembly." << endl - << " -t,--parse-tree Only parse; show parse tree." << endl - << " -h,--help Show this help message and exit." << endl - << " -V,--version Show the version and exit." << endl; - exit(0); -} - -void version() -{ - cout << "LLLC, the Lovely Little Language Compiler " << dev::Version << endl; - cout << " By Gav Wood, (c) 2014." << endl; - cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl; - exit(0); -} - -enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble }; - -int main(int argc, char** argv) -{ - unsigned optimise = 1; - string infile; - Mode mode = Hex; - - for (int i = 1; i < argc; ++i) - { - string arg = argv[i]; - if (arg == "-h" || arg == "--help") - help(); - else if (arg == "-b" || arg == "--binary") - mode = Binary; - else if (arg == "-x" || arg == "--hex") - mode = Hex; - else if (arg == "-a" || arg == "--assembly") - 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 == "-d" || arg == "--disassemble") - mode = Disassemble; - else if (arg == "-V" || arg == "--version") - version(); - else - infile = argv[i]; - } - - string src; - if (infile.empty()) - { - string s; - while (!cin.eof()) - { - getline(cin, s); - src.append(s); - } - } - else - src = asString(contents(infile)); - - vector errors; - if (src.empty()) - errors.push_back("Empty file."); - else if (mode == Disassemble) - { - cout << disassemble(fromHex(src)) << endl; - } - else if (mode == Binary || mode == Hex) - { - auto bs = compileLLL(src, optimise ? true : false, &errors); - if (mode == Hex) - cout << toHex(bs) << endl; - else if (mode == Binary) - cout.write((char const*)bs.data(), bs.size()); - } - else if (mode == ParseTree) - cout << parseLLL(src) << endl; - else if (mode == Assembly) - cout << compileLLLToAsm(src, optimise ? true : false, &errors) << endl; - for (auto const& i: errors) - cerr << i << endl; - if ( errors.size() ) - return 1; - return 0; -} -- cgit From 52ae5ab4ba5fb40f4f644a13606bf44d3e2aba77 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 14:58:03 +0200 Subject: Some changes in libdevcore. --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 1a44ee95..e1a61f49 100644 --- a/main.cpp +++ b/main.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) } } else - src = asString(contents(infile)); + src = contentsString(infile); vector errors; if (src.empty()) -- cgit From b4fb77cf732e50b041a994914bdbc0692e433d8a Mon Sep 17 00:00:00 2001 From: debris Date: Mon, 7 Sep 2015 14:32:06 +0200 Subject: split pr changes --- CMakeLists.txt | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fdbdb85..3a5b9c55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,11 @@ -cmake_policy(SET CMP0015 NEW) -set(CMAKE_AUTOMOC OFF) - aux_source_directory(. SRC_LIST) -include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) -include_directories(BEFORE ..) -include_directories(${Boost_INCLUDE_DIRS}) - set(EXECUTABLE lllc) file(GLOB HEADERS "*.h") add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -add_dependencies(${EXECUTABLE} BuildInfo.h) - -target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmcore) -target_link_libraries(${EXECUTABLE} devcore) +eth_use(${EXECUTABLE} REQUIRED Eth::lll Dev::buildinfo) install( TARGETS ${EXECUTABLE} DESTINATION bin ) -- cgit From 98a4e6be1879ad79dc66908bd292be1192a5df6f Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 16 Sep 2015 15:50:36 +0200 Subject: per project versioning --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index e1a61f49..5f3078c2 100644 --- a/main.cpp +++ b/main.cpp @@ -26,7 +26,7 @@ #include #include #include -#include "BuildInfo.h" +#include "ethereum/BuildInfo.h" using namespace std; using namespace dev; using namespace dev::eth; -- cgit From 3272f940cb216f826009c74c648b37a42bd44d06 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 21 Mar 2016 15:04:34 +0300 Subject: move lllc --- CMakeLists.txt | 11 ----- lllc/CMakeLists.txt | 11 +++++ lllc/main.cpp | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++ main.cpp | 124 ---------------------------------------------------- 4 files changed, 135 insertions(+), 135 deletions(-) delete mode 100644 CMakeLists.txt create mode 100644 lllc/CMakeLists.txt create mode 100644 lllc/main.cpp delete mode 100644 main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 3a5b9c55..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -aux_source_directory(. SRC_LIST) - -set(EXECUTABLE lllc) - -file(GLOB HEADERS "*.h") -add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) - -eth_use(${EXECUTABLE} REQUIRED Eth::lll Dev::buildinfo) - -install( TARGETS ${EXECUTABLE} DESTINATION bin ) - diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt new file mode 100644 index 00000000..3a5b9c55 --- /dev/null +++ b/lllc/CMakeLists.txt @@ -0,0 +1,11 @@ +aux_source_directory(. SRC_LIST) + +set(EXECUTABLE lllc) + +file(GLOB HEADERS "*.h") +add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) + +eth_use(${EXECUTABLE} REQUIRED Eth::lll Dev::buildinfo) + +install( TARGETS ${EXECUTABLE} DESTINATION bin ) + diff --git a/lllc/main.cpp b/lllc/main.cpp new file mode 100644 index 00000000..5f3078c2 --- /dev/null +++ b/lllc/main.cpp @@ -0,0 +1,124 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file main.cpp + * @author Gav Wood + * @date 2014 + * Ethereum client. + */ + +#include +#include +#include +#include +#include +#include +#include "ethereum/BuildInfo.h" +using namespace std; +using namespace dev; +using namespace dev::eth; + +void help() +{ + cout + << "Usage lllc [OPTIONS] " << endl + << "Options:" << endl + << " -b,--binary Parse, compile and assemble; output byte code in binary." << endl + << " -x,--hex Parse, compile and assemble; output byte code in hex." << endl + << " -a,--assembly Only parse and compile; show assembly." << endl + << " -t,--parse-tree Only parse; show parse tree." << endl + << " -h,--help Show this help message and exit." << endl + << " -V,--version Show the version and exit." << endl; + exit(0); +} + +void version() +{ + cout << "LLLC, the Lovely Little Language Compiler " << dev::Version << endl; + cout << " By Gav Wood, (c) 2014." << endl; + cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl; + exit(0); +} + +enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble }; + +int main(int argc, char** argv) +{ + unsigned optimise = 1; + string infile; + Mode mode = Hex; + + for (int i = 1; i < argc; ++i) + { + string arg = argv[i]; + if (arg == "-h" || arg == "--help") + help(); + else if (arg == "-b" || arg == "--binary") + mode = Binary; + else if (arg == "-x" || arg == "--hex") + mode = Hex; + else if (arg == "-a" || arg == "--assembly") + 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 == "-d" || arg == "--disassemble") + mode = Disassemble; + else if (arg == "-V" || arg == "--version") + version(); + else + infile = argv[i]; + } + + string src; + if (infile.empty()) + { + string s; + while (!cin.eof()) + { + getline(cin, s); + src.append(s); + } + } + else + src = contentsString(infile); + + vector errors; + if (src.empty()) + errors.push_back("Empty file."); + else if (mode == Disassemble) + { + cout << disassemble(fromHex(src)) << endl; + } + else if (mode == Binary || mode == Hex) + { + auto bs = compileLLL(src, optimise ? true : false, &errors); + if (mode == Hex) + cout << toHex(bs) << endl; + else if (mode == Binary) + cout.write((char const*)bs.data(), bs.size()); + } + else if (mode == ParseTree) + cout << parseLLL(src) << endl; + else if (mode == Assembly) + cout << compileLLLToAsm(src, optimise ? true : false, &errors) << endl; + for (auto const& i: errors) + cerr << i << endl; + if ( errors.size() ) + return 1; + return 0; +} diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 5f3078c2..00000000 --- a/main.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - This file is part of cpp-ethereum. - - cpp-ethereum is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - cpp-ethereum is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . -*/ -/** @file main.cpp - * @author Gav Wood - * @date 2014 - * Ethereum client. - */ - -#include -#include -#include -#include -#include -#include -#include "ethereum/BuildInfo.h" -using namespace std; -using namespace dev; -using namespace dev::eth; - -void help() -{ - cout - << "Usage lllc [OPTIONS] " << endl - << "Options:" << endl - << " -b,--binary Parse, compile and assemble; output byte code in binary." << endl - << " -x,--hex Parse, compile and assemble; output byte code in hex." << endl - << " -a,--assembly Only parse and compile; show assembly." << endl - << " -t,--parse-tree Only parse; show parse tree." << endl - << " -h,--help Show this help message and exit." << endl - << " -V,--version Show the version and exit." << endl; - exit(0); -} - -void version() -{ - cout << "LLLC, the Lovely Little Language Compiler " << dev::Version << endl; - cout << " By Gav Wood, (c) 2014." << endl; - cout << "Build: " << DEV_QUOTED(ETH_BUILD_PLATFORM) << "/" << DEV_QUOTED(ETH_BUILD_TYPE) << endl; - exit(0); -} - -enum Mode { Binary, Hex, Assembly, ParseTree, Disassemble }; - -int main(int argc, char** argv) -{ - unsigned optimise = 1; - string infile; - Mode mode = Hex; - - for (int i = 1; i < argc; ++i) - { - string arg = argv[i]; - if (arg == "-h" || arg == "--help") - help(); - else if (arg == "-b" || arg == "--binary") - mode = Binary; - else if (arg == "-x" || arg == "--hex") - mode = Hex; - else if (arg == "-a" || arg == "--assembly") - 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 == "-d" || arg == "--disassemble") - mode = Disassemble; - else if (arg == "-V" || arg == "--version") - version(); - else - infile = argv[i]; - } - - string src; - if (infile.empty()) - { - string s; - while (!cin.eof()) - { - getline(cin, s); - src.append(s); - } - } - else - src = contentsString(infile); - - vector errors; - if (src.empty()) - errors.push_back("Empty file."); - else if (mode == Disassemble) - { - cout << disassemble(fromHex(src)) << endl; - } - else if (mode == Binary || mode == Hex) - { - auto bs = compileLLL(src, optimise ? true : false, &errors); - if (mode == Hex) - cout << toHex(bs) << endl; - else if (mode == Binary) - cout.write((char const*)bs.data(), bs.size()); - } - else if (mode == ParseTree) - cout << parseLLL(src) << endl; - else if (mode == Assembly) - cout << compileLLLToAsm(src, optimise ? true : false, &errors) << endl; - for (auto const& i: errors) - cerr << i << endl; - if ( errors.size() ) - return 1; - return 0; -} -- cgit From bad14f428b3fa8f2769af7e6b7f2eb23d67476c8 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 21 Mar 2016 21:32:42 +0300 Subject: lllc --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a02b779e..7378c586 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,5 +31,8 @@ add_subdirectory(solc) if (NOT EMSCRIPTEN) add_subdirectory(test) endif() +if (ETHASHCL) + add_subdirectory(lllc) +endif() # TODO installation and packaging rules -- cgit