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 /CompilerDriver/cc.cc | |
| 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 'CompilerDriver/cc.cc')
| -rw-r--r-- | CompilerDriver/cc.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/CompilerDriver/cc.cc b/CompilerDriver/cc.cc index 4135be0..d3f48d8 100644 --- a/CompilerDriver/cc.cc +++ b/CompilerDriver/cc.cc @@ -13,8 +13,8 @@ #include <fstream> #include <iostream> #include <uuid/uuid.h> -#include <C++Kit/AsmKit/Arch/64k.hpp> -#include <C++Kit/ParserKit.hpp> +#include <CompilerKit/AsmKit/Arch/64k.hpp> +#include <CompilerKit/ParserKit.hpp> #define kOk 0 @@ -134,7 +134,7 @@ static std::string kRegisterPrefix = kAsmRegisterPrefix; ///////////////////////////////////////// static std::vector<std::string> kFileList; -static CxxKit::AssemblyFactory kFactory; +static CompilerKit::AssemblyFactory kFactory; static bool kInStruct = false; static bool kOnWhileLoop = false; static bool kOnForLoop = false; @@ -1619,7 +1619,7 @@ next: ///////////////////////////////////////////////////////////////////////////////////////// -class AssemblyMountpointClang final : public CxxKit::AssemblyMountpoint +class AssemblyMountpointClang final : public CompilerKit::AssemblyMountpoint { public: explicit AssemblyMountpointClang() = default; @@ -1627,9 +1627,9 @@ public: CXXKIT_COPY_DEFAULT(AssemblyMountpointClang); - [[maybe_unused]] static Int32 Arch() noexcept { return CxxKit::AssemblyFactory::kArchRISCV; } + [[maybe_unused]] static Int32 Arch() noexcept { return CompilerKit::AssemblyFactory::kArchRISCV; } - Int32 CompileToFormat(CxxKit::StringView& src, Int32 arch) override + Int32 CompileToFormat(CompilerKit::StringView& src, Int32 arch) override { if (arch != AssemblyMountpointClang::Arch()) return -1; @@ -1657,7 +1657,7 @@ public: kState.fOutputAssembly = std::make_unique<std::ofstream>(dest); - auto fmt = CxxKit::current_date(); + auto fmt = CompilerKit::current_date(); (*kState.fOutputAssembly) << "# Path: " << src_file << "\n"; (*kState.fOutputAssembly) << "# Language: MP-UX Assembly\n"; @@ -1688,6 +1688,10 @@ public: std::vector<std::string> keywords = { "ldw", "stw", "lda", "sta", "add", "dec", "mv"}; + /// + /// Replace, optimize, fix assembly output. + /// + for (auto& leaf : kState.fSyntaxTree->fLeafList) { for (auto& keyword : keywords) @@ -1835,7 +1839,7 @@ int main(int argc, char** argv) delete kFactory.Unmount(); kFactory.Mount(new AssemblyMountpointClang()); - kMachine = CxxKit::AssemblyFactory::kArchRISCV; + kMachine = CompilerKit::AssemblyFactory::kArchRISCV; continue; } @@ -1875,7 +1879,7 @@ int main(int argc, char** argv) kFileList.emplace_back(argv[index]); - CxxKit::StringView srcFile = CxxKit::StringBuilder::Construct(argv[index]); + CompilerKit::StringView srcFile = CompilerKit::StringBuilder::Construct(argv[index]); if (strstr(argv[index], kExt) == nullptr) { |
