updates to use TCC and LLVM in TGC_VP

This commit is contained in:
Eyck Jentzsch 2023-07-31 12:57:29 +02:00
parent 448866f0f6
commit 0f88596af5
8 changed files with 66 additions and 11 deletions

2
.gitignore vendored
View File

@ -13,3 +13,5 @@
/output.trc /output.trc
CMakeSettings.json CMakeSettings.json
/.venv /.venv
/src-gen/
/*.json

View File

@ -10,7 +10,6 @@ option(EN_EXT_DEBUG "Enable extended debug output at runtime" OFF)
option(ENABLE_COVERAGE "Enable code coverage" OFF) option(ENABLE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_SANITIZER "Enable address sanitizer" OFF) option(ENABLE_SANITIZER "Enable address sanitizer" OFF)
option(ENABLE_CLANGTIDY "Enable static analysis with clang-tidy." OFF) option(ENABLE_CLANGTIDY "Enable static analysis with clang-tidy." OFF)
option(ENABLE_TCC "Enable the use of TCC" ON)
set(SCC_LIB_ONLY ON) set(SCC_LIB_ONLY ON)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
@ -63,7 +62,7 @@ boost:without_type_erasure=True
boost:without_wave=True boost:without_wave=True
) )
set(B2_VERSION 4.9.3) set(B2_VERSION 4.9.6)
set(CONAN_PACKAGE_LIST set(CONAN_PACKAGE_LIST
fmt/8.0.1 fmt/8.0.1
spdlog/1.9.2 spdlog/1.9.2
@ -76,13 +75,19 @@ set(CONAN_PACKAGE_LIST
) )
set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS}) set(CONAN_PACKAGE_OPTIONS fmt:header_only=True ${CONAN_BOOST_OPTIONS})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND CONAN_PACKAGE_LIST seasocks/1.4.4 lua/5.4.3) list(APPEND CONAN_PACKAGE_LIST seasocks/1.4.4 tcc/0.9.27)
list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False ) list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False )
if(ENABLE_TCC) set(WITH_TCC ON)
list(APPEND CONAN_PACKAGE_LIST tcc/0.9.27)
endif()
endif() endif()
if(WITH_LLVM)
list(APPEND CONAN_PACKAGE_LIST llvm-core/13.0.0)
list(APPEND CONAN_PACKAGE_OPTIONS libiconv:shared=True)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tgc-iss/dbt-rise-plugins)
list(APPEND CONAN_PACKAGE_OPTIONS lua:compile_as_cpp=False)
list(APPEND CONAN_PACKAGE_LIST lua/5.4.3)
endif()
if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME}) if(NOT USE_CWR_SYSTEMC AND NOT USE_NCSC_SYSTEMC AND NOT DEFINED ENV{SYSTEMC_HOME})
set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST} set(CONAN_PACKAGE_LIST ${CONAN_PACKAGE_LIST}
systemc/2.3.3 systemc/2.3.3
@ -153,9 +158,12 @@ endif ()
add_subdirectory(scc) add_subdirectory(scc)
add_subdirectory(tgc-iss/dbt-rise-core) add_subdirectory(tgc-iss/dbt-rise-core)
add_subdirectory(tgc-iss/dbt-rise-tgc) add_subdirectory(tgc-iss/dbt-rise-tgc)
#if(NOT USE_CWR_SYSTEMC) if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tgc-iss//dbt-rise-plugins)
add_subdirectory(tgc-iss/dbt-rise-plugins)
endif()
if(NOT USE_CWR_SYSTEMC)
add_subdirectory(vpvper) add_subdirectory(vpvper)
#endif() endif()
if(NOT LIBS_ONLY) if(NOT LIBS_ONLY)
add_subdirectory(src) add_subdirectory(src)
endif() endif()

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="1"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="sc_main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-f fw/hello-world/hello -p pctrace=contrib/TGC_C_cycles.json --backend=tcc"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="build/${config_name:TGC-VP}/src/tgc-vp"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="TGC-VP"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/TGC-VP"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -10,12 +10,16 @@
#include <iss/log_categories.h> #include <iss/log_categories.h>
#include <scc/report.h> #include <scc/report.h>
#include <stdexcept> #include <stdexcept>
#include <unordered_set>
#ifdef ERROR #ifdef ERROR
#undef ERROR #undef ERROR
#endif #endif
namespace po = boost::program_options; namespace po = boost::program_options;
using namespace sc_core; using namespace sc_core;
namespace {
std::unordered_set<std::string> backend_opts = {"interp", "tcc"};
}
CLIParser::CLIParser(int argc, char *argv[]) CLIParser::CLIParser(int argc, char *argv[])
: desc("Options") : desc("Options")
, valid(false) { , valid(false) {
@ -28,9 +32,12 @@ CLIParser::CLIParser(int argc, char *argv[])
} }
po::notify(vm_); // throws on error, so do after help in case there are any problems po::notify(vm_); // throws on error, so do after help in case there are any problems
valid = true; valid = true;
if(backend_opts.find(vm_["backend"].as<std::string>())== std::end(backend_opts))
throw po::error("Illegal value for switch backend");
} catch (po::error &e) { } catch (po::error &e) {
std::cerr << "ERROR: " << e.what() << std::endl << std::endl; std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
std::cerr << desc << std::endl; std::cerr << desc << std::endl;
exit(-1);
} }
auto log_level = vm_["verbose"].as<scc::log>(); auto log_level = vm_["verbose"].as<scc::log>();
auto log_level_num = static_cast<unsigned>(log_level); auto log_level_num = static_cast<unsigned>(log_level);
@ -74,6 +81,8 @@ void CLIParser::build() {
"ELF file to load") "ELF file to load")
("gdb-port,g", po::value<unsigned short>()->default_value(0), ("gdb-port,g", po::value<unsigned short>()->default_value(0),
"enable gdb server and specify port to use") "enable gdb server and specify port to use")
("backend", po::value<std::string>()->default_value("interp"),
"the ISS backend to use, options are: interp, tcc")
("dump-ir", ("dump-ir",
"dump the intermediate representation") "dump the intermediate representation")
("dump-structure", po::value<std::string>(), ("dump-structure", po::value<std::string>(),

View File

@ -87,6 +87,7 @@ int sc_main(int argc, char *argv[]) {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
cfg.set_value(core_path + ".gdb_server_port", parser.get<unsigned short>("gdb-port")); cfg.set_value(core_path + ".gdb_server_port", parser.get<unsigned short>("gdb-port"));
cfg.set_value(core_path + ".dump_ir", parser.is_set("dump-ir")); cfg.set_value(core_path + ".dump_ir", parser.is_set("dump-ir"));
cfg.set_value(core_path + ".backend", parser.get<std::string>("backend"));
if(parser.is_set("plugin")){ if(parser.is_set("plugin")){
auto plugins = util::join(parser.get<std::vector<std::string>>("plugin"),","); auto plugins = util::join(parser.get<std::vector<std::string>>("plugin"),",");
cfg.set_value(core_path + ".plugins", plugins); cfg.set_value(core_path + ".plugins", plugins);

@ -1 +1 @@
Subproject commit bb85be481cfd71c9fdaad5217a044b207465f4c4 Subproject commit e2567254a3bf6c93f68bd1d8a40e9ba7cb2e0f53

@ -1 +1 @@
Subproject commit 720236ec3faf87246d15252278532a054c042875 Subproject commit e151416f5878ccc2bfca00e7e7c86084c46e40bd