diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-04 21:36:54 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-04 21:48:09 +0100 |
| commit | 6cda526bd4efcee31b1ea7405dc46d7985ba64e6 (patch) | |
| tree | f7d138fd5652cdc0e7a2c4918b36d754969d6cf5 /CompilerKit/AsmKit/AsmKit.hpp | |
| parent | 60271b79a91a06772241aed737426f5d097ca533 (diff) | |
masm: fix assembler bug where addr1, 0x0 (add r1, 0x0) doesn't error
out.
cc/ccplus: minor compiler changes, will get to them very soon...
refactor: rename C++Kit to CompilerKit.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerKit/AsmKit/AsmKit.hpp')
| -rw-r--r-- | CompilerKit/AsmKit/AsmKit.hpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/CompilerKit/AsmKit/AsmKit.hpp b/CompilerKit/AsmKit/AsmKit.hpp new file mode 100644 index 0000000..f512507 --- /dev/null +++ b/CompilerKit/AsmKit/AsmKit.hpp @@ -0,0 +1,63 @@ +/* + * ======================================================== + * + * C++Kit + * Copyright Western Company, all rights reserved. + * + * ======================================================== + */ + +#pragma once + +#include <CompilerKit/Compiler.hpp> +#include <CompilerKit/Defines.hpp> +#include <CompilerKit/StdKit/String.hpp> + +namespace CompilerKit +{ + // + // @brief Frontend to Assembly mountpoint. + // + class AssemblyMountpoint + { + public: + explicit AssemblyMountpoint() = default; + virtual ~AssemblyMountpoint() = default; + + CXXKIT_COPY_DEFAULT(AssemblyMountpoint); + + //@ brief compile to object file. + // Example C++ -> MASM -> AE object. + virtual Int32 CompileToFormat(StringView& src, Int32 arch) = 0; + + }; + + /// @brief Simple assembly factory + class AssemblyFactory final + { + public: + explicit AssemblyFactory() = default; + ~AssemblyFactory() = default; + + CXXKIT_COPY_DEFAULT(AssemblyFactory); + + public: + enum + { + kArchAMD64, + kArch32x0, + kArch64x0, + kArchRISCV, + kArchUnknown, + }; + + Int32 Compile(StringView& sourceFile, const Int32& arch) noexcept; + + void Mount(AssemblyMountpoint* mountPtr) noexcept; + AssemblyMountpoint* Unmount() noexcept; + + private: + AssemblyMountpoint* fMounted{ nullptr }; + + }; +} |
