Browse Source

Remove lllc.

cl-refactor
Paweł Bylica 9 years ago
parent
commit
6b1ee012ea
  1. 26
      CMakeLists.txt
  2. 22
      lllc/CMakeLists.txt
  3. 124
      lllc/main.cpp

26
CMakeLists.txt

@ -37,7 +37,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
#defaults:
set(D_CMAKE_BUILD_TYPE "Release")
set(D_GUI ON)
set(D_TOOLS ON)
set(D_FATDB ON)
set(D_ETHASHCL ON)
set(D_ETHASHCUDA OFF)
@ -51,32 +50,25 @@ set(D_ETHSTRATUM OFF)
if (BUNDLE STREQUAL "minimal")
set(D_GUI OFF)
set(D_TOOLS ON)
elseif (BUNDLE STREQUAL "full")
set(D_GUI ON)
set(D_TOOLS ON)
set(D_FATDB ON)
elseif (BUNDLE STREQUAL "cli")
set(D_GUI OFF)
set(D_TOOLS ON)
set(D_FATDB ON)
elseif (BUNDLE STREQUAL "core")
set(D_GUI ON)
set(D_TOOLS ON)
set(D_FATDB ON)
elseif (BUNDLE STREQUAL "user")
set(D_GUI ON)
set(D_TOOLS ON)
elseif (BUNDLE STREQUAL "wallet")
set(D_GUI OFF)
set(D_TOOLS OFF)
set(D_MINER OFF)
set(D_ETHASHCL OFF)
set(D_FATDB OFF)
set(D_JSONRPC OFF)
elseif (BUNDLE STREQUAL "miner")
set(D_GUI OFF)
set(D_TOOLS OFF)
set(D_MINER ON)
set(D_ETHASHCL ON)
set(D_FATDB OFF)
@ -84,7 +76,6 @@ elseif (BUNDLE STREQUAL "miner")
set(D_ETHSTRATUM ON)
elseif (BUNDLE STREQUAL "cudaminer")
set(D_GUI OFF)
set(D_TOOLS OFF)
set(D_MINER ON)
set(D_ETHASHCL ON)
set(D_ETHASHCUDA ON)
@ -93,7 +84,6 @@ elseif (BUNDLE STREQUAL "cudaminer")
set(D_ETHSTRATUM ON)
elseif (BUNDLE STREQUAL "release") # release builds
set(D_GUI ON)
set(D_TOOLS ON)
set(D_FATDB OFF)
set(D_ETHASHCL ON)
set(D_JSONRPC ON)
@ -243,7 +233,6 @@ eth_format_option(JSONRPC)
eth_format_option(MINER)
eth_format_option(PROFILING)
eth_format_option(GUI)
eth_format_option(TOOLS)
eth_format_option(ETHASHCL)
eth_format_option(ETHASHCUDA)
eth_format_option(OLYMPIC)
@ -283,7 +272,6 @@ message("-- JSONRPC JSON-RPC support ${JSONRPC}
message("-- OLYMPIC Default to the Olympic network ${OLYMPIC}")
message("------------------------------------------------------------- components")
message("-- MINER Build miner ${MINER}")
message("-- TOOLS Build basic tools ${TOOLS}")
message("-- GUI Build GUI components ${GUI}")
message("-- ETHASHCL Build OpenCL components ${ETHASHCL}")
message("-- ETHASHCUDA Build CUDA components ${ETHASHCUDA}")
@ -305,12 +293,6 @@ createBuildInfo()
set(DB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIRS})
set(DB_LIBRARIES ${LEVELDB_LIBRARIES})
if (TOOLS)
set(GENERAL 1)
else ()
set(GENERAL 0)
endif ()
add_subdirectory(libdevcore)
if (GENERAL)
add_subdirectory(libevmcore)
@ -318,10 +300,6 @@ if (GENERAL)
add_subdirectory(liblll)
endif ()
if (TOOLS)
add_subdirectory(lllc)
endif ()
if (NOT WIN32)
add_definitions(-DETH_HAVE_SECP256K1)
add_subdirectory(secp256k1)
@ -355,6 +333,4 @@ if (GENERAL)
add_subdirectory(libethereum)
endif ()
if (MINER OR TOOLS)
add_subdirectory(ethminer)
endif ()
add_subdirectory(ethminer)

22
lllc/CMakeLists.txt

@ -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 )

124
lllc/main.cpp

@ -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 <http://www.gnu.org/licenses/>.
*/
/** @file main.cpp
* @author Gav Wood <i@gavwood.com>
* @date 2014
* Ethereum client.
*/
#include <fstream>
#include <iostream>
#include <liblll/Compiler.h>
#include <libdevcore/CommonIO.h>
#include <libdevcore/CommonData.h>
#include <libevmcore/Instruction.h>
#include "BuildInfo.h"
using namespace std;
using namespace dev;
using namespace dev::eth;
void help()
{
cout
<< "Usage lllc [OPTIONS] <file>" << 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<string> 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;
}
Loading…
Cancel
Save