diff --git a/src/daggen/CMakeLists.txt b/src/daggen/CMakeLists.txt deleted file mode 100644 index 854a9184..00000000 --- a/src/daggen/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(SRCS - main.cpp - print_tuples.h) - -set(HEADERS - ) - -source_group(daggen FILES ${SRCS} ${HEADERS}) -add_executable(dynarmic_daggen ${SRCS}) -target_link_libraries(dynarmic_daggen dynarmic_common) -set_target_properties(dynarmic_daggen PROPERTIES LINKER_LANGUAGE CXX) diff --git a/src/daggen/main.cpp b/src/daggen/main.cpp deleted file mode 100644 index a0730647..00000000 --- a/src/daggen/main.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* This file is part of the dynarmic project. - * Copyright (c) 2016 MerryMage - * This software may be used and distributed according to the terms of the GNU - * General Public License version 2 or any later version. - */ - -#include -#include - -#define BOOST_RESULT_OF_USE_DECLTYPE -#define BOOST_SPIRIT_USE_PHOENIX_V3 -#include -#include -#include -#include - -#include "common/common_types.h" -#include "frontend_arm/ir/opcodes.h" - -#include "print_tuples.h" - -using Opcode = Dynarmic::IR::Opcode; - -struct Inst; -struct Ref; -using Needle = boost::variant; - -struct Inst { - Opcode opcode; - std::vector children; - std::vector parents; -}; - -struct Ref { - std::string name; -}; - -int main(int argc, char** argv) { - std::string input{R"( - tile TestTile - in [ a (REGISTER), b (REGISTER) ] - out [ o?(REGISTER) ] - match - o: () - endmatch - code - code - endcode - endtile - )"}; - - std::string out_input = "out(REGISTER)"; - std::string ident_input = "out"; - - using Iterator = decltype(input.begin()); - namespace qi = boost::spirit::qi; - namespace ascii = boost::spirit::ascii; - using namespace qi::labels; - - using TileIn = std::tuple; - using TileOut = std::tuple; - using TileEntry = std::tuple, std::vector, std::string, std::string>; - - qi::rule identifier; - identifier %= - qi::lexeme[ascii::alpha >> *ascii::alnum]; - - qi::rule needle_name; - needle_name %= - qi::lexeme['$' >> *ascii::alnum]; - - qi::rule until_closeparen; - until_closeparen %= - qi::lexeme[*(qi::char_ - ')')]; - - qi::rule in; - in %= - (identifier >> '(' >> until_closeparen >> ')'); - - qi::rule question_mark; - question_mark = - ('?' >> qi::attr(true)) | qi::attr(false); - - qi::rule out; - out %= - (identifier >> question_mark >> '(' >> until_closeparen >> ')'); - - qi::rule entry; - entry %= ( - qi::lit("tile") >> identifier >> - qi::lit("in") >> '[' >> (in % ',') >> ']' >> - qi::lit("out") >> '[' >> (out % ',') >> ']' >> - qi::lit("match") >> - qi::lexeme[*(qi::char_ - qi::lit("endmatch"))] >> - qi::lit("endmatch") >> - qi::lit("code") >> - qi::lexeme[*(qi::char_ - qi::lit("endcode"))] >> - qi::lit("endcode") >> - qi::lit("endtile") - ); - - auto first = input.begin(), last = input.end(); - TileEntry te; - bool r = qi::phrase_parse(first, last, entry, ascii::space, te); - - if (first != last || !r) { - std::cout << "Fail!" << std::endl; - std::cout << te << std::endl; - } else { - std::cout << te << std::endl; - } - - first = out_input.begin(), last = out_input.end(); - TileOut to; - r = qi::phrase_parse(first, last, out, ascii::space, to); - - if (first != last || !r) { - std::cout << "Fail!" << std::endl; - std::cout << to << std::endl; - } else { - std::cout << to << std::endl; - } - - - first = ident_input.begin(), last = ident_input.end(); - std::string test_ident; - r = qi::phrase_parse(first, last, identifier, ascii::space, test_ident); - - if (first != last || !r) { - std::cout << "Fail!" << std::endl; - std::cout << test_ident << std::endl; - } else { - std::cout << test_ident << std::endl; - } - - return 0; -} diff --git a/src/daggen/print_tuples.h b/src/daggen/print_tuples.h deleted file mode 100644 index 7e23788f..00000000 --- a/src/daggen/print_tuples.h +++ /dev/null @@ -1,48 +0,0 @@ -/* This file is part of the dynarmic project. - * Copyright (c) 2016 MerryMage - * This software may be used and distributed according to the terms of the GNU - * General Public License version 2 or any later version. - */ -#pragma once - -template -struct tuple_printer { - - static void print(std::ostream& out, const Type& value) { - out << std::get(value) << ", "; - tuple_printer::print(out, value); - } -}; - -template -struct tuple_printer { - - static void print(std::ostream& out, const Type& value) { - out << std::get(value); - } - -}; - -template -std::ostream& operator<<(std::ostream& out, const std::tuple& value) { - out << "("; - tuple_printer, 0, sizeof...(Types) - 1>::print(out, value); - out << ")"; - return out; -} - -template -std::ostream& operator<<(std::ostream& out, const std::vector& value) { - out << "{"; - bool first = true; - for (const auto& v : value) { - if (!first) { - out << ", "; - } else { - first = false; - } - out << v; - } - out << "}"; - return out; -}