From b89aba81cf040c444a081ae35b51e0f6c59fc715 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 10:22:45 +0300 Subject: [PATCH 01/23] Add pch.hpp with the needed headers --- src/pch.hpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/pch.hpp diff --git a/src/pch.hpp b/src/pch.hpp new file mode 100644 index 00000000..8fa0b849 --- /dev/null +++ b/src/pch.hpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include From f6498681ee942b58698a4dc42e1d57f580246f1a Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 10:25:51 +0300 Subject: [PATCH 02/23] cmake: precompile pch.hpp --- src/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a099227..d2a1f379 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,22 +26,27 @@ ExternalProject_Add( add_library(emulator-core STATIC ${SOURCES_emulator-core}) target_include_directories(emulator-core PUBLIC ${GENERIC_INCLUDE_DIR} ${ROOT_DIR}/src/Emulator) target_link_libraries(emulator-core ${LD_FLAGS} fmt) +target_precompile_headers(emulator-core PRIVATE pch.hpp) add_library(assembler-core STATIC ${SOURCES_assembler-core}) target_include_directories(assembler-core PUBLIC ${GENERIC_INCLUDE_DIR} ${ROOT_DIR}/src/Assembler) target_link_libraries(assembler-core pog) +target_precompile_headers(assembler-core PRIVATE pch.hpp) add_library(backtrace-provider STATIC ${SOURCES_backtrace-provider}) target_include_directories(backtrace-provider PUBLIC ${GENERIC_INCLUDE_DIR}) add_dependencies(backtrace-provider libbacktrace) +target_precompile_headers(backtrace-provider PRIVATE pch.hpp) add_executable(hcasm ${SOURCES_assembler-main}) target_include_directories(hcasm PUBLIC ${GENERIC_INCLUDE_DIR} ${ROOT_DIR}/src/Assembler) target_link_libraries(hcasm assembler-core pog) +target_precompile_headers(hcasm PRIVATE pch.hpp) add_executable(hcemul ${SOURCES_emulator-main}) target_include_directories(hcemul PUBLIC ${GENERIC_INCLUDE_DIR} ${ROOT_DIR}/src/Emulator) target_link_libraries(hcemul emulator-core assembler-core) +target_precompile_headers(hcemul PRIVATE pch.hpp) if (LIBUNWIND) target_link_libraries(hcasm backtrace-provider -L${ROOT_DIR}/dist/libbacktrace backtrace) From 9fbd807709623ca140cb34ddc0cd44b952689f1b Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 11:27:35 +0300 Subject: [PATCH 03/23] pch.hpp: add comments --- src/pch.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pch.hpp b/src/pch.hpp index 8fa0b849..2a0f83c9 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -1,3 +1,7 @@ +/* + * Precompiled headers + * *Only add headers that will not be modified!* + */ #include #include #include @@ -29,5 +33,6 @@ #include #include #include +#include #include #include From 7826d365c41413c17cf92f804ef67e16589c7198 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 11:28:48 +0300 Subject: [PATCH 04/23] Use pch.hpp in Assembler/Core/Compiler.*pp --- src/Assembler/Core/Compiler.cpp | 586 ++++++++++++++++---------------- src/Assembler/Core/Compiler.hpp | 506 ++++++++++++++------------- 2 files changed, 562 insertions(+), 530 deletions(-) diff --git a/src/Assembler/Core/Compiler.cpp b/src/Assembler/Core/Compiler.cpp index c571c4ca..5642d952 100644 --- a/src/Assembler/Core/Compiler.cpp +++ b/src/Assembler/Core/Compiler.cpp @@ -1,97 +1,66 @@ -#include -#include -#include +#include -#include #include -#include #include -#include +#include +#include #include +#include #include #include - using HyperCPU::LogLevel; namespace HCAsm { - HyperCPU::Logger logger{HyperCPU::LogLevel::WARNING}; - HCAsm::CompilerState* current_state; - std::uint64_t current_index = 0; -} +HyperCPU::Logger logger{HyperCPU::LogLevel::WARNING}; +HCAsm::CompilerState *current_state; +std::uint64_t current_index = 0; +} // namespace HCAsm HCAsm::HCAsmCompiler::HCAsmCompiler(LogLevel lvl) : pool(32) { logger = HyperCPU::Logger{lvl}; // Setup tokens parser.token("[^\\S\n]+") - .action([this]([[maybe_unused]] std::string_view tok) -> Value { - parser.get_line_offset() += tok.length(); - return {}; - }); - parser.token("\\/\\/.*"); // Single line comment + .action([this]([[maybe_unused]] std::string_view tok) -> Value { + parser.get_line_offset() += tok.length(); + return {}; + }); + parser.token("\\/\\/.*"); // Single line comment parser.token("\\/\\*[\\S\\s]+\\*\\/"); /* Multi-line comment */ - parser.token(R"(\+)") - .symbol("+"); - parser.token(R"(-)") - .symbol("-"); - parser.token(",") - .symbol(","); - parser.token("\\[") - .symbol("["); - parser.token("\\]") - .symbol("]"); - parser.token(";") - .symbol(";"); - parser.token(":") - .symbol(":"); - parser.token(R"(\n)") - .action([this]([[maybe_unused]] std::string_view tok) -> Value { - ++parser.get_line_counter(); - parser.reset_line_offset(); - return {}; - }); - - parser.token(R"(\.attr\(entry\))") - .symbol("entry"); - - parser.token("#use") - .fullword() - .symbol("use"); - parser.token("\\.b8") - .fullword() - .symbol(".b8"); - parser.token("\\.b16") - .fullword() - .symbol(".b16"); - parser.token("\\.b32") - .fullword() - .symbol(".b32"); - parser.token("\\.b64") - .fullword() - .symbol(".b64"); - + parser.token(R"(\+)").symbol("+"); + parser.token(R"(-)").symbol("-"); + parser.token(",").symbol(","); + parser.token("\\[").symbol("["); + parser.token("\\]").symbol("]"); + parser.token(";").symbol(";"); + parser.token(":").symbol(":"); + parser.token(R"(\n)").action( + [this]([[maybe_unused]] std::string_view tok) -> Value { + ++parser.get_line_counter(); + parser.reset_line_offset(); + return {}; + }); + + parser.token(R"(\.attr\(entry\))").symbol("entry"); + + parser.token("#use").fullword().symbol("use"); + parser.token("\\.b8").fullword().symbol(".b8"); + parser.token("\\.b16").fullword().symbol(".b16"); + parser.token("\\.b32").fullword().symbol(".b32"); + parser.token("\\.b64").fullword().symbol(".b64"); + parser.token("[a-zA-Z_][a-zA-Z0-9_]*") - .symbol("ident") - .action(TokenizeIdentifier); + .symbol("ident") + .action(TokenizeIdentifier); parser.token("\"((?:\\\\[\\s\\S]|[^\"\\\\])*)\"") - .symbol("string") - .action(TokenizeString); - parser.token(R"(0s[0-9]+)") - .symbol("sint") - .action(TokenizeSignedInt); - parser.token(R"(0u[0-9]+)") - .symbol("uint") - .action(TokenizeUnsignedInt); - parser.token(R"(0x[0-9a-fA-F]+)") - .symbol("hex") - .action(TokenizeHexadecimal); - parser.token(R"(0b[0-1]+)") - .symbol("binary") - .action(TokenizeBinary); - parser.token(R"('.')") - .symbol("char") - .action(TokenizeChar); + .symbol("string") + .action(TokenizeString); + parser.token(R"(0s[0-9]+)").symbol("sint").action(TokenizeSignedInt); + parser.token(R"(0u[0-9]+)").symbol("uint").action(TokenizeUnsignedInt); + parser.token(R"(0x[0-9a-fA-F]+)").symbol("hex").action(TokenizeHexadecimal); + parser.token(R"(0b[0-1]+)").symbol("binary").action(TokenizeBinary); + parser.token(R"('.')").symbol("char").action(TokenizeChar); parser.end_token().action([this](std::string_view) -> Value { parser.pop_input_stream(); return {}; @@ -101,48 +70,52 @@ HCAsm::HCAsmCompiler::HCAsmCompiler(LogLevel lvl) : pool(32) { // Setup parser rules parser.set_start_symbol("statements"); parser.rule("statements") - .production("statements", "statement") - .production("statement"); - parser.rule("statement") - /* Reserved statements */ - .production(".b8", "operand", ";", CompileRawValueb8) - .production(".b8", "string", ";", CompileRawValueb8_str) - .production(".b16", "operand", ";", CompileRawValueb16) - .production(".b32", "operand", ";", CompileRawValueb32) - .production(".b64", "operand", ";", CompileRawValueb64) - .production("ident", "operand", ",", "operand", ";", CompileStatement1) - .production("ident", "operand", ";", CompileStatement2) - .production("ident", ";", CompileStatement3) - .production("entry", "ident", ":", CompileEntryLabel) - .production("ident", ":", CompileLabel); + .production("statements", "statement") + .production("statement"); + parser + .rule("statement") + /* Reserved statements */ + .production(".b8", "operand", ";", CompileRawValueb8) + .production(".b8", "string", ";", CompileRawValueb8_str) + .production(".b16", "operand", ";", CompileRawValueb16) + .production(".b32", "operand", ";", CompileRawValueb32) + .production(".b64", "operand", ";", CompileRawValueb64) + .production("ident", "operand", ",", "operand", ";", CompileStatement1) + .production("ident", "operand", ";", CompileStatement2) + .production("ident", ";", CompileStatement3) + .production("entry", "ident", ":", CompileEntryLabel) + .production("ident", ":", CompileLabel); parser.rule("operand") - .production("[", "hex", "]", ParseOperand1) - .production("[", "ident", "]", ParseOperand2) - .production("[", "ident", "+", "uint", "]", ParseOperand3) - .production("[", "ident", "+", "hex", "]", ParseOperand3) - .production("[", "ident", "+", "binary", "]", ParseOperand3) - .production("ident", "ident", "[", "hex", "]", ParseOperand4) - .production("ident", "ident", "[", "ident", "]", ParseOperand5) - .production("ident", "ident", "[", "ident", "+", "uint", "]", ParseOperand6) - .production("ident", "ident", "[", "ident", "+", "hex", "]", ParseOperand6) - .production("ident", "ident", "[", "ident", "+", "binary", "]", ParseOperand6) - .production("ident", "hex", ParseOperand10) - .production("ident", "binary", ParseOperand10) - .production("ident", "uint", ParseOperand10) - .production("ident", "char", ParseOperand10) - .production("ident", "sint", ParseOperand11) - .production("ident", "ident", ParseOperand12) - .production("hex", ParseOperand8) - .production("binary", ParseOperand8) - .production("sint", ParseOperand7) - .production("uint", ParseOperand8) - .production("char", ParseOperand8) - .production("ident", ParseOperand9); - + .production("[", "hex", "]", ParseOperand1) + .production("[", "ident", "]", ParseOperand2) + .production("[", "ident", "+", "uint", "]", ParseOperand3) + .production("[", "ident", "+", "hex", "]", ParseOperand3) + .production("[", "ident", "+", "binary", "]", ParseOperand3) + .production("ident", "ident", "[", "hex", "]", ParseOperand4) + .production("ident", "ident", "[", "ident", "]", ParseOperand5) + .production("ident", "ident", "[", "ident", "+", "uint", "]", + ParseOperand6) + .production("ident", "ident", "[", "ident", "+", "hex", "]", + ParseOperand6) + .production("ident", "ident", "[", "ident", "+", "binary", "]", + ParseOperand6) + .production("ident", "hex", ParseOperand10) + .production("ident", "binary", ParseOperand10) + .production("ident", "uint", ParseOperand10) + .production("ident", "char", ParseOperand10) + .production("ident", "sint", ParseOperand11) + .production("ident", "ident", ParseOperand12) + .production("hex", ParseOperand8) + .production("binary", ParseOperand8) + .production("sint", ParseOperand7) + .production("uint", ParseOperand8) + .production("char", ParseOperand8) + .production("ident", ParseOperand9); } -HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string& contents, std::uint32_t& code_size) { +HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string &contents, + std::uint32_t &code_size) { files.push(std::move(contents)); logger.Log(LogLevel::DEBUG, "Stage 1 compiling - transforming to IR"); @@ -155,7 +128,7 @@ HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string& contents, std::ui return binary; } -HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string& src) { +HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string &src) { CompilerState state(pool); current_state = &state; this->state = &state; @@ -164,177 +137,183 @@ HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string& src) { parser.prepare(); logger.Log(LogLevel::DEBUG, "Parser prepared."); logger.Log(LogLevel::DEBUG, "Compiling..."); - + parser.parse(src); current_state = nullptr; return state; } -constexpr inline std::uint8_t HCAsm::HCAsmCompiler::OperandSize(HCAsm::OperandType op) { +constexpr inline std::uint8_t +HCAsm::HCAsmCompiler::OperandSize(HCAsm::OperandType op) { switch (op) { - case HCAsm::OperandType::mem_reg_add_int: - case HCAsm::OperandType::memaddr_reg: - case HCAsm::OperandType::reg: - return 1; - case HCAsm::OperandType::memaddr_int: - case HCAsm::OperandType::sint: - case HCAsm::OperandType::uint: - case HCAsm::OperandType::label: - return 8; - default: UNREACHABLE(); + case HCAsm::OperandType::mem_reg_add_int: + case HCAsm::OperandType::memaddr_reg: + case HCAsm::OperandType::reg: + return 1; + case HCAsm::OperandType::memaddr_int: + case HCAsm::OperandType::sint: + case HCAsm::OperandType::uint: + case HCAsm::OperandType::label: + return 8; + default: + UNREACHABLE(); } } -std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(const Operand& op) { +std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(const Operand &op) { switch (op.mode) { - case Mode::b8_str: - return std::get>(op.variant)->size(); - case Mode::b8: - return 1; - case Mode::b16: - return 2; - case Mode::b32: - return 4; - case Mode::b64_label: - case Mode::b64: - return 8; - default: - ABORT(); + case Mode::b8_str: + return std::get>(op.variant)->size(); + case Mode::b8: + return 1; + case Mode::b16: + return 2; + case Mode::b32: + return 4; + case Mode::b64_label: + case Mode::b64: + return 8; + default: + ABORT(); } } std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(Mode md) { switch (md) { - case Mode::b8: - return 1; - case Mode::b16: - return 2; - case Mode::b32: - return 4; - case Mode::b64_label: - case Mode::b64: - return 8; - default: - ABORT(); + case Mode::b8: + return 1; + case Mode::b16: + return 2; + case Mode::b32: + return 4; + case Mode::b64_label: + case Mode::b64: + return 8; + default: + ABORT(); } } -std::uint8_t HCAsm::HCAsmCompiler::InstructionSize(HCAsm::Instruction& instr) { +std::uint8_t HCAsm::HCAsmCompiler::InstructionSize(HCAsm::Instruction &instr) { switch (instr.opcode) { - case HyperCPU::Opcode::IRET: - return 2; - default: - break; + case HyperCPU::Opcode::IRET: + return 2; + default: + break; } - - std::uint8_t result = 3; // Opcode is always two bytes long + one byte for operand types + + std::uint8_t result = + 3; // Opcode is always two bytes long + one byte for operand types switch (instr.op1.type) { - case OperandType::reg: // R_* - switch (instr.op2.type) { - case OperandType::memaddr_reg: // R_RM - [[fallthrough]]; - case OperandType::reg: // R_R - result += 2; - break; - case OperandType::sint: - [[fallthrough]]; - case OperandType::uint: // R_IMM - result += 1 + ModeToSize(instr.op1); - break; - case OperandType::label: - [[fallthrough]]; - case OperandType::memaddr_int: // R_M - result += 9; - break; - case OperandType::mem_reg_add_int: - result += 10; - break; - case OperandType::none: // R - result += 1; - break; - default: - ABORT(); - } - break; - case OperandType::mem_reg_add_int: - ++result; + case OperandType::reg: // R_* + switch (instr.op2.type) { + case OperandType::memaddr_reg: // R_RM [[fallthrough]]; - case OperandType::memaddr_reg: - switch (instr.op2.type) { - case OperandType::reg: // RM_R - result += 2; - break; - case OperandType::sint: - [[fallthrough]]; - case OperandType::uint: // RM_IMM - result += 1 + ModeToSize(instr.op1); - break; - case OperandType::label: - [[fallthrough]]; - case OperandType::memaddr_int: // RM_M - result += 9; - break; - case OperandType::mem_reg_add_int: - result += 10; - break; - default: - ABORT(); - } + case OperandType::reg: // R_R + result += 2; break; case OperandType::sint: [[fallthrough]]; - case OperandType::uint: // IMM - switch (instr.op1.mode) { - case Mode::none: - ThrowError(*(instr.op1.tokens[0]), parser, "unknown operand size"); - break; - default: - result += ModeToSize(instr.op1); - break; - } + case OperandType::uint: // R_IMM + result += 1 + ModeToSize(instr.op1); break; - case OperandType::memaddr_int: - result += 8; - switch (instr.op2.type) { - case OperandType::reg: // M_R - ++result; - break; - default: - ABORT(); - } + case OperandType::label: + [[fallthrough]]; + case OperandType::memaddr_int: // R_M + result += 9; + break; + case OperandType::mem_reg_add_int: + result += 10; + break; + case OperandType::none: // R + result += 1; + break; + default: + ABORT(); + } + break; + case OperandType::mem_reg_add_int: + ++result; + [[fallthrough]]; + case OperandType::memaddr_reg: + switch (instr.op2.type) { + case OperandType::reg: // RM_R + result += 2; + break; + case OperandType::sint: + [[fallthrough]]; + case OperandType::uint: // RM_IMM + result += 1 + ModeToSize(instr.op1); break; case OperandType::label: - result += 8; + [[fallthrough]]; + case OperandType::memaddr_int: // RM_M + result += 9; + break; + case OperandType::mem_reg_add_int: + result += 10; + break; + default: + ABORT(); + } + break; + case OperandType::sint: + [[fallthrough]]; + case OperandType::uint: // IMM + switch (instr.op1.mode) { + case Mode::none: + ThrowError(*(instr.op1.tokens[0]), parser, "unknown operand size"); + break; + default: + result += ModeToSize(instr.op1); break; - case OperandType::none: + } + break; + case OperandType::memaddr_int: + result += 8; + switch (instr.op2.type) { + case OperandType::reg: // M_R + ++result; break; default: ABORT(); + } + break; + case OperandType::label: + result += 8; + break; + case OperandType::none: + break; + default: + ABORT(); } return result; } -HCAsm::BinaryResult HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState& ir) { +HCAsm::BinaryResult +HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState &ir) { // Count code size - pass 1 logger.Log(LogLevel::DEBUG, "Running pass 1 - counting code size"); - - for (auto& instr : ir.ir) { - VisitVariant(instr, - [this, &ir](Instruction& instruction) mutable -> void { - ir.code_size += InstructionSize(instruction); - }, - [&ir](Label& label) mutable -> void { - ir.labels[label.name] = ir.code_size; - if (label.is_entry_point) { - ir.entry_point = ir.code_size; - } - }, - [&ir](RawValue& raw) mutable -> void { - ir.code_size += [&raw]() -> std::uint8_t { - switch (raw.mode) { + + for (auto &instr : ir.ir) { + VisitVariant( + instr, + [this, &ir](Instruction &instruction) mutable -> void { + ir.code_size += InstructionSize(instruction); + }, + [&ir](Label &label) mutable -> void { + ir.labels[label.name] = ir.code_size; + if (label.is_entry_point) { + ir.entry_point = ir.code_size; + } + }, + [&ir](RawValue &raw) mutable -> void { + ir.code_size += [&raw]() -> std::uint8_t { + switch (raw.mode) { case Mode::b8_str: - return std::get>(raw.value.variant)->size(); + return std::get>(raw.value.variant) + ->size(); case Mode::b8: return 1; case Mode::b16: @@ -346,31 +325,39 @@ HCAsm::BinaryResult HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState return 8; default: ABORT(); - } - }(); - }); + } + }(); + }); } // Resolve references - pass 2 - logger.Log(LogLevel::DEBUG, fmt::format("{} label references are waiting for resolve", ir.pending_resolves.size())); + logger.Log(LogLevel::DEBUG, + fmt::format("{} label references are waiting for resolve", + ir.pending_resolves.size())); if (!ir.pending_resolves.empty()) { logger.Log(LogLevel::DEBUG, "Resolving label references"); - for (auto& args : ir.pending_resolves) { - auto& instr = ir.ir[args.idx]; - auto* op = args.op ? &std::get(instr).op2 : &std::get(instr).op1; + for (auto &args : ir.pending_resolves) { + auto &instr = ir.ir[args.idx]; + auto *op = args.op ? &std::get(instr).op2 + : &std::get(instr).op1; - if (ir.labels.contains(*std::get>(op->variant))) { + if (ir.labels.contains( + *std::get>(op->variant))) { op->type = OperandType::uint; - op->variant.emplace<0>(ir.labels[*std::get>(op->variant)]); + op->variant.emplace<0>( + ir.labels[*std::get>(op->variant)]); } else { - ThrowError(*op->tokens[0], parser, fmt::format("failed to resolve undefined reference to \"{}\"", *std::get>(op->variant))); + ThrowError( + *op->tokens[0], parser, + fmt::format("failed to resolve undefined reference to \"{}\"", + *std::get>(op->variant))); } } } // Compile code - pass 3 - BinaryResult binary = { new unsigned char[ir.code_size] }; + BinaryResult binary = {new unsigned char[ir.code_size]}; if (!binary.binary) { logger.Log(LogLevel::ERROR, "Failed to allocate memory for binary data!"); ABORT(); @@ -380,38 +367,51 @@ HCAsm::BinaryResult HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState BinaryTransformer transformer(binary, &ir); - for (auto& instr : ir.ir) { - VisitVariant(instr, - [&transformer](Instruction& instruction) mutable -> void { - transformer.EncodeInstruction(instruction); - }, - [&binary, &ir, this](RawValue& raw) mutable -> void { - switch (raw.mode) { + for (auto &instr : ir.ir) { + VisitVariant( + instr, + [&transformer](Instruction &instruction) mutable -> void { + transformer.EncodeInstruction(instruction); + }, + [&binary, &ir, this](RawValue &raw) mutable -> void { + switch (raw.mode) { case Mode::b8_str: - binary.push(*std::get>(raw.value.variant)); + binary.push( + *std::get>(raw.value.variant)); break; - case Mode::b8: - binary.push(static_cast(std::get(raw.value.variant))); + case Mode::b8: + binary.push(static_cast( + std::get(raw.value.variant))); break; - case Mode::b16: - binary.push(static_cast(std::get(raw.value.variant))); + case Mode::b16: + binary.push(static_cast( + std::get(raw.value.variant))); break; - case Mode::b32: - binary.push(static_cast(std::get(raw.value.variant))); + case Mode::b32: + binary.push(static_cast( + std::get(raw.value.variant))); break; case Mode::b64_label: - if (!ir.labels.contains(*std::get>(raw.value.variant))) { - ThrowError(*raw.value.tokens[1], parser, fmt::format("failed to resolve undefined reference to \"{}\"", *std::get>(raw.value.variant))); + if (!ir.labels.contains(*std::get>( + raw.value.variant))) { + ThrowError( + *raw.value.tokens[1], parser, + fmt::format("failed to resolve undefined reference to \"{}\"", + *std::get>( + raw.value.variant))); } - binary.push(static_cast(ir.labels.at(*std::get>(raw.value.variant)))); + binary.push(static_cast(ir.labels.at( + *std::get>(raw.value.variant)))); break; - case Mode::b64: - binary.push(static_cast(std::get(raw.value.variant))); + case Mode::b64: + binary.push(static_cast( + std::get(raw.value.variant))); break; - default: ABORT(); - } - }, - [](Label&){}); + default: + ABORT(); + } + }, + [](Label &) {}); } binary.entry_point = ir.entry_point; @@ -419,7 +419,8 @@ HCAsm::BinaryResult HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState return binary; } -std::string_view HCAsm::FindLine(const pog::LineSpecialization& line_spec, const std::string_view& str) { +std::string_view HCAsm::FindLine(const pog::LineSpecialization &line_spec, + const std::string_view &str) { std::size_t start = 0; std::size_t end = 0; std::size_t current_line = 1; @@ -427,7 +428,7 @@ std::string_view HCAsm::FindLine(const pog::LineSpecialization& line_spec, const while (end < str.size()) { if (str[end] == '\n') { if (current_line == line_spec.line) { - return std::string_view { str.begin() + start, end - start }; + return std::string_view{str.begin() + start, end - start}; } start = end + 1; current_line++; @@ -436,31 +437,36 @@ std::string_view HCAsm::FindLine(const pog::LineSpecialization& line_spec, const } if (current_line == line_spec.line) { - return std::string_view { str.begin() + start, str.end() }; + return std::string_view{str.begin() + start, str.end()}; } throw std::out_of_range("Line number out of range"); } -[[noreturn]] void HCAsm::ThrowError(pog::TokenWithLineSpec& err_token, pog::Parser& parser, std::string err_msg) { +[[noreturn]] void HCAsm::ThrowError(pog::TokenWithLineSpec &err_token, + pog::Parser &parser, + std::string err_msg) { logger.Log(HyperCPU::LogLevel::ERROR, "error: {}", err_msg); auto line = FindLine(err_token.line_spec, parser.get_top_file()); HyperCPU::println("{} | {}", err_token.line_spec.line, line); - HyperCPU::println("{:<{}} | {:<{}}{}", - "", std::to_string(err_token.line_spec.line).length(), - "", err_token.line_spec.offset, - std::string(err_token.line_spec.length, '^')); + HyperCPU::println("{:<{}} | {:<{}}{}", "", + std::to_string(err_token.line_spec.line).length(), "", + err_token.line_spec.offset, + std::string(err_token.line_spec.length, '^')); EXIT(1); } -void HCAsm::WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult& result, std::ofstream& output, std::uint32_t code_size, std::uint32_t entry_point) { +void HCAsm::WriteResultFile(HyperCPU::FileType type, + HCAsm::BinaryResult &result, std::ofstream &output, + std::uint32_t code_size, + std::uint32_t entry_point) { HyperCPU::GenericHeader gen_header; gen_header.type = type; gen_header.magic = HyperCPU::magic; gen_header.version = HyperCPU::current_version; gen_header.code_size = code_size; gen_header.entry_point = entry_point; - output.write(reinterpret_cast(&gen_header), sizeof(gen_header)); + output.write(reinterpret_cast(&gen_header), sizeof(gen_header)); - output.write(reinterpret_cast(result.binary), code_size); + output.write(reinterpret_cast(result.binary), code_size); } diff --git a/src/Assembler/Core/Compiler.hpp b/src/Assembler/Core/Compiler.hpp index 1cef95a5..bd46e4b3 100644 --- a/src/Assembler/Core/Compiler.hpp +++ b/src/Assembler/Core/Compiler.hpp @@ -1,258 +1,284 @@ #pragma once -#include -#include -#include -#include -#include +#include -#include -#include #include -#include +#include +#include #include -#include +#include #include +#include #include #include #include - namespace HCAsm { - enum class ValueType { - operand, - string, - sint, - uint, - }; - - enum class OperandType { - reg, - mem_reg_add_int, - sint, - uint, - memaddr_reg, - memaddr_int, - memaddr_lbl, - label, - str_lit, - none - }; - - enum class Mode : std::uint8_t { - b8 = 0b00, - b16 = 0b01, - b32 = 0b10, - b64 = 0b11, - b64_label, - b8_str, - none - }; - - struct Value; - - struct Operand { - OperandType type; - HyperCPU::Registers reg; - enum Mode mode; - bool needs_resolve; - std::array, hpool::ReallocationPolicy::OffsetRealloc>, 2> tokens; - std::variant> variant; - }; - - struct Instruction { - HyperCPU::Opcode opcode; - Operand op1, op2; - }; - - struct RawValue { - enum Mode mode; - Operand value; // Label resolver requires reference to operand - }; - - struct Value { - std::variant val; - }; - - struct Label { - std::string name; - std::uint64_t index; - bool is_entry_point; - }; - - template - concept UnsignedIntegral = std::is_integral_v && std::is_unsigned_v; - - struct BinaryResult { - BinaryResult() : binary(nullptr), ptr(0), entry_point(0) { } - BinaryResult(unsigned char* ptr) : binary(ptr), ptr(0), entry_point(0) { } - - unsigned char* binary; - std::uint64_t ptr; - std::uint32_t entry_point; - - template - constexpr inline void push(T data) { - std::memcpy(binary + ptr, &data, sizeof(data)); - ptr += sizeof(data); - } - - inline void push(const std::string& data) { - std::memcpy(binary + ptr, data.data(), data.length()); - ptr += data.length(); - } - - ~BinaryResult() { - delete[] binary; - } - }; - - struct PendingLabelReferenceResolve { - std::uint32_t idx; - std::uint8_t op; - }; - - // Some magic for std::visit - template - struct MakeOverload : T... { - using T::operator()...; - }; - - template - MakeOverload(T...) -> MakeOverload; - - template - constexpr inline decltype(auto) VisitVariant(Variant&& variant, Alternatives&&... alternatives) { - return std::visit( - MakeOverload{std::forward(alternatives)..., [](auto const&){}}, - variant - ); +enum class ValueType { + operand, + string, + sint, + uint, +}; + +enum class OperandType { + reg, + mem_reg_add_int, + sint, + uint, + memaddr_reg, + memaddr_int, + memaddr_lbl, + label, + str_lit, + none +}; + +enum class Mode : std::uint8_t { + b8 = 0b00, + b16 = 0b01, + b32 = 0b10, + b64 = 0b11, + b64_label, + b8_str, + none +}; + +struct Value; + +struct Operand { + OperandType type; + HyperCPU::Registers reg; + enum Mode mode; + bool needs_resolve; + std::array, + hpool::ReallocationPolicy::OffsetRealloc>, + 2> + tokens; + std::variant> + variant; +}; + +struct Instruction { + HyperCPU::Opcode opcode; + Operand op1, op2; +}; + +struct RawValue { + enum Mode mode; + Operand value; // Label resolver requires reference to operand +}; + +struct Value { + std::variant + val; +}; + +struct Label { + std::string name; + std::uint64_t index; + bool is_entry_point; +}; + +template +concept UnsignedIntegral = std::is_integral_v && std::is_unsigned_v; + +struct BinaryResult { + BinaryResult() : binary(nullptr), ptr(0), entry_point(0) {} + BinaryResult(unsigned char *ptr) : binary(ptr), ptr(0), entry_point(0) {} + + unsigned char *binary; + std::uint64_t ptr; + std::uint32_t entry_point; + + template constexpr inline void push(T data) { + std::memcpy(binary + ptr, &data, sizeof(data)); + ptr += sizeof(data); } - // Needs improvements and optimizations - struct CompilerState { - CompilerState(hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc>& pool) : pool(pool), code_size(0), entry_point(0) { } - - std::vector pending_resolves; - std::vector> tmp_args; - std::vector> ir; - std::unordered_map labels; - hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc>& pool; - std::uint64_t code_size; - std::uint32_t entry_point; - }; - - constexpr inline Mode ModeFromRegister(HyperCPU::Registers reg) { - using namespace HyperCPU; - switch (reg) { - case Registers::X0: - case Registers::X1: - case Registers::X2: - case Registers::X3: - case Registers::X4: - case Registers::X5: - case Registers::X6: - case Registers::X7: - case Registers::XBP: - case Registers::XSP: - return Mode::b64; - case Registers::XH0: - case Registers::XH1: - case Registers::XH2: - case Registers::XH3: - case Registers::XH4: - case Registers::XH5: - case Registers::XH6: - case Registers::XH7: - case Registers::XL0: - case Registers::XL1: - case Registers::XL2: - case Registers::XL3: - case Registers::XL4: - case Registers::XL5: - case Registers::XL6: - case Registers::XL7: - return Mode::b32; - case Registers::XLL0: - case Registers::XLL1: - case Registers::XLL2: - case Registers::XLL3: - return Mode::b16; - case Registers::XLLH0: - case Registers::XLLH1: - case Registers::XLLH2: - case Registers::XLLH3: - case Registers::XLLL0: - case Registers::XLLL1: - case Registers::XLLL2: - case Registers::XLLL3: - return Mode::b8; - default: - UNREACHABLE(); - } + inline void push(const std::string &data) { + std::memcpy(binary + ptr, data.data(), data.length()); + ptr += data.length(); } - std::string_view FindLine(const pog::LineSpecialization&, const std::string_view&); - void WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult& result, std::ofstream& output, std::uint32_t code_size, std::uint32_t entry_point); - - [[noreturn]] void ThrowError(pog::TokenWithLineSpec& err_token, pog::Parser& parser, std::string err_msg); - - Value TokenizeSignedInt(std::string_view str); - Value TokenizeUnsignedInt(std::string_view str); - Value TokenizeString(std::string_view str); - Value TokenizeHexadecimal(std::string_view str); - Value TokenizeIdentifier(std::string_view str); - Value TokenizeBinary(std::string_view str); - Value TokenizeChar(std::string_view str); - - Value ParseOperand1(pog::Parser&, std::vector>&& args); - Value ParseOperand2(pog::Parser&, std::vector>&& args); - Value ParseOperand3(pog::Parser&, std::vector>&& args); - Value ParseOperand4(pog::Parser&, std::vector>&& args); - Value ParseOperand5(pog::Parser&, std::vector>&& args); - Value ParseOperand6(pog::Parser&, std::vector>&& args); - Value ParseOperand7(pog::Parser&, std::vector>&& args); - Value ParseOperand8(pog::Parser&, std::vector>&& args); - Value ParseOperand9(pog::Parser&, std::vector>&& args); - Value ParseOperand10(pog::Parser&, std::vector>&& args); - Value ParseOperand11(pog::Parser&, std::vector>&& args); - Value ParseOperand12(pog::Parser&, std::vector>&& args); - - Value CompileStatement1(pog::Parser&, std::vector>&& args); - Value CompileStatement2(pog::Parser&, std::vector>&& args); - Value CompileStatement3(pog::Parser&, std::vector>&& args); - Value CompileEntryLabel(pog::Parser&, std::vector>&& args); - Value CompileLabel(pog::Parser&, std::vector>&& args); - Value CompileRawValueb8_str(pog::Parser&, std::vector>&& args); - Value CompileRawValueb8(pog::Parser&, std::vector>&& args); - Value CompileRawValueb16(pog::Parser&, std::vector>&& args); - Value CompileRawValueb32(pog::Parser&, std::vector>&& args); - Value CompileRawValueb64(pog::Parser&, std::vector>&& args); - - extern HyperCPU::Logger logger; - extern CompilerState* current_state; - extern std::uint64_t current_index; - - class HCAsmCompiler { - public: - HCAsmCompiler(HyperCPU::LogLevel lvl = HyperCPU::LogLevel::WARNING); - - BinaryResult Compile(std::string& contents, std::uint32_t& code_size); - CompilerState TransformToIR(std::string& src); - BinaryResult TransformToBinary(CompilerState& ir); - - private: - pog::Parser parser; - CompilerState* state; - std::queue files; - hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc> pool; - - constexpr inline std::uint8_t OperandSize(const OperandType op); - std::uint8_t InstructionSize(Instruction& instr); - std::uint8_t ModeToSize(const Operand& op); - std::uint8_t ModeToSize(Mode md); - }; - + ~BinaryResult() { delete[] binary; } +}; + +struct PendingLabelReferenceResolve { + std::uint32_t idx; + std::uint8_t op; +}; + +// Some magic for std::visit +template struct MakeOverload : T... { + using T::operator()...; +}; + +template MakeOverload(T...) -> MakeOverload; + +template +constexpr inline decltype(auto) VisitVariant(Variant &&variant, + Alternatives &&...alternatives) { + return std::visit(MakeOverload{std::forward(alternatives)..., + [](auto const &) {}}, + variant); } + +// Needs improvements and optimizations +struct CompilerState { + CompilerState(hpool::HPool, + hpool::ReallocationPolicy::OffsetRealloc> &pool) + : pool(pool), code_size(0), entry_point(0) {} + + std::vector pending_resolves; + std::vector> tmp_args; + std::vector> ir; + std::unordered_map labels; + hpool::HPool, + hpool::ReallocationPolicy::OffsetRealloc> &pool; + std::uint64_t code_size; + std::uint32_t entry_point; +}; + +constexpr inline Mode ModeFromRegister(HyperCPU::Registers reg) { + using namespace HyperCPU; + switch (reg) { + case Registers::X0: + case Registers::X1: + case Registers::X2: + case Registers::X3: + case Registers::X4: + case Registers::X5: + case Registers::X6: + case Registers::X7: + case Registers::XBP: + case Registers::XSP: + return Mode::b64; + case Registers::XH0: + case Registers::XH1: + case Registers::XH2: + case Registers::XH3: + case Registers::XH4: + case Registers::XH5: + case Registers::XH6: + case Registers::XH7: + case Registers::XL0: + case Registers::XL1: + case Registers::XL2: + case Registers::XL3: + case Registers::XL4: + case Registers::XL5: + case Registers::XL6: + case Registers::XL7: + return Mode::b32; + case Registers::XLL0: + case Registers::XLL1: + case Registers::XLL2: + case Registers::XLL3: + return Mode::b16; + case Registers::XLLH0: + case Registers::XLLH1: + case Registers::XLLH2: + case Registers::XLLH3: + case Registers::XLLL0: + case Registers::XLLL1: + case Registers::XLLL2: + case Registers::XLLL3: + return Mode::b8; + default: + UNREACHABLE(); + } +} + +std::string_view FindLine(const pog::LineSpecialization &, + const std::string_view &); +void WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult &result, + std::ofstream &output, std::uint32_t code_size, + std::uint32_t entry_point); + +[[noreturn]] void ThrowError(pog::TokenWithLineSpec &err_token, + pog::Parser &parser, std::string err_msg); + +Value TokenizeSignedInt(std::string_view str); +Value TokenizeUnsignedInt(std::string_view str); +Value TokenizeString(std::string_view str); +Value TokenizeHexadecimal(std::string_view str); +Value TokenizeIdentifier(std::string_view str); +Value TokenizeBinary(std::string_view str); +Value TokenizeChar(std::string_view str); + +Value ParseOperand1(pog::Parser &, + std::vector> &&args); +Value ParseOperand2(pog::Parser &, + std::vector> &&args); +Value ParseOperand3(pog::Parser &, + std::vector> &&args); +Value ParseOperand4(pog::Parser &, + std::vector> &&args); +Value ParseOperand5(pog::Parser &, + std::vector> &&args); +Value ParseOperand6(pog::Parser &, + std::vector> &&args); +Value ParseOperand7(pog::Parser &, + std::vector> &&args); +Value ParseOperand8(pog::Parser &, + std::vector> &&args); +Value ParseOperand9(pog::Parser &, + std::vector> &&args); +Value ParseOperand10(pog::Parser &, + std::vector> &&args); +Value ParseOperand11(pog::Parser &, + std::vector> &&args); +Value ParseOperand12(pog::Parser &, + std::vector> &&args); + +Value CompileStatement1(pog::Parser &, + std::vector> &&args); +Value CompileStatement2(pog::Parser &, + std::vector> &&args); +Value CompileStatement3(pog::Parser &, + std::vector> &&args); +Value CompileEntryLabel(pog::Parser &, + std::vector> &&args); +Value CompileLabel(pog::Parser &, + std::vector> &&args); +Value CompileRawValueb8_str(pog::Parser &, + std::vector> &&args); +Value CompileRawValueb8(pog::Parser &, + std::vector> &&args); +Value CompileRawValueb16(pog::Parser &, + std::vector> &&args); +Value CompileRawValueb32(pog::Parser &, + std::vector> &&args); +Value CompileRawValueb64(pog::Parser &, + std::vector> &&args); + +extern HyperCPU::Logger logger; +extern CompilerState *current_state; +extern std::uint64_t current_index; + +class HCAsmCompiler { +public: + HCAsmCompiler(HyperCPU::LogLevel lvl = HyperCPU::LogLevel::WARNING); + + BinaryResult Compile(std::string &contents, std::uint32_t &code_size); + CompilerState TransformToIR(std::string &src); + BinaryResult TransformToBinary(CompilerState &ir); + +private: + pog::Parser parser; + CompilerState *state; + std::queue files; + hpool::HPool, + hpool::ReallocationPolicy::OffsetRealloc> + pool; + + constexpr inline std::uint8_t OperandSize(const OperandType op); + std::uint8_t InstructionSize(Instruction &instr); + std::uint8_t ModeToSize(const Operand &op); + std::uint8_t ModeToSize(Mode md); +}; + +} // namespace HCAsm From 226aa5c40ec73707bbc3c35cdb1bee60fd49121c Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 11:57:36 +0300 Subject: [PATCH 05/23] Correct formatting --- src/Assembler/Core/Compiler.cpp | 574 ++++++++++++++++---------------- src/Assembler/Core/Compiler.hpp | 498 +++++++++++++-------------- 2 files changed, 517 insertions(+), 555 deletions(-) diff --git a/src/Assembler/Core/Compiler.cpp b/src/Assembler/Core/Compiler.cpp index 5642d952..281c1d34 100644 --- a/src/Assembler/Core/Compiler.cpp +++ b/src/Assembler/Core/Compiler.cpp @@ -1,66 +1,95 @@ #include -#include -#include #include +#include #include -#include +#include #include +#include #include #include + using HyperCPU::LogLevel; namespace HCAsm { -HyperCPU::Logger logger{HyperCPU::LogLevel::WARNING}; -HCAsm::CompilerState *current_state; -std::uint64_t current_index = 0; -} // namespace HCAsm + HyperCPU::Logger logger{HyperCPU::LogLevel::WARNING}; + HCAsm::CompilerState* current_state; + std::uint64_t current_index = 0; +} HCAsm::HCAsmCompiler::HCAsmCompiler(LogLevel lvl) : pool(32) { logger = HyperCPU::Logger{lvl}; // Setup tokens parser.token("[^\\S\n]+") - .action([this]([[maybe_unused]] std::string_view tok) -> Value { - parser.get_line_offset() += tok.length(); - return {}; - }); - parser.token("\\/\\/.*"); // Single line comment + .action([this]([[maybe_unused]] std::string_view tok) -> Value { + parser.get_line_offset() += tok.length(); + return {}; + }); + parser.token("\\/\\/.*"); // Single line comment parser.token("\\/\\*[\\S\\s]+\\*\\/"); /* Multi-line comment */ - parser.token(R"(\+)").symbol("+"); - parser.token(R"(-)").symbol("-"); - parser.token(",").symbol(","); - parser.token("\\[").symbol("["); - parser.token("\\]").symbol("]"); - parser.token(";").symbol(";"); - parser.token(":").symbol(":"); - parser.token(R"(\n)").action( - [this]([[maybe_unused]] std::string_view tok) -> Value { - ++parser.get_line_counter(); - parser.reset_line_offset(); - return {}; - }); - - parser.token(R"(\.attr\(entry\))").symbol("entry"); - - parser.token("#use").fullword().symbol("use"); - parser.token("\\.b8").fullword().symbol(".b8"); - parser.token("\\.b16").fullword().symbol(".b16"); - parser.token("\\.b32").fullword().symbol(".b32"); - parser.token("\\.b64").fullword().symbol(".b64"); + parser.token(R"(\+)") + .symbol("+"); + parser.token(R"(-)") + .symbol("-"); + parser.token(",") + .symbol(","); + parser.token("\\[") + .symbol("["); + parser.token("\\]") + .symbol("]"); + parser.token(";") + .symbol(";"); + parser.token(":") + .symbol(":"); + parser.token(R"(\n)") + .action([this]([[maybe_unused]] std::string_view tok) -> Value { + ++parser.get_line_counter(); + parser.reset_line_offset(); + return {}; + }); + + parser.token(R"(\.attr\(entry\))") + .symbol("entry"); + + parser.token("#use") + .fullword() + .symbol("use"); + parser.token("\\.b8") + .fullword() + .symbol(".b8"); + parser.token("\\.b16") + .fullword() + .symbol(".b16"); + parser.token("\\.b32") + .fullword() + .symbol(".b32"); + parser.token("\\.b64") + .fullword() + .symbol(".b64"); parser.token("[a-zA-Z_][a-zA-Z0-9_]*") - .symbol("ident") - .action(TokenizeIdentifier); + .symbol("ident") + .action(TokenizeIdentifier); parser.token("\"((?:\\\\[\\s\\S]|[^\"\\\\])*)\"") - .symbol("string") - .action(TokenizeString); - parser.token(R"(0s[0-9]+)").symbol("sint").action(TokenizeSignedInt); - parser.token(R"(0u[0-9]+)").symbol("uint").action(TokenizeUnsignedInt); - parser.token(R"(0x[0-9a-fA-F]+)").symbol("hex").action(TokenizeHexadecimal); - parser.token(R"(0b[0-1]+)").symbol("binary").action(TokenizeBinary); - parser.token(R"('.')").symbol("char").action(TokenizeChar); + .symbol("string") + .action(TokenizeString); + parser.token(R"(0s[0-9]+)") + .symbol("sint") + .action(TokenizeSignedInt); + parser.token(R"(0u[0-9]+)") + .symbol("uint") + .action(TokenizeUnsignedInt); + parser.token(R"(0x[0-9a-fA-F]+)") + .symbol("hex") + .action(TokenizeHexadecimal); + parser.token(R"(0b[0-1]+)") + .symbol("binary") + .action(TokenizeBinary); + parser.token(R"('.')") + .symbol("char") + .action(TokenizeChar); parser.end_token().action([this](std::string_view) -> Value { parser.pop_input_stream(); return {}; @@ -70,52 +99,48 @@ HCAsm::HCAsmCompiler::HCAsmCompiler(LogLevel lvl) : pool(32) { // Setup parser rules parser.set_start_symbol("statements"); parser.rule("statements") - .production("statements", "statement") - .production("statement"); - parser - .rule("statement") - /* Reserved statements */ - .production(".b8", "operand", ";", CompileRawValueb8) - .production(".b8", "string", ";", CompileRawValueb8_str) - .production(".b16", "operand", ";", CompileRawValueb16) - .production(".b32", "operand", ";", CompileRawValueb32) - .production(".b64", "operand", ";", CompileRawValueb64) - .production("ident", "operand", ",", "operand", ";", CompileStatement1) - .production("ident", "operand", ";", CompileStatement2) - .production("ident", ";", CompileStatement3) - .production("entry", "ident", ":", CompileEntryLabel) - .production("ident", ":", CompileLabel); + .production("statements", "statement") + .production("statement"); + parser.rule("statement") + /* Reserved statements */ + .production(".b8", "operand", ";", CompileRawValueb8) + .production(".b8", "string", ";", CompileRawValueb8_str) + .production(".b16", "operand", ";", CompileRawValueb16) + .production(".b32", "operand", ";", CompileRawValueb32) + .production(".b64", "operand", ";", CompileRawValueb64) + .production("ident", "operand", ",", "operand", ";", CompileStatement1) + .production("ident", "operand", ";", CompileStatement2) + .production("ident", ";", CompileStatement3) + .production("entry", "ident", ":", CompileEntryLabel) + .production("ident", ":", CompileLabel); parser.rule("operand") - .production("[", "hex", "]", ParseOperand1) - .production("[", "ident", "]", ParseOperand2) - .production("[", "ident", "+", "uint", "]", ParseOperand3) - .production("[", "ident", "+", "hex", "]", ParseOperand3) - .production("[", "ident", "+", "binary", "]", ParseOperand3) - .production("ident", "ident", "[", "hex", "]", ParseOperand4) - .production("ident", "ident", "[", "ident", "]", ParseOperand5) - .production("ident", "ident", "[", "ident", "+", "uint", "]", - ParseOperand6) - .production("ident", "ident", "[", "ident", "+", "hex", "]", - ParseOperand6) - .production("ident", "ident", "[", "ident", "+", "binary", "]", - ParseOperand6) - .production("ident", "hex", ParseOperand10) - .production("ident", "binary", ParseOperand10) - .production("ident", "uint", ParseOperand10) - .production("ident", "char", ParseOperand10) - .production("ident", "sint", ParseOperand11) - .production("ident", "ident", ParseOperand12) - .production("hex", ParseOperand8) - .production("binary", ParseOperand8) - .production("sint", ParseOperand7) - .production("uint", ParseOperand8) - .production("char", ParseOperand8) - .production("ident", ParseOperand9); + .production("[", "hex", "]", ParseOperand1) + .production("[", "ident", "]", ParseOperand2) + .production("[", "ident", "+", "uint", "]", ParseOperand3) + .production("[", "ident", "+", "hex", "]", ParseOperand3) + .production("[", "ident", "+", "binary", "]", ParseOperand3) + .production("ident", "ident", "[", "hex", "]", ParseOperand4) + .production("ident", "ident", "[", "ident", "]", ParseOperand5) + .production("ident", "ident", "[", "ident", "+", "uint", "]", ParseOperand6) + .production("ident", "ident", "[", "ident", "+", "hex", "]", ParseOperand6) + .production("ident", "ident", "[", "ident", "+", "binary", "]", ParseOperand6) + .production("ident", "hex", ParseOperand10) + .production("ident", "binary", ParseOperand10) + .production("ident", "uint", ParseOperand10) + .production("ident", "char", ParseOperand10) + .production("ident", "sint", ParseOperand11) + .production("ident", "ident", ParseOperand12) + .production("hex", ParseOperand8) + .production("binary", ParseOperand8) + .production("sint", ParseOperand7) + .production("uint", ParseOperand8) + .production("char", ParseOperand8) + .production("ident", ParseOperand9); + } -HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string &contents, - std::uint32_t &code_size) { +HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string& contents, std::uint32_t& code_size) { files.push(std::move(contents)); logger.Log(LogLevel::DEBUG, "Stage 1 compiling - transforming to IR"); @@ -128,7 +153,7 @@ HCAsm::BinaryResult HCAsm::HCAsmCompiler::Compile(std::string &contents, return binary; } -HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string &src) { +HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string& src) { CompilerState state(pool); current_state = &state; this->state = &state; @@ -143,177 +168,171 @@ HCAsm::CompilerState HCAsm::HCAsmCompiler::TransformToIR(std::string &src) { return state; } -constexpr inline std::uint8_t -HCAsm::HCAsmCompiler::OperandSize(HCAsm::OperandType op) { +constexpr inline std::uint8_t HCAsm::HCAsmCompiler::OperandSize(HCAsm::OperandType op) { switch (op) { - case HCAsm::OperandType::mem_reg_add_int: - case HCAsm::OperandType::memaddr_reg: - case HCAsm::OperandType::reg: - return 1; - case HCAsm::OperandType::memaddr_int: - case HCAsm::OperandType::sint: - case HCAsm::OperandType::uint: - case HCAsm::OperandType::label: - return 8; - default: - UNREACHABLE(); + case HCAsm::OperandType::mem_reg_add_int: + case HCAsm::OperandType::memaddr_reg: + case HCAsm::OperandType::reg: + return 1; + case HCAsm::OperandType::memaddr_int: + case HCAsm::OperandType::sint: + case HCAsm::OperandType::uint: + case HCAsm::OperandType::label: + return 8; + default: UNREACHABLE(); } } -std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(const Operand &op) { +std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(const Operand& op) { switch (op.mode) { - case Mode::b8_str: - return std::get>(op.variant)->size(); - case Mode::b8: - return 1; - case Mode::b16: - return 2; - case Mode::b32: - return 4; - case Mode::b64_label: - case Mode::b64: - return 8; - default: - ABORT(); + case Mode::b8_str: + return std::get>(op.variant)->size(); + case Mode::b8: + return 1; + case Mode::b16: + return 2; + case Mode::b32: + return 4; + case Mode::b64_label: + case Mode::b64: + return 8; + default: + ABORT(); } } std::uint8_t HCAsm::HCAsmCompiler::ModeToSize(Mode md) { switch (md) { - case Mode::b8: - return 1; - case Mode::b16: - return 2; - case Mode::b32: - return 4; - case Mode::b64_label: - case Mode::b64: - return 8; - default: - ABORT(); + case Mode::b8: + return 1; + case Mode::b16: + return 2; + case Mode::b32: + return 4; + case Mode::b64_label: + case Mode::b64: + return 8; + default: + ABORT(); } } -std::uint8_t HCAsm::HCAsmCompiler::InstructionSize(HCAsm::Instruction &instr) { +std::uint8_t HCAsm::HCAsmCompiler::InstructionSize(HCAsm::Instruction& instr) { switch (instr.opcode) { - case HyperCPU::Opcode::IRET: - return 2; - default: - break; + case HyperCPU::Opcode::IRET: + return 2; + default: + break; } - std::uint8_t result = - 3; // Opcode is always two bytes long + one byte for operand types + std::uint8_t result = 3; // Opcode is always two bytes long + one byte for operand types switch (instr.op1.type) { - case OperandType::reg: // R_* - switch (instr.op2.type) { - case OperandType::memaddr_reg: // R_RM - [[fallthrough]]; - case OperandType::reg: // R_R - result += 2; - break; - case OperandType::sint: - [[fallthrough]]; - case OperandType::uint: // R_IMM - result += 1 + ModeToSize(instr.op1); - break; - case OperandType::label: - [[fallthrough]]; - case OperandType::memaddr_int: // R_M - result += 9; + case OperandType::reg: // R_* + switch (instr.op2.type) { + case OperandType::memaddr_reg: // R_RM + [[fallthrough]]; + case OperandType::reg: // R_R + result += 2; + break; + case OperandType::sint: + [[fallthrough]]; + case OperandType::uint: // R_IMM + result += 1 + ModeToSize(instr.op1); + break; + case OperandType::label: + [[fallthrough]]; + case OperandType::memaddr_int: // R_M + result += 9; + break; + case OperandType::mem_reg_add_int: + result += 10; + break; + case OperandType::none: // R + result += 1; + break; + default: + ABORT(); + } break; case OperandType::mem_reg_add_int: - result += 10; - break; - case OperandType::none: // R - result += 1; - break; - default: - ABORT(); - } - break; - case OperandType::mem_reg_add_int: - ++result; - [[fallthrough]]; - case OperandType::memaddr_reg: - switch (instr.op2.type) { - case OperandType::reg: // RM_R - result += 2; - break; - case OperandType::sint: + ++result; [[fallthrough]]; - case OperandType::uint: // RM_IMM - result += 1 + ModeToSize(instr.op1); + case OperandType::memaddr_reg: + switch (instr.op2.type) { + case OperandType::reg: // RM_R + result += 2; + break; + case OperandType::sint: + [[fallthrough]]; + case OperandType::uint: // RM_IMM + result += 1 + ModeToSize(instr.op1); + break; + case OperandType::label: + [[fallthrough]]; + case OperandType::memaddr_int: // RM_M + result += 9; + break; + case OperandType::mem_reg_add_int: + result += 10; + break; + default: + ABORT(); + } break; - case OperandType::label: + case OperandType::sint: [[fallthrough]]; - case OperandType::memaddr_int: // RM_M - result += 9; - break; - case OperandType::mem_reg_add_int: - result += 10; + case OperandType::uint: // IMM + switch (instr.op1.mode) { + case Mode::none: + ThrowError(*(instr.op1.tokens[0]), parser, "unknown operand size"); + break; + default: + result += ModeToSize(instr.op1); + break; + } break; - default: - ABORT(); - } - break; - case OperandType::sint: - [[fallthrough]]; - case OperandType::uint: // IMM - switch (instr.op1.mode) { - case Mode::none: - ThrowError(*(instr.op1.tokens[0]), parser, "unknown operand size"); + case OperandType::memaddr_int: + result += 8; + switch (instr.op2.type) { + case OperandType::reg: // M_R + ++result; + break; + default: + ABORT(); + } break; - default: - result += ModeToSize(instr.op1); + case OperandType::label: + result += 8; break; - } - break; - case OperandType::memaddr_int: - result += 8; - switch (instr.op2.type) { - case OperandType::reg: // M_R - ++result; + case OperandType::none: break; default: ABORT(); - } - break; - case OperandType::label: - result += 8; - break; - case OperandType::none: - break; - default: - ABORT(); } return result; } -HCAsm::BinaryResult -HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState &ir) { +HCAsm::BinaryResult HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState& ir) { // Count code size - pass 1 logger.Log(LogLevel::DEBUG, "Running pass 1 - counting code size"); - for (auto &instr : ir.ir) { - VisitVariant( - instr, - [this, &ir](Instruction &instruction) mutable -> void { - ir.code_size += InstructionSize(instruction); - }, - [&ir](Label &label) mutable -> void { - ir.labels[label.name] = ir.code_size; - if (label.is_entry_point) { - ir.entry_point = ir.code_size; - } - }, - [&ir](RawValue &raw) mutable -> void { - ir.code_size += [&raw]() -> std::uint8_t { - switch (raw.mode) { + for (auto& instr : ir.ir) { + VisitVariant(instr, + [this, &ir](Instruction& instruction) mutable -> void { + ir.code_size += InstructionSize(instruction); + }, + [&ir](Label& label) mutable -> void { + ir.labels[label.name] = ir.code_size; + if (label.is_entry_point) { + ir.entry_point = ir.code_size; + } + }, + [&ir](RawValue& raw) mutable -> void { + ir.code_size += [&raw]() -> std::uint8_t { + switch (raw.mode) { case Mode::b8_str: - return std::get>(raw.value.variant) - ->size(); + return std::get>(raw.value.variant)->size(); case Mode::b8: return 1; case Mode::b16: @@ -325,39 +344,31 @@ HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState &ir) { return 8; default: ABORT(); - } - }(); - }); + } + }(); + }); } // Resolve references - pass 2 - logger.Log(LogLevel::DEBUG, - fmt::format("{} label references are waiting for resolve", - ir.pending_resolves.size())); + logger.Log(LogLevel::DEBUG, fmt::format("{} label references are waiting for resolve", ir.pending_resolves.size())); if (!ir.pending_resolves.empty()) { logger.Log(LogLevel::DEBUG, "Resolving label references"); - for (auto &args : ir.pending_resolves) { - auto &instr = ir.ir[args.idx]; - auto *op = args.op ? &std::get(instr).op2 - : &std::get(instr).op1; + for (auto& args : ir.pending_resolves) { + auto& instr = ir.ir[args.idx]; + auto* op = args.op ? &std::get(instr).op2 : &std::get(instr).op1; - if (ir.labels.contains( - *std::get>(op->variant))) { + if (ir.labels.contains(*std::get>(op->variant))) { op->type = OperandType::uint; - op->variant.emplace<0>( - ir.labels[*std::get>(op->variant)]); + op->variant.emplace<0>(ir.labels[*std::get>(op->variant)]); } else { - ThrowError( - *op->tokens[0], parser, - fmt::format("failed to resolve undefined reference to \"{}\"", - *std::get>(op->variant))); + ThrowError(*op->tokens[0], parser, fmt::format("failed to resolve undefined reference to \"{}\"", *std::get>(op->variant))); } } } // Compile code - pass 3 - BinaryResult binary = {new unsigned char[ir.code_size]}; + BinaryResult binary = { new unsigned char[ir.code_size] }; if (!binary.binary) { logger.Log(LogLevel::ERROR, "Failed to allocate memory for binary data!"); ABORT(); @@ -367,51 +378,38 @@ HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState &ir) { BinaryTransformer transformer(binary, &ir); - for (auto &instr : ir.ir) { - VisitVariant( - instr, - [&transformer](Instruction &instruction) mutable -> void { - transformer.EncodeInstruction(instruction); - }, - [&binary, &ir, this](RawValue &raw) mutable -> void { - switch (raw.mode) { + for (auto& instr : ir.ir) { + VisitVariant(instr, + [&transformer](Instruction& instruction) mutable -> void { + transformer.EncodeInstruction(instruction); + }, + [&binary, &ir, this](RawValue& raw) mutable -> void { + switch (raw.mode) { case Mode::b8_str: - binary.push( - *std::get>(raw.value.variant)); + binary.push(*std::get>(raw.value.variant)); break; - case Mode::b8: - binary.push(static_cast( - std::get(raw.value.variant))); + case Mode::b8: + binary.push(static_cast(std::get(raw.value.variant))); break; - case Mode::b16: - binary.push(static_cast( - std::get(raw.value.variant))); + case Mode::b16: + binary.push(static_cast(std::get(raw.value.variant))); break; - case Mode::b32: - binary.push(static_cast( - std::get(raw.value.variant))); + case Mode::b32: + binary.push(static_cast(std::get(raw.value.variant))); break; case Mode::b64_label: - if (!ir.labels.contains(*std::get>( - raw.value.variant))) { - ThrowError( - *raw.value.tokens[1], parser, - fmt::format("failed to resolve undefined reference to \"{}\"", - *std::get>( - raw.value.variant))); + if (!ir.labels.contains(*std::get>(raw.value.variant))) { + ThrowError(*raw.value.tokens[1], parser, fmt::format("failed to resolve undefined reference to \"{}\"", *std::get>(raw.value.variant))); } - binary.push(static_cast(ir.labels.at( - *std::get>(raw.value.variant)))); + binary.push(static_cast(ir.labels.at(*std::get>(raw.value.variant)))); break; - case Mode::b64: - binary.push(static_cast( - std::get(raw.value.variant))); + case Mode::b64: + binary.push(static_cast(std::get(raw.value.variant))); break; - default: - ABORT(); - } - }, - [](Label &) {}); + default: ABORT(); + } + }, + [](Label&){}); } binary.entry_point = ir.entry_point; @@ -419,8 +417,7 @@ HCAsm::HCAsmCompiler::TransformToBinary(HCAsm::CompilerState &ir) { return binary; } -std::string_view HCAsm::FindLine(const pog::LineSpecialization &line_spec, - const std::string_view &str) { +std::string_view HCAsm::FindLine(const pog::LineSpecialization& line_spec, const std::string_view& str) { std::size_t start = 0; std::size_t end = 0; std::size_t current_line = 1; @@ -428,7 +425,7 @@ std::string_view HCAsm::FindLine(const pog::LineSpecialization &line_spec, while (end < str.size()) { if (str[end] == '\n') { if (current_line == line_spec.line) { - return std::string_view{str.begin() + start, end - start}; + return std::string_view { str.begin() + start, end - start }; } start = end + 1; current_line++; @@ -437,36 +434,31 @@ std::string_view HCAsm::FindLine(const pog::LineSpecialization &line_spec, } if (current_line == line_spec.line) { - return std::string_view{str.begin() + start, str.end()}; + return std::string_view { str.begin() + start, str.end() }; } throw std::out_of_range("Line number out of range"); } -[[noreturn]] void HCAsm::ThrowError(pog::TokenWithLineSpec &err_token, - pog::Parser &parser, - std::string err_msg) { +[[noreturn]] void HCAsm::ThrowError(pog::TokenWithLineSpec& err_token, pog::Parser& parser, std::string err_msg) { logger.Log(HyperCPU::LogLevel::ERROR, "error: {}", err_msg); auto line = FindLine(err_token.line_spec, parser.get_top_file()); HyperCPU::println("{} | {}", err_token.line_spec.line, line); - HyperCPU::println("{:<{}} | {:<{}}{}", "", - std::to_string(err_token.line_spec.line).length(), "", - err_token.line_spec.offset, - std::string(err_token.line_spec.length, '^')); + HyperCPU::println("{:<{}} | {:<{}}{}", + "", std::to_string(err_token.line_spec.line).length(), + "", err_token.line_spec.offset, + std::string(err_token.line_spec.length, '^')); EXIT(1); } -void HCAsm::WriteResultFile(HyperCPU::FileType type, - HCAsm::BinaryResult &result, std::ofstream &output, - std::uint32_t code_size, - std::uint32_t entry_point) { +void HCAsm::WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult& result, std::ofstream& output, std::uint32_t code_size, std::uint32_t entry_point) { HyperCPU::GenericHeader gen_header; gen_header.type = type; gen_header.magic = HyperCPU::magic; gen_header.version = HyperCPU::current_version; gen_header.code_size = code_size; gen_header.entry_point = entry_point; - output.write(reinterpret_cast(&gen_header), sizeof(gen_header)); + output.write(reinterpret_cast(&gen_header), sizeof(gen_header)); - output.write(reinterpret_cast(result.binary), code_size); + output.write(reinterpret_cast(result.binary), code_size); } diff --git a/src/Assembler/Core/Compiler.hpp b/src/Assembler/Core/Compiler.hpp index bd46e4b3..c3aad60a 100644 --- a/src/Assembler/Core/Compiler.hpp +++ b/src/Assembler/Core/Compiler.hpp @@ -2,283 +2,253 @@ #include -#include -#include #include -#include +#include +#include #include -#include +#include #include +#include #include #include #include + namespace HCAsm { -enum class ValueType { - operand, - string, - sint, - uint, -}; - -enum class OperandType { - reg, - mem_reg_add_int, - sint, - uint, - memaddr_reg, - memaddr_int, - memaddr_lbl, - label, - str_lit, - none -}; - -enum class Mode : std::uint8_t { - b8 = 0b00, - b16 = 0b01, - b32 = 0b10, - b64 = 0b11, - b64_label, - b8_str, - none -}; - -struct Value; - -struct Operand { - OperandType type; - HyperCPU::Registers reg; - enum Mode mode; - bool needs_resolve; - std::array, - hpool::ReallocationPolicy::OffsetRealloc>, - 2> - tokens; - std::variant> - variant; -}; - -struct Instruction { - HyperCPU::Opcode opcode; - Operand op1, op2; -}; - -struct RawValue { - enum Mode mode; - Operand value; // Label resolver requires reference to operand -}; - -struct Value { - std::variant - val; -}; - -struct Label { - std::string name; - std::uint64_t index; - bool is_entry_point; -}; - -template -concept UnsignedIntegral = std::is_integral_v && std::is_unsigned_v; - -struct BinaryResult { - BinaryResult() : binary(nullptr), ptr(0), entry_point(0) {} - BinaryResult(unsigned char *ptr) : binary(ptr), ptr(0), entry_point(0) {} - - unsigned char *binary; - std::uint64_t ptr; - std::uint32_t entry_point; - - template constexpr inline void push(T data) { - std::memcpy(binary + ptr, &data, sizeof(data)); - ptr += sizeof(data); + enum class ValueType { + operand, + string, + sint, + uint, + }; + + enum class OperandType { + reg, + mem_reg_add_int, + sint, + uint, + memaddr_reg, + memaddr_int, + memaddr_lbl, + label, + str_lit, + none + }; + + enum class Mode : std::uint8_t { + b8 = 0b00, + b16 = 0b01, + b32 = 0b10, + b64 = 0b11, + b64_label, + b8_str, + none + }; + + struct Value; + + struct Operand { + OperandType type; + HyperCPU::Registers reg; + enum Mode mode; + bool needs_resolve; + std::array, hpool::ReallocationPolicy::OffsetRealloc>, 2> tokens; + std::variant> variant; + }; + + struct Instruction { + HyperCPU::Opcode opcode; + Operand op1, op2; + }; + + struct RawValue { + enum Mode mode; + Operand value; // Label resolver requires reference to operand + }; + + struct Value { + std::variant val; + }; + + struct Label { + std::string name; + std::uint64_t index; + bool is_entry_point; + }; + + template + concept UnsignedIntegral = std::is_integral_v && std::is_unsigned_v; + + struct BinaryResult { + BinaryResult() : binary(nullptr), ptr(0), entry_point(0) { } + BinaryResult(unsigned char* ptr) : binary(ptr), ptr(0), entry_point(0) { } + + unsigned char* binary; + std::uint64_t ptr; + std::uint32_t entry_point; + + template + constexpr inline void push(T data) { + std::memcpy(binary + ptr, &data, sizeof(data)); + ptr += sizeof(data); + } + + inline void push(const std::string& data) { + std::memcpy(binary + ptr, data.data(), data.length()); + ptr += data.length(); + } + + ~BinaryResult() { + delete[] binary; + } + }; + + struct PendingLabelReferenceResolve { + std::uint32_t idx; + std::uint8_t op; + }; + + // Some magic for std::visit + template + struct MakeOverload : T... { + using T::operator()...; + }; + + template + MakeOverload(T...) -> MakeOverload; + + template + constexpr inline decltype(auto) VisitVariant(Variant&& variant, Alternatives&&... alternatives) { + return std::visit( + MakeOverload{std::forward(alternatives)..., [](auto const&){}}, + variant + ); } - inline void push(const std::string &data) { - std::memcpy(binary + ptr, data.data(), data.length()); - ptr += data.length(); + // Needs improvements and optimizations + struct CompilerState { + CompilerState(hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc>& pool) : pool(pool), code_size(0), entry_point(0) { } + + std::vector pending_resolves; + std::vector> tmp_args; + std::vector> ir; + std::unordered_map labels; + hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc>& pool; + std::uint64_t code_size; + std::uint32_t entry_point; + }; + + constexpr inline Mode ModeFromRegister(HyperCPU::Registers reg) { + using namespace HyperCPU; + switch (reg) { + case Registers::X0: + case Registers::X1: + case Registers::X2: + case Registers::X3: + case Registers::X4: + case Registers::X5: + case Registers::X6: + case Registers::X7: + case Registers::XBP: + case Registers::XSP: + return Mode::b64; + case Registers::XH0: + case Registers::XH1: + case Registers::XH2: + case Registers::XH3: + case Registers::XH4: + case Registers::XH5: + case Registers::XH6: + case Registers::XH7: + case Registers::XL0: + case Registers::XL1: + case Registers::XL2: + case Registers::XL3: + case Registers::XL4: + case Registers::XL5: + case Registers::XL6: + case Registers::XL7: + return Mode::b32; + case Registers::XLL0: + case Registers::XLL1: + case Registers::XLL2: + case Registers::XLL3: + return Mode::b16; + case Registers::XLLH0: + case Registers::XLLH1: + case Registers::XLLH2: + case Registers::XLLH3: + case Registers::XLLL0: + case Registers::XLLL1: + case Registers::XLLL2: + case Registers::XLLL3: + return Mode::b8; + default: + UNREACHABLE(); + } } - ~BinaryResult() { delete[] binary; } -}; - -struct PendingLabelReferenceResolve { - std::uint32_t idx; - std::uint8_t op; -}; - -// Some magic for std::visit -template struct MakeOverload : T... { - using T::operator()...; -}; - -template MakeOverload(T...) -> MakeOverload; + std::string_view FindLine(const pog::LineSpecialization&, const std::string_view&); + void WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult& result, std::ofstream& output, std::uint32_t code_size, std::uint32_t entry_point); + + [[noreturn]] void ThrowError(pog::TokenWithLineSpec& err_token, pog::Parser& parser, std::string err_msg); + + Value TokenizeSignedInt(std::string_view str); + Value TokenizeUnsignedInt(std::string_view str); + Value TokenizeString(std::string_view str); + Value TokenizeHexadecimal(std::string_view str); + Value TokenizeIdentifier(std::string_view str); + Value TokenizeBinary(std::string_view str); + Value TokenizeChar(std::string_view str); + + Value ParseOperand1(pog::Parser&, std::vector>&& args); + Value ParseOperand2(pog::Parser&, std::vector>&& args); + Value ParseOperand3(pog::Parser&, std::vector>&& args); + Value ParseOperand4(pog::Parser&, std::vector>&& args); + Value ParseOperand5(pog::Parser&, std::vector>&& args); + Value ParseOperand6(pog::Parser&, std::vector>&& args); + Value ParseOperand7(pog::Parser&, std::vector>&& args); + Value ParseOperand8(pog::Parser&, std::vector>&& args); + Value ParseOperand9(pog::Parser&, std::vector>&& args); + Value ParseOperand10(pog::Parser&, std::vector>&& args); + Value ParseOperand11(pog::Parser&, std::vector>&& args); + Value ParseOperand12(pog::Parser&, std::vector>&& args); + + Value CompileStatement1(pog::Parser&, std::vector>&& args); + Value CompileStatement2(pog::Parser&, std::vector>&& args); + Value CompileStatement3(pog::Parser&, std::vector>&& args); + Value CompileEntryLabel(pog::Parser&, std::vector>&& args); + Value CompileLabel(pog::Parser&, std::vector>&& args); + Value CompileRawValueb8_str(pog::Parser&, std::vector>&& args); + Value CompileRawValueb8(pog::Parser&, std::vector>&& args); + Value CompileRawValueb16(pog::Parser&, std::vector>&& args); + Value CompileRawValueb32(pog::Parser&, std::vector>&& args); + Value CompileRawValueb64(pog::Parser&, std::vector>&& args); + + extern HyperCPU::Logger logger; + extern CompilerState* current_state; + extern std::uint64_t current_index; + + class HCAsmCompiler { + public: + HCAsmCompiler(HyperCPU::LogLevel lvl = HyperCPU::LogLevel::WARNING); + + BinaryResult Compile(std::string& contents, std::uint32_t& code_size); + CompilerState TransformToIR(std::string& src); + BinaryResult TransformToBinary(CompilerState& ir); + + private: + pog::Parser parser; + CompilerState* state; + std::queue files; + hpool::HPool, hpool::ReallocationPolicy::OffsetRealloc> pool; + + constexpr inline std::uint8_t OperandSize(const OperandType op); + std::uint8_t InstructionSize(Instruction& instr); + std::uint8_t ModeToSize(const Operand& op); + std::uint8_t ModeToSize(Mode md); + }; -template -constexpr inline decltype(auto) VisitVariant(Variant &&variant, - Alternatives &&...alternatives) { - return std::visit(MakeOverload{std::forward(alternatives)..., - [](auto const &) {}}, - variant); } - -// Needs improvements and optimizations -struct CompilerState { - CompilerState(hpool::HPool, - hpool::ReallocationPolicy::OffsetRealloc> &pool) - : pool(pool), code_size(0), entry_point(0) {} - - std::vector pending_resolves; - std::vector> tmp_args; - std::vector> ir; - std::unordered_map labels; - hpool::HPool, - hpool::ReallocationPolicy::OffsetRealloc> &pool; - std::uint64_t code_size; - std::uint32_t entry_point; -}; - -constexpr inline Mode ModeFromRegister(HyperCPU::Registers reg) { - using namespace HyperCPU; - switch (reg) { - case Registers::X0: - case Registers::X1: - case Registers::X2: - case Registers::X3: - case Registers::X4: - case Registers::X5: - case Registers::X6: - case Registers::X7: - case Registers::XBP: - case Registers::XSP: - return Mode::b64; - case Registers::XH0: - case Registers::XH1: - case Registers::XH2: - case Registers::XH3: - case Registers::XH4: - case Registers::XH5: - case Registers::XH6: - case Registers::XH7: - case Registers::XL0: - case Registers::XL1: - case Registers::XL2: - case Registers::XL3: - case Registers::XL4: - case Registers::XL5: - case Registers::XL6: - case Registers::XL7: - return Mode::b32; - case Registers::XLL0: - case Registers::XLL1: - case Registers::XLL2: - case Registers::XLL3: - return Mode::b16; - case Registers::XLLH0: - case Registers::XLLH1: - case Registers::XLLH2: - case Registers::XLLH3: - case Registers::XLLL0: - case Registers::XLLL1: - case Registers::XLLL2: - case Registers::XLLL3: - return Mode::b8; - default: - UNREACHABLE(); - } -} - -std::string_view FindLine(const pog::LineSpecialization &, - const std::string_view &); -void WriteResultFile(HyperCPU::FileType type, HCAsm::BinaryResult &result, - std::ofstream &output, std::uint32_t code_size, - std::uint32_t entry_point); - -[[noreturn]] void ThrowError(pog::TokenWithLineSpec &err_token, - pog::Parser &parser, std::string err_msg); - -Value TokenizeSignedInt(std::string_view str); -Value TokenizeUnsignedInt(std::string_view str); -Value TokenizeString(std::string_view str); -Value TokenizeHexadecimal(std::string_view str); -Value TokenizeIdentifier(std::string_view str); -Value TokenizeBinary(std::string_view str); -Value TokenizeChar(std::string_view str); - -Value ParseOperand1(pog::Parser &, - std::vector> &&args); -Value ParseOperand2(pog::Parser &, - std::vector> &&args); -Value ParseOperand3(pog::Parser &, - std::vector> &&args); -Value ParseOperand4(pog::Parser &, - std::vector> &&args); -Value ParseOperand5(pog::Parser &, - std::vector> &&args); -Value ParseOperand6(pog::Parser &, - std::vector> &&args); -Value ParseOperand7(pog::Parser &, - std::vector> &&args); -Value ParseOperand8(pog::Parser &, - std::vector> &&args); -Value ParseOperand9(pog::Parser &, - std::vector> &&args); -Value ParseOperand10(pog::Parser &, - std::vector> &&args); -Value ParseOperand11(pog::Parser &, - std::vector> &&args); -Value ParseOperand12(pog::Parser &, - std::vector> &&args); - -Value CompileStatement1(pog::Parser &, - std::vector> &&args); -Value CompileStatement2(pog::Parser &, - std::vector> &&args); -Value CompileStatement3(pog::Parser &, - std::vector> &&args); -Value CompileEntryLabel(pog::Parser &, - std::vector> &&args); -Value CompileLabel(pog::Parser &, - std::vector> &&args); -Value CompileRawValueb8_str(pog::Parser &, - std::vector> &&args); -Value CompileRawValueb8(pog::Parser &, - std::vector> &&args); -Value CompileRawValueb16(pog::Parser &, - std::vector> &&args); -Value CompileRawValueb32(pog::Parser &, - std::vector> &&args); -Value CompileRawValueb64(pog::Parser &, - std::vector> &&args); - -extern HyperCPU::Logger logger; -extern CompilerState *current_state; -extern std::uint64_t current_index; - -class HCAsmCompiler { -public: - HCAsmCompiler(HyperCPU::LogLevel lvl = HyperCPU::LogLevel::WARNING); - - BinaryResult Compile(std::string &contents, std::uint32_t &code_size); - CompilerState TransformToIR(std::string &src); - BinaryResult TransformToBinary(CompilerState &ir); - -private: - pog::Parser parser; - CompilerState *state; - std::queue files; - hpool::HPool, - hpool::ReallocationPolicy::OffsetRealloc> - pool; - - constexpr inline std::uint8_t OperandSize(const OperandType op); - std::uint8_t InstructionSize(Instruction &instr); - std::uint8_t ModeToSize(const Operand &op); - std::uint8_t ModeToSize(Mode md); -}; - -} // namespace HCAsm From 9f4a6b1fbe34bbdd13f25430cb3792878911187c Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 12:01:27 +0300 Subject: [PATCH 06/23] Don't include fmt/base.h --- src/pch.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pch.hpp b/src/pch.hpp index 2a0f83c9..09b3da93 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include From 3b8cfc7f4702ba7968be7385ef43fe10277badbf Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:16:59 +0300 Subject: [PATCH 07/23] Include pch.hpp instead of some system headers --- src/Assembler/Core/Parsers.cpp | 5 ++--- src/Assembler/Core/Tokenizers.cpp | 5 ----- src/Assembler/Main/Main.cpp | 4 +--- src/Assembler/Utils/Extension.hpp | 4 ++-- src/BacktraceProvider/BacktraceProvider.cpp | 10 +--------- src/BacktraceProvider/BacktraceProvider.hpp | 4 ++-- src/Emulator/Core/CPU/ALU.hpp | 7 ++----- src/Emulator/Core/CPU/Assert.hpp | 2 +- src/Emulator/Core/CPU/CPU.cpp | 4 ++-- src/Emulator/Core/CPU/CPU.hpp | 7 +------ src/Emulator/Core/CPU/Decoders/StdDecoder.cpp | 3 +-- src/Emulator/Core/CPU/IO/Simple.cpp | 6 ++---- src/Emulator/Core/CPU/IO/Simple.hpp | 3 +-- src/Emulator/Core/CPU/Instructions/AllowedFlags.cpp | 2 +- src/Emulator/Core/CPU/Instructions/AllowedFlags.hpp | 4 ++-- src/Emulator/Core/CPU/Instructions/Flags.hpp | 4 ++-- src/Emulator/Core/CPU/Instructions/Opcodes.hpp | 2 +- src/Emulator/Core/CPU/Instructions/Registers.hpp | 4 ++-- src/Emulator/Core/CPU/InstructionsImpl/ADC.cpp | 2 -- src/Emulator/Core/CPU/Interrupts/InterruptHandler.cpp | 2 -- src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp | 0 src/Emulator/Core/CPU/OperandsEvaluation.cpp | 2 -- .../Core/MemoryController/IMemoryController.hpp | 4 +--- .../Core/MemoryController/MemoryControllerST.hpp | 7 ------- src/Emulator/Main/ExceptionHandling.hpp | 4 ++-- src/Emulator/Main/Main.cpp | 5 ----- src/Emulator/Main/Main.hpp | 6 +----- src/Emulator/Misc/bit_cast.hpp | 5 +---- src/Emulator/Misc/byteswap.hpp | 3 +-- src/Emulator/Misc/overflow.hpp | 2 +- src/Emulator/Misc/print.hpp | 3 +-- src/Logger/Logger.hpp | 5 +---- 32 files changed, 35 insertions(+), 95 deletions(-) create mode 100644 src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp diff --git a/src/Assembler/Core/Parsers.cpp b/src/Assembler/Core/Parsers.cpp index b3a30dd7..8998a0cd 100644 --- a/src/Assembler/Core/Parsers.cpp +++ b/src/Assembler/Core/Parsers.cpp @@ -3,7 +3,6 @@ #include #include -#include using HCAsm::Value; @@ -262,7 +261,7 @@ Value HCAsm::ParseOperand11(pog::Parser& parser, std::vector& parser, std::vector -#include -#include - #include - using HCAsm::Value; [[gnu::visibility("hidden")]] diff --git a/src/Assembler/Main/Main.cpp b/src/Assembler/Main/Main.cpp index 5a8e6954..723737fd 100644 --- a/src/Assembler/Main/Main.cpp +++ b/src/Assembler/Main/Main.cpp @@ -1,6 +1,4 @@ -#include -#include -#include +#include #include #include diff --git a/src/Assembler/Utils/Extension.hpp b/src/Assembler/Utils/Extension.hpp index 2c2d6b2f..89885b5c 100644 --- a/src/Assembler/Utils/Extension.hpp +++ b/src/Assembler/Utils/Extension.hpp @@ -1,7 +1,7 @@ #pragma once -#include +#include namespace HCAsm { std::string CreateObjectFilename(std::string str); -} \ No newline at end of file +} diff --git a/src/BacktraceProvider/BacktraceProvider.cpp b/src/BacktraceProvider/BacktraceProvider.cpp index 51e320a6..e4e8b5c2 100644 --- a/src/BacktraceProvider/BacktraceProvider.cpp +++ b/src/BacktraceProvider/BacktraceProvider.cpp @@ -1,17 +1,9 @@ #ifdef HCPU_ENABLE_LIBUNWIND -#include - -#include -#include -#include -#include - #define UNW_LOCAL_ONLY #include #include -#include #include #include @@ -115,4 +107,4 @@ bool BacktraceController::HasFinished() { return finished; } -#endif \ No newline at end of file +#endif diff --git a/src/BacktraceProvider/BacktraceProvider.hpp b/src/BacktraceProvider/BacktraceProvider.hpp index 4b0d8d55..d9a7f371 100644 --- a/src/BacktraceProvider/BacktraceProvider.hpp +++ b/src/BacktraceProvider/BacktraceProvider.hpp @@ -1,5 +1,5 @@ #ifdef HCPU_ENABLE_LIBUNWIND -#include +#include #include #include @@ -37,4 +37,4 @@ extern std::string_view catched_signal_type; extern "C" void SignalHandler(int); -#endif \ No newline at end of file +#endif diff --git a/src/Emulator/Core/CPU/ALU.hpp b/src/Emulator/Core/CPU/ALU.hpp index 0fcf21fd..43a10c90 100644 --- a/src/Emulator/Core/CPU/ALU.hpp +++ b/src/Emulator/Core/CPU/ALU.hpp @@ -1,9 +1,6 @@ #pragma once -#include -#include - -#include +#include #define _MICROOP [[gnu::always_inline]] static constexpr inline @@ -63,4 +60,4 @@ namespace HyperCPU{ // Simplify switching implementations namespace HyperALU { using namespace HyperCPU::StdALU; -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/Assert.hpp b/src/Emulator/Core/CPU/Assert.hpp index aedb1ae4..b023891a 100644 --- a/src/Emulator/Core/CPU/Assert.hpp +++ b/src/Emulator/Core/CPU/Assert.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #define h_assert(expr, statement) if (!(expr)) { statement; } diff --git a/src/Emulator/Core/CPU/CPU.cpp b/src/Emulator/Core/CPU/CPU.cpp index 1e22176e..345f16c8 100644 --- a/src/Emulator/Core/CPU/CPU.cpp +++ b/src/Emulator/Core/CPU/CPU.cpp @@ -1,5 +1,5 @@ #include "Logger/Logger.hpp" -#include +#include #include #include @@ -281,4 +281,4 @@ void HyperCPU::CPU::SetEntryPoint(std::uint32_t entry_point) { const HyperCPU::Logger& HyperCPU::CPU::GetLogger() const noexcept { return logger; -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/CPU.hpp b/src/Emulator/Core/CPU/CPU.hpp index 5b3ece74..44ce8c9d 100644 --- a/src/Emulator/Core/CPU/CPU.hpp +++ b/src/Emulator/Core/CPU/CPU.hpp @@ -1,12 +1,7 @@ #pragma once #include "Logger/Logger.hpp" -#include - -#include -#include -#include -#include +#include #include #include diff --git a/src/Emulator/Core/CPU/Decoders/StdDecoder.cpp b/src/Emulator/Core/CPU/Decoders/StdDecoder.cpp index e85f9bea..ab71cc04 100644 --- a/src/Emulator/Core/CPU/Decoders/StdDecoder.cpp +++ b/src/Emulator/Core/CPU/Decoders/StdDecoder.cpp @@ -1,5 +1,4 @@ -#include -#include +#include #include #include diff --git a/src/Emulator/Core/CPU/IO/Simple.cpp b/src/Emulator/Core/CPU/IO/Simple.cpp index a1cbb195..44b9f918 100644 --- a/src/Emulator/Core/CPU/IO/Simple.cpp +++ b/src/Emulator/Core/CPU/IO/Simple.cpp @@ -1,6 +1,4 @@ -#include -#include -#include +#include #include #include @@ -75,4 +73,4 @@ void HyperCPU::SimpleIOImpl::EnablePrinting() { newt.c_lflag |= ECHO; newt.c_lflag |= ECHONL; tcsetattr(STDIN_FILENO, TCSANOW, &newt); -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/IO/Simple.hpp b/src/Emulator/Core/CPU/IO/Simple.hpp index 6da4d254..1e5e892e 100644 --- a/src/Emulator/Core/CPU/IO/Simple.hpp +++ b/src/Emulator/Core/CPU/IO/Simple.hpp @@ -1,5 +1,4 @@ -#include -#include +#include #include #include diff --git a/src/Emulator/Core/CPU/Instructions/AllowedFlags.cpp b/src/Emulator/Core/CPU/Instructions/AllowedFlags.cpp index 0c4b8603..d7b9050d 100644 --- a/src/Emulator/Core/CPU/Instructions/AllowedFlags.cpp +++ b/src/Emulator/Core/CPU/Instructions/AllowedFlags.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/src/Emulator/Core/CPU/Instructions/AllowedFlags.hpp b/src/Emulator/Core/CPU/Instructions/AllowedFlags.hpp index ec736f73..91bf3e93 100644 --- a/src/Emulator/Core/CPU/Instructions/AllowedFlags.hpp +++ b/src/Emulator/Core/CPU/Instructions/AllowedFlags.hpp @@ -1,10 +1,10 @@ #pragma once -#include +#include namespace HyperCPU { static constexpr std::uint8_t SUPPORT_ALL = 0b00011011; extern const std::uint8_t allowed_op_modes[128][12]; -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/Instructions/Flags.hpp b/src/Emulator/Core/CPU/Instructions/Flags.hpp index 79f4fda3..e9527d48 100644 --- a/src/Emulator/Core/CPU/Instructions/Flags.hpp +++ b/src/Emulator/Core/CPU/Instructions/Flags.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include namespace HyperCPU { @@ -27,4 +27,4 @@ namespace HyperCPU { }; static constexpr std::uint_fast8_t MAX_OPERAND_TYPE = NONE; -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/Instructions/Opcodes.hpp b/src/Emulator/Core/CPU/Instructions/Opcodes.hpp index b7fce565..935defbc 100644 --- a/src/Emulator/Core/CPU/Instructions/Opcodes.hpp +++ b/src/Emulator/Core/CPU/Instructions/Opcodes.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #define OPCODE_CASE(opcode) case static_cast(opcode): diff --git a/src/Emulator/Core/CPU/Instructions/Registers.hpp b/src/Emulator/Core/CPU/Instructions/Registers.hpp index c78c0e48..99c021aa 100644 --- a/src/Emulator/Core/CPU/Instructions/Registers.hpp +++ b/src/Emulator/Core/CPU/Instructions/Registers.hpp @@ -1,6 +1,6 @@ #pragma once -#include +#include #define REGISTER_CASE(reg) case static_cast(reg): @@ -68,4 +68,4 @@ namespace HyperCPU { } } } -} \ No newline at end of file +} diff --git a/src/Emulator/Core/CPU/InstructionsImpl/ADC.cpp b/src/Emulator/Core/CPU/InstructionsImpl/ADC.cpp index 1488dd08..7ac39356 100644 --- a/src/Emulator/Core/CPU/InstructionsImpl/ADC.cpp +++ b/src/Emulator/Core/CPU/InstructionsImpl/ADC.cpp @@ -1,5 +1,3 @@ -#include - #include #include diff --git a/src/Emulator/Core/CPU/Interrupts/InterruptHandler.cpp b/src/Emulator/Core/CPU/Interrupts/InterruptHandler.cpp index 61ae1095..6c25e43a 100644 --- a/src/Emulator/Core/CPU/Interrupts/InterruptHandler.cpp +++ b/src/Emulator/Core/CPU/Interrupts/InterruptHandler.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp b/src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp new file mode 100644 index 00000000..e69de29b diff --git a/src/Emulator/Core/CPU/OperandsEvaluation.cpp b/src/Emulator/Core/CPU/OperandsEvaluation.cpp index dd08c08d..ba8968e7 100644 --- a/src/Emulator/Core/CPU/OperandsEvaluation.cpp +++ b/src/Emulator/Core/CPU/OperandsEvaluation.cpp @@ -1,5 +1,3 @@ -#include - #include #include #include diff --git a/src/Emulator/Core/MemoryController/IMemoryController.hpp b/src/Emulator/Core/MemoryController/IMemoryController.hpp index 9883c37f..732aaf59 100644 --- a/src/Emulator/Core/MemoryController/IMemoryController.hpp +++ b/src/Emulator/Core/MemoryController/IMemoryController.hpp @@ -1,8 +1,6 @@ #pragma once -#include -#include -#include +#include #include diff --git a/src/Emulator/Core/MemoryController/MemoryControllerST.hpp b/src/Emulator/Core/MemoryController/MemoryControllerST.hpp index 60778c4b..98b14bf0 100644 --- a/src/Emulator/Core/MemoryController/MemoryControllerST.hpp +++ b/src/Emulator/Core/MemoryController/MemoryControllerST.hpp @@ -1,12 +1,5 @@ #pragma once -#include -#include -#include -#include - -#include - #include #include #include diff --git a/src/Emulator/Main/ExceptionHandling.hpp b/src/Emulator/Main/ExceptionHandling.hpp index 3e9e8537..48968374 100644 --- a/src/Emulator/Main/ExceptionHandling.hpp +++ b/src/Emulator/Main/ExceptionHandling.hpp @@ -1,10 +1,10 @@ #pragma once -#include +#include namespace HyperCPU { class CPU; [[noreturn]] void ThrowError(CPU* cpu, std::string message); -} \ No newline at end of file +} diff --git a/src/Emulator/Main/Main.cpp b/src/Emulator/Main/Main.cpp index 1b824434..7eb6036f 100644 --- a/src/Emulator/Main/Main.cpp +++ b/src/Emulator/Main/Main.cpp @@ -1,8 +1,3 @@ -#include -#include - -#include - #include #include #include diff --git a/src/Emulator/Main/Main.hpp b/src/Emulator/Main/Main.hpp index 2bcdded0..3eef498e 100644 --- a/src/Emulator/Main/Main.hpp +++ b/src/Emulator/Main/Main.hpp @@ -1,10 +1,6 @@ #pragma once -#include -#include - -#include -#include +#include namespace HyperCPU { diff --git a/src/Emulator/Misc/bit_cast.hpp b/src/Emulator/Misc/bit_cast.hpp index 42651749..f9edb30c 100644 --- a/src/Emulator/Misc/bit_cast.hpp +++ b/src/Emulator/Misc/bit_cast.hpp @@ -1,9 +1,6 @@ #pragma once -#include -#include - -#include +#include namespace HyperCPU { diff --git a/src/Emulator/Misc/byteswap.hpp b/src/Emulator/Misc/byteswap.hpp index 0ab1a202..a6582a0b 100644 --- a/src/Emulator/Misc/byteswap.hpp +++ b/src/Emulator/Misc/byteswap.hpp @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include #include diff --git a/src/Emulator/Misc/overflow.hpp b/src/Emulator/Misc/overflow.hpp index 616b4bcb..bd2e8bce 100644 --- a/src/Emulator/Misc/overflow.hpp +++ b/src/Emulator/Misc/overflow.hpp @@ -13,4 +13,4 @@ namespace HyperCPU { constexpr bool multiplication_will_overflow(T& a, T& b) { return (a != 0 && (static_cast(a * b)) / a != b); } -} \ No newline at end of file +} diff --git a/src/Emulator/Misc/print.hpp b/src/Emulator/Misc/print.hpp index 95ccf972..8afb99ad 100644 --- a/src/Emulator/Misc/print.hpp +++ b/src/Emulator/Misc/print.hpp @@ -1,7 +1,6 @@ #pragma once -#include -#include +#include namespace HyperCPU { template diff --git a/src/Logger/Logger.hpp b/src/Logger/Logger.hpp index 8f114047..3600f664 100644 --- a/src/Logger/Logger.hpp +++ b/src/Logger/Logger.hpp @@ -1,9 +1,6 @@ #pragma once -#include - -#include -#include +#include #include #include From f98a71a6cdefaed1999073c556affc114213d760 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:17:59 +0300 Subject: [PATCH 08/23] add ```#pragma once``` --- src/pch.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pch.hpp b/src/pch.hpp index 09b3da93..fa7520ac 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -2,6 +2,7 @@ * Precompiled headers * *Only add headers that will not be modified!* */ +#pragma once #include #include #include From e3b2fdf073e3b7648d485ec1822f02c376c41135 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:18:27 +0300 Subject: [PATCH 09/23] update a comment --- src/pch.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pch.hpp b/src/pch.hpp index fa7520ac..4815e115 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -1,6 +1,6 @@ /* * Precompiled headers - * *Only add headers that will not be modified!* + * ! Only add headers that will not be modified ! */ #pragma once #include From e2f44e775e0c7e5a16a7fcbacc5e9d91a0f01625 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:34:59 +0300 Subject: [PATCH 10/23] Switch from gtest/gtest.h to pch.hpp --- test/CMakeLists.txt | 2 ++ test/Integration/AssemblerCore/AssemblerFail.cpp | 5 ++--- test/Integration/AssemblerCore/FullAssembler.cpp | 2 +- test/Integration/AssemblerCore/TwoOperandsSuccess.cpp | 3 +-- test/Integration/EmulatorCore/CPU/CPU_POP.cpp | 2 +- test/Integration/EmulatorCore/CPU/CPU_PUSH.cpp | 2 +- test/Integration/EmulatorCore/CPU/CPU_READ.cpp | 2 +- test/Integration/EmulatorCore/CPU/CPU_WRITE.cpp | 2 +- test/Modular/EmulatorCore/CPUInit/CPUInit.cpp | 4 ++-- test/Modular/EmulatorCore/Decoding/ADCInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADCInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADCInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADCInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/ADCInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADDInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADDInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADDInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ADDInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/ADDInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/ANDInstr/Unsupported.cpp | 2 +- .../Modular/EmulatorCore/Decoding/ANDNInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDNInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDNInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ANDNInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/ANDNInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/BSWAPInstr/R.cpp | 2 +- .../EmulatorCore/Decoding/BSWAPInstr/Unsupported.cpp | 2 +- .../Decoding/CALLEInstr/test_decoder_imm.cpp | 2 +- .../Decoding/CALLEInstr/test_decoder_r.cpp | 2 +- .../Decoding/CALLEInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/CALLGRInstr/test_decoder_imm.cpp | 2 +- .../Decoding/CALLGRInstr/test_decoder_r.cpp | 2 +- .../Decoding/CALLGRInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/CALLInstr/test_decoder_imm.cpp | 2 +- .../Decoding/CALLInstr/test_decoder_r.cpp | 2 +- .../Decoding/CALLInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/CALLLInstr/test_decoder_imm.cpp | 2 +- .../Decoding/CALLLInstr/test_decoder_r.cpp | 2 +- .../Decoding/CALLLInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/CCRFInstr/test_decoder_none.cpp | 2 +- .../Decoding/CCRFInstr/test_decoder_unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/M_R.cpp | 2 +- .../Modular/EmulatorCore/Decoding/CMPInstr/RM_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/RM_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/RM_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CMPInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/CMPInstr/Unsupported.cpp | 2 +- .../Decoding/COVFInstr/test_decoder_none.cpp | 2 +- .../Decoding/COVFInstr/test_decoder_unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/CUDFInstr/None.cpp | 2 +- .../EmulatorCore/Decoding/CUDFInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/DECInstr/R.cpp | 2 +- .../EmulatorCore/Decoding/DECInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/DIVInstr/R.cpp | 2 +- .../EmulatorCore/Decoding/DIVInstr/Unsupported.cpp | 2 +- .../Decoding/Features/AddressAddition.cpp | 2 +- test/Modular/EmulatorCore/Decoding/HALTInstr/None.cpp | 2 +- .../EmulatorCore/Decoding/HALTInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/HIDInstr/None.cpp | 2 +- .../EmulatorCore/Decoding/HIDInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/INCInstr/R.cpp | 2 +- .../EmulatorCore/Decoding/INCInstr/Unsupported.cpp | 2 +- .../Decoding/JMEInstr/test_decoder_imm.cpp | 2 +- .../EmulatorCore/Decoding/JMEInstr/test_decoder_r.cpp | 2 +- .../Decoding/JMEInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/JMGRInstr/test_decoder_imm.cpp | 2 +- .../Decoding/JMGRInstr/test_decoder_r.cpp | 2 +- .../Decoding/JMGRInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/JMLInstr/test_decoder_imm.cpp | 2 +- .../EmulatorCore/Decoding/JMLInstr/test_decoder_r.cpp | 2 +- .../Decoding/JMLInstr/test_decoder_unsupported.cpp | 2 +- .../Decoding/JMPInstr/test_decoder_imm.cpp | 2 +- .../EmulatorCore/Decoding/JMPInstr/test_decoder_r.cpp | 2 +- .../Decoding/JMPInstr/test_decoder_unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/M_R.cpp | 2 +- .../Modular/EmulatorCore/Decoding/MOVInstr/RM_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/RM_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/RM_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MOVInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/MOVInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MULInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MULInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MULInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/MULInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/MULInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ORInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ORInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ORInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/ORInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/ORInstr/Unsupported.cpp | 2 +- .../Modular/EmulatorCore/Decoding/SHFLInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SHFLInstr/R_R.cpp | 2 +- .../EmulatorCore/Decoding/SHFLInstr/Unsupported.cpp | 2 +- .../Modular/EmulatorCore/Decoding/SHFRInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SHFRInstr/R_R.cpp | 2 +- .../EmulatorCore/Decoding/SHFRInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SUBInstr/R_IMM.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SUBInstr/R_M.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SUBInstr/R_R.cpp | 2 +- test/Modular/EmulatorCore/Decoding/SUBInstr/R_RM.cpp | 2 +- .../EmulatorCore/Decoding/SUBInstr/Unsupported.cpp | 2 +- test/Modular/EmulatorCore/MemoryControllers/ST.cpp | 2 +- test/fixtures.hpp | 2 +- test/main.cpp | 11 +++++------ test/pch.hpp | 9 +++++++++ 115 files changed, 130 insertions(+), 122 deletions(-) create mode 100644 test/pch.hpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 77e5ec8a..32a90565 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,10 +8,12 @@ set(TESTS_INCLUDE_DIR add_executable(modular_testing ${ROOT_DIR}/test/main.cpp ${SOURCES_modular_testing}) target_link_libraries(modular_testing emulator-core assembler-core gtest pthread) target_include_directories(modular_testing PUBLIC ${TESTS_INCLUDE_DIR}) +target_precompile_headers(modular_testing PRIVATE pch.hpp) add_executable(integration_testing ${ROOT_DIR}/test/main.cpp ${SOURCES_integration_testing}) target_link_libraries(integration_testing emulator-core assembler-core gtest pthread) target_include_directories(integration_testing PUBLIC ${TESTS_INCLUDE_DIR}) +target_precompile_headers(integration_testing PRIVATE pch.hpp) add_custom_target(run-all-tests-github ${CMAKE_BINARY_DIR}/modular_testing --gtest_brief=1 diff --git a/test/Integration/AssemblerCore/AssemblerFail.cpp b/test/Integration/AssemblerCore/AssemblerFail.cpp index 0f66ab8b..729337be 100644 --- a/test/Integration/AssemblerCore/AssemblerFail.cpp +++ b/test/Integration/AssemblerCore/AssemblerFail.cpp @@ -1,5 +1,4 @@ -#include "gtest/gtest.h" -#include +#include #include @@ -79,4 +78,4 @@ TEST_F(ASSEMBLER, RAWVALUEb32_CANT_USE_LABEL) { auto state(compiler.TransformToIR(data)); auto binary = compiler.TransformToBinary(state); }, ::testing::ExitedWithCode(1), ".*"); -} \ No newline at end of file +} diff --git a/test/Integration/AssemblerCore/FullAssembler.cpp b/test/Integration/AssemblerCore/FullAssembler.cpp index 1f356e37..5d8c3a45 100644 --- a/test/Integration/AssemblerCore/FullAssembler.cpp +++ b/test/Integration/AssemblerCore/FullAssembler.cpp @@ -1,7 +1,7 @@ #include #include "Main/Main.hpp" #include "Misc/bit_cast.hpp" -#include +#include TEST_F(FULL_ASSEMBLER, MULTUPLE_INSTRUCTIONS) { std::string data = "_start:\n\tmov x0, 0u1;\n\tmov x1, 0u2;\n\tadd x0, x1;"; diff --git a/test/Integration/AssemblerCore/TwoOperandsSuccess.cpp b/test/Integration/AssemblerCore/TwoOperandsSuccess.cpp index 3e46499a..90a0768b 100644 --- a/test/Integration/AssemblerCore/TwoOperandsSuccess.cpp +++ b/test/Integration/AssemblerCore/TwoOperandsSuccess.cpp @@ -1,5 +1,4 @@ -#include "gtest/gtest.h" -#include +#include #include TEST_F(TWO_OPERANDS_SUCCESS, OPERANDS_R_R_b8) { diff --git a/test/Integration/EmulatorCore/CPU/CPU_POP.cpp b/test/Integration/EmulatorCore/CPU/CPU_POP.cpp index 3c0d2dd1..c3f0e279 100644 --- a/test/Integration/EmulatorCore/CPU/CPU_POP.cpp +++ b/test/Integration/EmulatorCore/CPU/CPU_POP.cpp @@ -1,7 +1,7 @@ #include "Core/CPU/Instructions/Registers.hpp" #include #include -#include +#include #include // TODO: fix include order diff --git a/test/Integration/EmulatorCore/CPU/CPU_PUSH.cpp b/test/Integration/EmulatorCore/CPU/CPU_PUSH.cpp index a21fcef4..a53a5849 100644 --- a/test/Integration/EmulatorCore/CPU/CPU_PUSH.cpp +++ b/test/Integration/EmulatorCore/CPU/CPU_PUSH.cpp @@ -1,7 +1,7 @@ #include "Core/CPU/Instructions/Registers.hpp" #include #include -#include +#include #include // TODO: fix include order diff --git a/test/Integration/EmulatorCore/CPU/CPU_READ.cpp b/test/Integration/EmulatorCore/CPU/CPU_READ.cpp index 5579e193..3b37ab86 100644 --- a/test/Integration/EmulatorCore/CPU/CPU_READ.cpp +++ b/test/Integration/EmulatorCore/CPU/CPU_READ.cpp @@ -1,6 +1,6 @@ #include "Core/CPU/Instructions/Flags.hpp" #include -#include +#include TEST_F(CPU_TEST, INSTR_READ) { cpu.read_io_handlers[1] = []() -> std::uint8_t { diff --git a/test/Integration/EmulatorCore/CPU/CPU_WRITE.cpp b/test/Integration/EmulatorCore/CPU/CPU_WRITE.cpp index 9c35493d..a22b25d9 100644 --- a/test/Integration/EmulatorCore/CPU/CPU_WRITE.cpp +++ b/test/Integration/EmulatorCore/CPU/CPU_WRITE.cpp @@ -1,7 +1,7 @@ #include "Core/CPU/Instructions/Registers.hpp" #include #include -#include +#include TEST_F(CPU_TEST, INSTR_WRITE) { std::uint8_t t = 0; diff --git a/test/Modular/EmulatorCore/CPUInit/CPUInit.cpp b/test/Modular/EmulatorCore/CPUInit/CPUInit.cpp index b629d5ce..90b36c9d 100644 --- a/test/Modular/EmulatorCore/CPUInit/CPUInit.cpp +++ b/test/Modular/EmulatorCore/CPUInit/CPUInit.cpp @@ -1,5 +1,5 @@ #include "Logger/Logger.hpp" -#include +#include #define private public #include @@ -58,4 +58,4 @@ TEST(cpu_init, REGS_ARE_INITIALIZED) { ASSERT_EQ(*cpu.xlll1, CONSTLLL); ASSERT_EQ(*cpu.xlll2, CONSTLLL); ASSERT_EQ(*cpu.xlll3, CONSTLLL); -} \ No newline at end of file +} diff --git a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_IMM.cpp index 3024973a..93367eef 100644 --- a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_M.cpp index 80aa96af..63292394 100644 --- a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_R.cpp index 656eb331..fea4eb62 100644 --- a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_RM.cpp index a3cd065d..2969d0d9 100644 --- a/test/Modular/EmulatorCore/Decoding/ADCInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADCInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADCInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/ADCInstr/Unsupported.cpp index 37f329ea..7842368c 100644 --- a/test/Modular/EmulatorCore/Decoding/ADCInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADCInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_IMM.cpp index 8a93b83f..5181066f 100644 --- a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_M.cpp index ee3bb28a..8769ee31 100644 --- a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_R.cpp index 5455ae9a..1f1be59f 100644 --- a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_RM.cpp index a8c73195..929f8fee 100644 --- a/test/Modular/EmulatorCore/Decoding/ADDInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADDInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ADDInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/ADDInstr/Unsupported.cpp index 09d87958..0134f74c 100644 --- a/test/Modular/EmulatorCore/Decoding/ADDInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/ADDInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_IMM.cpp index cbe0c66d..d0d0348d 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_M.cpp index dab0f119..c971500c 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_R.cpp index 4b31a02d..eab05738 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_RM.cpp index 01d5d5c1..1d8668d0 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/ANDInstr/Unsupported.cpp index ce23de62..e700978b 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_IMM.cpp index e1ed78e0..b106d04d 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_M.cpp index 61184e85..76946b51 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_R.cpp index 708613e8..22fbd0d7 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_RM.cpp index f804b4bc..ca0f266b 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDNInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ANDNInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/ANDNInstr/Unsupported.cpp index 4178a427..e1abbb8a 100644 --- a/test/Modular/EmulatorCore/Decoding/ANDNInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/ANDNInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/BSWAPInstr/R.cpp b/test/Modular/EmulatorCore/Decoding/BSWAPInstr/R.cpp index ce117333..f7d7f1ac 100644 --- a/test/Modular/EmulatorCore/Decoding/BSWAPInstr/R.cpp +++ b/test/Modular/EmulatorCore/Decoding/BSWAPInstr/R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/BSWAPInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/BSWAPInstr/Unsupported.cpp index 50d54aff..d72adcd8 100644 --- a/test/Modular/EmulatorCore/Decoding/BSWAPInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/BSWAPInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_imm.cpp index 301e27fc..8783bb4c 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_r.cpp index d876ee3d..e7951311 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_unsupported.cpp index 1da94a84..402dcec6 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLEInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_imm.cpp index 48c447ce..65bcd9f4 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_r.cpp index 83e0fae9..008b5d90 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_unsupported.cpp index f30d0dfc..979b0765 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLGRInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_imm.cpp index 5c66a533..f77dc42b 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_r.cpp index ff460041..a7e0d0bf 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_unsupported.cpp index 12cc1c0e..67009369 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_imm.cpp index d1f65a6b..067e8987 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_r.cpp index 2c0e4477..f92c59b3 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_unsupported.cpp index b4b2fd03..be12d0f6 100644 --- a/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CALLLInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_none.cpp b/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_none.cpp index adc91f9b..0683c5f1 100644 --- a/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_none.cpp +++ b/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_none.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_unsupported.cpp index 325197ec..181a25e9 100644 --- a/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CCRFInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/M_R.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/M_R.cpp index 797b0cd3..52982253 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/M_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/M_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_IMM.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_IMM.cpp index a41a6fac..40291f86 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_IMM.cpp @@ -1,5 +1,5 @@ #include "Core/CPU/Instructions/Opcodes.hpp" -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_M.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_M.cpp index f759af81..ab27064d 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_M.cpp @@ -1,5 +1,5 @@ #include "Core/CPU/Instructions/Opcodes.hpp" -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_R.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_R.cpp index 1d0f9b5a..41cf2225 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/RM_R.cpp @@ -1,5 +1,5 @@ #include "Core/CPU/Instructions/Opcodes.hpp" -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_IMM.cpp index d89fe152..05df334d 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_M.cpp index 7171d3d1..ee676fd6 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_R.cpp index 99ba4669..12562412 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_R.cpp @@ -1,5 +1,5 @@ #include "Core/CPU/Instructions/Opcodes.hpp" -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_RM.cpp index ef23a53d..bfac9b4a 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CMPInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CMPInstr/Unsupported.cpp index effb939d..69f76cb6 100644 --- a/test/Modular/EmulatorCore/Decoding/CMPInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CMPInstr/Unsupported.cpp @@ -1,5 +1,5 @@ #include "Core/CPU/Instructions/Opcodes.hpp" -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_none.cpp b/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_none.cpp index 2bc4f1a4..0309d7dd 100644 --- a/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_none.cpp +++ b/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_none.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_unsupported.cpp index 3901d4b7..5e8f4471 100644 --- a/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/COVFInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CUDFInstr/None.cpp b/test/Modular/EmulatorCore/Decoding/CUDFInstr/None.cpp index c711475f..617fa98f 100644 --- a/test/Modular/EmulatorCore/Decoding/CUDFInstr/None.cpp +++ b/test/Modular/EmulatorCore/Decoding/CUDFInstr/None.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/CUDFInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/CUDFInstr/Unsupported.cpp index 06792fc7..7c8610d6 100644 --- a/test/Modular/EmulatorCore/Decoding/CUDFInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/CUDFInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/DECInstr/R.cpp b/test/Modular/EmulatorCore/Decoding/DECInstr/R.cpp index 865abaaa..a1c5e6d7 100644 --- a/test/Modular/EmulatorCore/Decoding/DECInstr/R.cpp +++ b/test/Modular/EmulatorCore/Decoding/DECInstr/R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/DECInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/DECInstr/Unsupported.cpp index dd3049c7..2894ea33 100644 --- a/test/Modular/EmulatorCore/Decoding/DECInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/DECInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/DIVInstr/R.cpp b/test/Modular/EmulatorCore/Decoding/DIVInstr/R.cpp index babe348f..2c8e14b5 100644 --- a/test/Modular/EmulatorCore/Decoding/DIVInstr/R.cpp +++ b/test/Modular/EmulatorCore/Decoding/DIVInstr/R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/DIVInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/DIVInstr/Unsupported.cpp index ba39d651..feb0e0ee 100644 --- a/test/Modular/EmulatorCore/Decoding/DIVInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/DIVInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/Features/AddressAddition.cpp b/test/Modular/EmulatorCore/Decoding/Features/AddressAddition.cpp index 63820f88..c98f7602 100644 --- a/test/Modular/EmulatorCore/Decoding/Features/AddressAddition.cpp +++ b/test/Modular/EmulatorCore/Decoding/Features/AddressAddition.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/HALTInstr/None.cpp b/test/Modular/EmulatorCore/Decoding/HALTInstr/None.cpp index e0347582..ad3e8cc7 100644 --- a/test/Modular/EmulatorCore/Decoding/HALTInstr/None.cpp +++ b/test/Modular/EmulatorCore/Decoding/HALTInstr/None.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/HALTInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/HALTInstr/Unsupported.cpp index 85a92849..0058bdbe 100644 --- a/test/Modular/EmulatorCore/Decoding/HALTInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/HALTInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/HIDInstr/None.cpp b/test/Modular/EmulatorCore/Decoding/HIDInstr/None.cpp index f23950e3..fb62a22e 100644 --- a/test/Modular/EmulatorCore/Decoding/HIDInstr/None.cpp +++ b/test/Modular/EmulatorCore/Decoding/HIDInstr/None.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/HIDInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/HIDInstr/Unsupported.cpp index d6deaf85..dbe29ceb 100644 --- a/test/Modular/EmulatorCore/Decoding/HIDInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/HIDInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/INCInstr/R.cpp b/test/Modular/EmulatorCore/Decoding/INCInstr/R.cpp index 6332352b..1b3cef74 100644 --- a/test/Modular/EmulatorCore/Decoding/INCInstr/R.cpp +++ b/test/Modular/EmulatorCore/Decoding/INCInstr/R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/INCInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/INCInstr/Unsupported.cpp index 1c6a4882..f526d0ff 100644 --- a/test/Modular/EmulatorCore/Decoding/INCInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/INCInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_imm.cpp index 433ca30d..91badc23 100644 --- a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_r.cpp index e0cf150a..711241c8 100644 --- a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_unsupported.cpp index ced445f3..627ac599 100644 --- a/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMEInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_imm.cpp index ad823d7d..4346c7ac 100644 --- a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_r.cpp index 6bddc46c..338eb801 100644 --- a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_unsupported.cpp index 4a9f3f98..a8fefb53 100644 --- a/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMGRInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_imm.cpp index 07a4facb..2b5309d7 100644 --- a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_r.cpp index 3f79e24c..4863e775 100644 --- a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_unsupported.cpp index 8135e6ba..b8b08ea4 100644 --- a/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMLInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_imm.cpp b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_imm.cpp index bf028c6e..81e383d9 100644 --- a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_imm.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_imm.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_r.cpp b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_r.cpp index 68a9c6f9..5ebd7cc2 100644 --- a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_r.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_r.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_unsupported.cpp b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_unsupported.cpp index 299f5f3b..dcd2275a 100644 --- a/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/JMPInstr/test_decoder_unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/M_R.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/M_R.cpp index e338150d..6149e53a 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/M_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/M_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_IMM.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_IMM.cpp index d34d9425..49bfaba8 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_M.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_M.cpp index c858a637..4fb39107 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_R.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_R.cpp index 9bfe2eb8..d5c6d070 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/RM_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_IMM.cpp index 0248e2f1..efa8a810 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_M.cpp index 780f2f46..9a8e9fb5 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_R.cpp index 8201fa86..7ae422cc 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_RM.cpp index 45094886..27ebe652 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MOVInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/MOVInstr/Unsupported.cpp index bd67928a..3b52a0ae 100644 --- a/test/Modular/EmulatorCore/Decoding/MOVInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/MOVInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MULInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/MULInstr/R_IMM.cpp index 77a63d82..c438616a 100644 --- a/test/Modular/EmulatorCore/Decoding/MULInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/MULInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MULInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/MULInstr/R_M.cpp index 757f15f3..fbdda4e8 100644 --- a/test/Modular/EmulatorCore/Decoding/MULInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/MULInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MULInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/MULInstr/R_R.cpp index 21c0478e..455e77d3 100644 --- a/test/Modular/EmulatorCore/Decoding/MULInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/MULInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MULInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/MULInstr/R_RM.cpp index 88fb81fd..ace4469a 100644 --- a/test/Modular/EmulatorCore/Decoding/MULInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/MULInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/MULInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/MULInstr/Unsupported.cpp index 3af5114e..0caab6d3 100644 --- a/test/Modular/EmulatorCore/Decoding/MULInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/MULInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ORInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/ORInstr/R_IMM.cpp index 73b565dd..f7e45048 100644 --- a/test/Modular/EmulatorCore/Decoding/ORInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ORInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ORInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/ORInstr/R_M.cpp index b753f2c9..05f54a34 100644 --- a/test/Modular/EmulatorCore/Decoding/ORInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/ORInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ORInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/ORInstr/R_R.cpp index 2e480a02..00333a58 100644 --- a/test/Modular/EmulatorCore/Decoding/ORInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/ORInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ORInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/ORInstr/R_RM.cpp index fe211a8e..94d37544 100644 --- a/test/Modular/EmulatorCore/Decoding/ORInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/ORInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/ORInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/ORInstr/Unsupported.cpp index 562bc748..a15d590f 100644 --- a/test/Modular/EmulatorCore/Decoding/ORInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/ORInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_IMM.cpp index 80714e7d..fc22a6ba 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_R.cpp index 9ad9546e..b7f61219 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFLInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFLInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/SHFLInstr/Unsupported.cpp index e9d16091..3e467e1d 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFLInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFLInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_IMM.cpp index 89027997..5a4dea2d 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_R.cpp index 1337ad0c..8acdf295 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFRInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SHFRInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/SHFRInstr/Unsupported.cpp index 7820074f..4214a15f 100644 --- a/test/Modular/EmulatorCore/Decoding/SHFRInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/SHFRInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_IMM.cpp b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_IMM.cpp index ffb92ce9..afd3ff85 100644 --- a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_IMM.cpp +++ b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_IMM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_M.cpp b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_M.cpp index 7d3dd257..b0e4247b 100644 --- a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_M.cpp +++ b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_M.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_R.cpp b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_R.cpp index 3a638c97..cc81b32a 100644 --- a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_R.cpp +++ b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_R.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_RM.cpp b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_RM.cpp index 7cc4ff3a..3d9105f1 100644 --- a/test/Modular/EmulatorCore/Decoding/SUBInstr/R_RM.cpp +++ b/test/Modular/EmulatorCore/Decoding/SUBInstr/R_RM.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/Decoding/SUBInstr/Unsupported.cpp b/test/Modular/EmulatorCore/Decoding/SUBInstr/Unsupported.cpp index a960a8ed..c12c1a57 100644 --- a/test/Modular/EmulatorCore/Decoding/SUBInstr/Unsupported.cpp +++ b/test/Modular/EmulatorCore/Decoding/SUBInstr/Unsupported.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/Modular/EmulatorCore/MemoryControllers/ST.cpp b/test/Modular/EmulatorCore/MemoryControllers/ST.cpp index dd04f8cc..1831f660 100644 --- a/test/Modular/EmulatorCore/MemoryControllers/ST.cpp +++ b/test/Modular/EmulatorCore/MemoryControllers/ST.cpp @@ -1,4 +1,4 @@ -#include +#include #include diff --git a/test/fixtures.hpp b/test/fixtures.hpp index bf4b0cd1..2b8b7eb1 100644 --- a/test/fixtures.hpp +++ b/test/fixtures.hpp @@ -2,7 +2,7 @@ #include #include -#include +#include #define private public #include diff --git a/test/main.cpp b/test/main.cpp index d0b1fde3..7c30f193 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,9 +1,8 @@ -#include - +#include int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} \ No newline at end of file + ::testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} diff --git a/test/pch.hpp b/test/pch.hpp new file mode 100644 index 00000000..15ccee58 --- /dev/null +++ b/test/pch.hpp @@ -0,0 +1,9 @@ +/* + * Precompiled headers + * ! Only add headers that will not be modified ! + */ +#pragma once +#include +#include +#include +#include From 86d228ae527010a5cb8b5f15442c1798221ff504 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:36:56 +0300 Subject: [PATCH 11/23] Remove non-existent header --- test/pch.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/pch.hpp b/test/pch.hpp index 15ccee58..9ae050bf 100644 --- a/test/pch.hpp +++ b/test/pch.hpp @@ -6,4 +6,3 @@ #include #include #include -#include From d0473f3ee1e72fcd059d4428aa59508544863d36 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:39:31 +0300 Subject: [PATCH 12/23] Remove ```#pragma once``` in pch's --- src/pch.hpp | 1 - test/pch.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/pch.hpp b/src/pch.hpp index 4815e115..55951a1d 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -2,7 +2,6 @@ * Precompiled headers * ! Only add headers that will not be modified ! */ -#pragma once #include #include #include diff --git a/test/pch.hpp b/test/pch.hpp index 9ae050bf..73edfa27 100644 --- a/test/pch.hpp +++ b/test/pch.hpp @@ -2,7 +2,6 @@ * Precompiled headers * ! Only add headers that will not be modified ! */ -#pragma once #include #include #include From 4dfe2acc1e837d312ee3a515a5c318b900d47b50 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:41:51 +0300 Subject: [PATCH 13/23] Fix recursive includes --- test/pch.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/pch.hpp b/test/pch.hpp index 73edfa27..80275f2f 100644 --- a/test/pch.hpp +++ b/test/pch.hpp @@ -4,4 +4,3 @@ */ #include #include -#include From ac0715361fd18dba33ce2aaf431209d180dba782 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 13:43:38 +0300 Subject: [PATCH 14/23] Add fmt/base.h to pch.hpp --- src/pch.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pch.hpp b/src/pch.hpp index 55951a1d..ec10b68b 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include From 6923ab54715055453a2d535e9496a629233409d6 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 14:28:12 +0300 Subject: [PATCH 15/23] Revert ac07153 --- src/pch.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pch.hpp b/src/pch.hpp index ec10b68b..55951a1d 100644 --- a/src/pch.hpp +++ b/src/pch.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include From 406b9643d5daeb96e64ce07f57ba8d3b9af84869 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 14:31:42 +0300 Subject: [PATCH 16/23] Include only needed headers in Emulator/Misc/print.hpp --- src/Emulator/Misc/print.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Emulator/Misc/print.hpp b/src/Emulator/Misc/print.hpp index 8afb99ad..95ccf972 100644 --- a/src/Emulator/Misc/print.hpp +++ b/src/Emulator/Misc/print.hpp @@ -1,6 +1,7 @@ #pragma once -#include +#include +#include namespace HyperCPU { template From 3336bb08124d85ee1173323ac9fb657a70729a76 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 14:34:04 +0300 Subject: [PATCH 17/23] Include only needed headers in Emulator/Misc/bit_cast.hpp --- src/Emulator/Misc/bit_cast.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Emulator/Misc/bit_cast.hpp b/src/Emulator/Misc/bit_cast.hpp index f9edb30c..42651749 100644 --- a/src/Emulator/Misc/bit_cast.hpp +++ b/src/Emulator/Misc/bit_cast.hpp @@ -1,6 +1,9 @@ #pragma once -#include +#include +#include + +#include namespace HyperCPU { From b2e96e5c87a3b8f75f74253e0acf9c1aff1e3599 Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 14:44:23 +0300 Subject: [PATCH 18/23] Update pch --- test/fixtures.hpp | 1 - test/pch.hpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures.hpp b/test/fixtures.hpp index 2b8b7eb1..1b642695 100644 --- a/test/fixtures.hpp +++ b/test/fixtures.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/test/pch.hpp b/test/pch.hpp index 80275f2f..2dacb8ab 100644 --- a/test/pch.hpp +++ b/test/pch.hpp @@ -4,3 +4,4 @@ */ #include #include +#include From ea9506ce3cdd1993d7a0720ad56beccc83baa96d Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 16:07:08 +0300 Subject: [PATCH 19/23] Fix workflow --- .github/workflows/distro-ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/distro-ci.yml b/.github/workflows/distro-ci.yml index 56848d43..1f1409c7 100644 --- a/.github/workflows/distro-ci.yml +++ b/.github/workflows/distro-ci.yml @@ -34,13 +34,15 @@ jobs: name: Ubuntu steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: 'true' + - run: | set -e DISTRO=$( cat /etc/*-release | tr [:upper:] [:lower:] | grep -Poi '(debian|ubuntu|fedora|gentoo|alpine)' | uniq ) if [ "$DISTRO" == "gentoo" ]; then source /etc/profile; fi - git clone https://github.com/HyperWinX/HyperCPU.git && cd HyperCPU - git switch "${{ github.head_ref }}" - git submodule update --init --recursive cd dist/pog && git pull origin master && cd ../.. cmake -S. -Bbuild -DHCPU_COMPILER=clang -DHCPU_LTO=ON -DHCPU_SANITIZERS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build --target run-all-tests-github -j8 From 2e6f21e7887b8f9eb8d2a4a881c2d6e97cf2bd6a Mon Sep 17 00:00:00 2001 From: aceinetx Date: Tue, 15 Apr 2025 17:44:26 +0300 Subject: [PATCH 20/23] Remove empty header that I created for some reason --- src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp diff --git a/src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp b/src/Emulator/Core/CPU/Interrupts/InterruptHandler.hpp deleted file mode 100644 index e69de29b..00000000 From 211e5fe23b6cc87aee1a26d3d368baeacabf353e Mon Sep 17 00:00:00 2001 From: aceinetx Date: Fri, 18 Apr 2025 07:37:36 +0300 Subject: [PATCH 21/23] Revert workflow fix --- .github/workflows/distro-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/distro-ci.yml b/.github/workflows/distro-ci.yml index 1f1409c7..56848d43 100644 --- a/.github/workflows/distro-ci.yml +++ b/.github/workflows/distro-ci.yml @@ -34,15 +34,13 @@ jobs: name: Ubuntu steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: 'true' - - run: | set -e DISTRO=$( cat /etc/*-release | tr [:upper:] [:lower:] | grep -Poi '(debian|ubuntu|fedora|gentoo|alpine)' | uniq ) if [ "$DISTRO" == "gentoo" ]; then source /etc/profile; fi + git clone https://github.com/HyperWinX/HyperCPU.git && cd HyperCPU + git switch "${{ github.head_ref }}" + git submodule update --init --recursive cd dist/pog && git pull origin master && cd ../.. cmake -S. -Bbuild -DHCPU_COMPILER=clang -DHCPU_LTO=ON -DHCPU_SANITIZERS=OFF -DCMAKE_BUILD_TYPE=Release cmake --build build --target run-all-tests-github -j8 From 0f932b30f14ea31927bdb01744fa99a42351421a Mon Sep 17 00:00:00 2001 From: aceinetx Date: Fri, 18 Apr 2025 07:47:20 +0300 Subject: [PATCH 22/23] Update distro-ci workflow --- .github/workflows/distro-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/distro-ci.yml b/.github/workflows/distro-ci.yml index 56848d43..16c06003 100644 --- a/.github/workflows/distro-ci.yml +++ b/.github/workflows/distro-ci.yml @@ -38,8 +38,8 @@ jobs: set -e DISTRO=$( cat /etc/*-release | tr [:upper:] [:lower:] | grep -Poi '(debian|ubuntu|fedora|gentoo|alpine)' | uniq ) if [ "$DISTRO" == "gentoo" ]; then source /etc/profile; fi - git clone https://github.com/HyperWinX/HyperCPU.git && cd HyperCPU - git switch "${{ github.head_ref }}" + git clone https://github.com/${{ github.repository }}.git + git checkout ${{ github.event.pull_request.head.sha }} git submodule update --init --recursive cd dist/pog && git pull origin master && cd ../.. cmake -S. -Bbuild -DHCPU_COMPILER=clang -DHCPU_LTO=ON -DHCPU_SANITIZERS=OFF -DCMAKE_BUILD_TYPE=Release From 34515a8b763b2e6408ea73efa297687d3b07acbe Mon Sep 17 00:00:00 2001 From: aceinetx Date: Fri, 18 Apr 2025 09:09:21 +0300 Subject: [PATCH 23/23] Update workflow --- .github/workflows/distro-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/distro-ci.yml b/.github/workflows/distro-ci.yml index 16c06003..247af7e0 100644 --- a/.github/workflows/distro-ci.yml +++ b/.github/workflows/distro-ci.yml @@ -38,7 +38,7 @@ jobs: set -e DISTRO=$( cat /etc/*-release | tr [:upper:] [:lower:] | grep -Poi '(debian|ubuntu|fedora|gentoo|alpine)' | uniq ) if [ "$DISTRO" == "gentoo" ]; then source /etc/profile; fi - git clone https://github.com/${{ github.repository }}.git + git clone https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git && cd HyperCPU git checkout ${{ github.event.pull_request.head.sha }} git submodule update --init --recursive cd dist/pog && git pull origin master && cd ../..