summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-21 10:47:26 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-21 10:47:26 +0100
commitb960a3bc9800ff689e31ca94263ed9aaa2921a96 (patch)
treeaaa5a3e9d38ea9a0244f445402dfdf893753739b
parent0f8af01ad3a8c5a47821d23333568732f21131a5 (diff)
CompilerKit: Replace kAsmFileExt64x0 with array kAsmFileExts.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--CompilerKit/AsmKit/Arch/32x0.hpp (renamed from CompilerKit/AsmKit/Arch/32k.hpp)4
-rw-r--r--CompilerKit/AsmKit/Arch/64x0.hpp (renamed from CompilerKit/AsmKit/Arch/64k.hpp)4
-rw-r--r--CompilerKit/AsmKit/AsmKit.cc6
-rw-r--r--CompilerKit/Defines.hpp2
-rw-r--r--CompilerKit/StdKit/AE.hpp4
-rw-r--r--Drivers/64asm.cc9
-rw-r--r--Drivers/bccl.cc5
-rw-r--r--Drivers/ccplus.cc6
-rw-r--r--ReadMe.md6
9 files changed, 28 insertions, 18 deletions
diff --git a/CompilerKit/AsmKit/Arch/32k.hpp b/CompilerKit/AsmKit/Arch/32x0.hpp
index 291abfe..28bf754 100644
--- a/CompilerKit/AsmKit/Arch/32k.hpp
+++ b/CompilerKit/AsmKit/Arch/32x0.hpp
@@ -12,14 +12,14 @@
#include <CompilerKit/Defines.hpp>
// @brief 32x0 support.
-// @file Arch/64k.hpp
+// @file Arch/32x0.hpp
#define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \
{ .fName = __NAME, .fOpcode = __OPCODE, .fFunct3 = __FUNCT3, .fFunct7 = __FUNCT7 },
-// placeholder for funct7/funct7-rs2
+
#define kAsmImmediate 0x01
#define kAsmSyscall 0x02
#define kAsmJump 0x03
diff --git a/CompilerKit/AsmKit/Arch/64k.hpp b/CompilerKit/AsmKit/Arch/64x0.hpp
index 95d635f..161bc06 100644
--- a/CompilerKit/AsmKit/Arch/64k.hpp
+++ b/CompilerKit/AsmKit/Arch/64x0.hpp
@@ -12,13 +12,13 @@
#include <CompilerKit/Defines.hpp>
// @brief 64x0 support.
-// @file Arch/64k.hpp
+// @file Arch/64x0.hpp
#define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \
{ .fName = __NAME, .fOpcode = __OPCODE, .fFunct3 = __FUNCT3, .fFunct7 = __FUNCT7 },
-// placeholder for funct7/funct7-rs2
+
#define kAsmImmediate 0x01
#define kAsmRegToReg 0x02
#define kAsmSyscall 0x03
diff --git a/CompilerKit/AsmKit/AsmKit.cc b/CompilerKit/AsmKit/AsmKit.cc
index 3118e56..1e8ec4a 100644
--- a/CompilerKit/AsmKit/AsmKit.cc
+++ b/CompilerKit/AsmKit/AsmKit.cc
@@ -13,7 +13,7 @@
#include <iostream>
//! @file AsmKit.cpp
-//! @brief AssemblyKit
+//! @brief AssemblyKit source implementation.
namespace CompilerKit
{
@@ -32,7 +32,9 @@ namespace CompilerKit
void AssemblyFactory::Mount(AssemblyMountpoint* mountPtr) noexcept
{
if (mountPtr)
+ {
fMounted = mountPtr;
+ }
}
AssemblyMountpoint* AssemblyFactory::Unmount() noexcept
@@ -40,7 +42,9 @@ namespace CompilerKit
auto mount_prev = fMounted;
if (mount_prev)
+ {
fMounted = nullptr;
+ }
return mount_prev;
}
diff --git a/CompilerKit/Defines.hpp b/CompilerKit/Defines.hpp
index c29417d..d46508d 100644
--- a/CompilerKit/Defines.hpp
+++ b/CompilerKit/Defines.hpp
@@ -134,6 +134,6 @@ namespace CompilerKit
typedef char char_type;
#define kObjectFileExt ".o"
-#define kAsmFileExt64x0 ".64x"
+#define kAsmFileExts { ".64x", ".32x", ".masm", ".s", ".S" }
#endif /* ifndef __CXXKIT_DEFINES_HPP__ */
diff --git a/CompilerKit/StdKit/AE.hpp b/CompilerKit/StdKit/AE.hpp
index 403d7cb..8843404 100644
--- a/CompilerKit/StdKit/AE.hpp
+++ b/CompilerKit/StdKit/AE.hpp
@@ -97,10 +97,10 @@ namespace CompilerKit::Utils
std::ifstream USED_FP;
public:
- explicit AEReadableProtocol() = default;
+ AEReadableProtocol() = default;
~AEReadableProtocol() = default;
- CXXKIT_COPY_DEFAULT(AEReadableProtocol);
+ CXXKIT_COPY_DELETE(AEReadableProtocol);
AERecordHeaderPtr Read(char* raw, std::size_t sz)
{
diff --git a/Drivers/64asm.cc b/Drivers/64asm.cc
index 85a516e..cead067 100644
--- a/Drivers/64asm.cc
+++ b/Drivers/64asm.cc
@@ -20,7 +20,7 @@
#define __ASM_NEED_64x0__ 1
-#include <CompilerKit/AsmKit/Arch/64k.hpp>
+#include <CompilerKit/AsmKit/Arch/64x0.hpp>
#include <CompilerKit/ParserKit.hpp>
#include <CompilerKit/StdKit/PEF.hpp>
#include <CompilerKit/StdKit/AE.hpp>
@@ -147,9 +147,12 @@ MPCC_MODULE(MPUXAssembler64000)
std::string object_output(argv[i]);
- if (object_output.find(kAsmFileExt64x0) != std::string::npos)
+ for (auto& ext : kAsmFileExts)
{
- object_output.erase(object_output.find(kAsmFileExt64x0), std::size(kAsmFileExt64x0));
+ if (object_output.find(ext) != std::string::npos)
+ {
+ object_output.erase(object_output.find(ext), std::strlen(ext));
+ }
}
object_output += kObjectFileExt;
diff --git a/Drivers/bccl.cc b/Drivers/bccl.cc
index 952b7c4..d84a392 100644
--- a/Drivers/bccl.cc
+++ b/Drivers/bccl.cc
@@ -13,7 +13,7 @@
#include <fstream>
#include <iostream>
#include <uuid/uuid.h>
-#include <CompilerKit/AsmKit/Arch/64k.hpp>
+#include <CompilerKit/AsmKit/Arch/64x0.hpp>
#include <CompilerKit/ParserKit.hpp>
#define kOk 0
@@ -1316,7 +1316,8 @@ public:
}
/* According to pef abi. */
- dest += kAsmFileExt64x0;
+ std::vector<const char*> exts = kAsmFileExts;
+ dest += exts[0];
kState.fOutputAssembly = std::make_unique<std::ofstream>(dest);
diff --git a/Drivers/ccplus.cc b/Drivers/ccplus.cc
index fc9d039..488253a 100644
--- a/Drivers/ccplus.cc
+++ b/Drivers/ccplus.cc
@@ -15,7 +15,7 @@
#include <stack>
#include <utility>
#include <uuid/uuid.h>
-#include <CompilerKit/AsmKit/Arch/64k.hpp>
+#include <CompilerKit/AsmKit/Arch/64x0.hpp>
#include <CompilerKit/ParserKit.hpp>
#define kOk 0
@@ -280,7 +280,9 @@ public:
}
/* According to pef abi. */
- dest += kAsmFileExt64x0;
+
+ std::vector<const char*> exts = kAsmFileExts;
+ dest += exts[0];
kState.fOutputAssembly = std::make_unique<std::ofstream>(dest);
diff --git a/ReadMe.md b/ReadMe.md
index 322faa0..ccae53c 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -17,13 +17,13 @@ In order to help the programmer achieve its task.
bpp: BCCL/MASM preprocessor
<br>
-ccplus: Optimized C++ compiler
+ccplus: 64x0/32x0 Optimized C++ compiler
<br>
-bccl: BCCL compiler
+bccl: 64x0/32x0 BCCL compiler
<br>
ld: mp-ux linker
<br>
-masm: mp-ux assembler
+masm: 64x0 mp-ux assembler
<br>
Author: Amlal El Mahrouss