summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/AssemblyInterface.h
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-05-07 09:18:33 +0200
committerAmlal <amlal@nekernel.org>2025-05-07 09:18:33 +0200
commitd8d943929c25151fd6a8aadd6ea4cdbd5065845a (patch)
tree137147035caca99ed27431039b65b9ab61546d35 /dev/LibCompiler/AssemblyInterface.h
parent23d3e00324b7f691a893df7e73462b9b73c03a4f (diff)
feat(LibCompiler): Reworking architecture to integrate the Arch() method in the AssemblyInterface.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/AssemblyInterface.h')
-rw-r--r--dev/LibCompiler/AssemblyInterface.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/dev/LibCompiler/AssemblyInterface.h b/dev/LibCompiler/AssemblyInterface.h
index 5450f84..b612962 100644
--- a/dev/LibCompiler/AssemblyInterface.h
+++ b/dev/LibCompiler/AssemblyInterface.h
@@ -13,19 +13,8 @@
#define ASSEMBLY_INTERFACE : public LibCompiler::AssemblyInterface
namespace LibCompiler {
-/// @brief Assembly to binary generator class.
-/// @note This interface creates according to the CPU target of the child class.
-class AssemblyInterface {
- public:
- explicit AssemblyInterface() = default;
- virtual ~AssemblyInterface() = default;
-
- LIBCOMPILER_COPY_DEFAULT(AssemblyInterface);
-
- /// @brief compile to object file.
- /// @note Example C++ -> MASM -> AE object.
- virtual Int32 CompileToFormat(std::string src, Int32 arch) = 0;
-};
+class AssemblyFactory;
+class AssemblyInterface;
/// @brief Simple assembly factory
class AssemblyFactory final {
@@ -37,7 +26,8 @@ class AssemblyFactory final {
public:
enum {
- kArchAMD64,
+ kArchInvalid = 0,
+ kArchAMD64 = 100,
kArch32x0,
kArch64x0,
kArchRISCV,
@@ -55,6 +45,22 @@ class AssemblyFactory final {
AssemblyInterface* fMounted{nullptr};
};
+/// @brief Assembly to binary generator class.
+/// @note This interface creates according to the CPU target of the child class.
+class AssemblyInterface {
+ public:
+ explicit AssemblyInterface() = default;
+ virtual ~AssemblyInterface() = default;
+
+ LIBCOMPILER_COPY_DEFAULT(AssemblyInterface);
+
+ [[maybe_unused]] virtual Int32 Arch() noexcept { return AssemblyFactory::kArchAMD64; }
+
+ /// @brief compile to object file.
+ /// @note Example C++ -> MASM -> AE object.
+ virtual Int32 CompileToFormat(std::string src, Int32 arch) = 0;
+};
+
union NumberCastBase {
NumberCastBase() = default;
~NumberCastBase() = default;