summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src/Frontend
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-28 14:33:48 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-28 14:33:48 +0200
commit46badbe70a36bb3cb5d86bd9f33aa5481c9709b9 (patch)
tree33f3759845a25c51cea5d92177a3f7ebd269f984 /dev/LibCompiler/src/Frontend
parent0965112fb81ef3e04010197f68f743c98a7611ba (diff)
feat!: update the kernel codegen to output bit width and origin.
refactor!: refactor codebase, breaking changes. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/src/Frontend')
-rw-r--r--dev/LibCompiler/src/Frontend/CompilerCPlusPlusAMD64.cc (renamed from dev/LibCompiler/src/Frontend/CPlusPlusCompilerAMD64.cc)11
1 files changed, 7 insertions, 4 deletions
diff --git a/dev/LibCompiler/src/Frontend/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/Frontend/CompilerCPlusPlusAMD64.cc
index 217f86b..df9035d 100644
--- a/dev/LibCompiler/src/Frontend/CPlusPlusCompilerAMD64.cc
+++ b/dev/LibCompiler/src/Frontend/CompilerCPlusPlusAMD64.cc
@@ -9,7 +9,6 @@
/// BUGS: 1
-#include "LibCompiler/Defines.h"
#define kPrintF printf
#define kExitOK (EXIT_SUCCESS)
@@ -20,7 +19,7 @@
#include <LibCompiler/Backend/X64.h>
#include <LibCompiler/Frontend.h>
#include <LibCompiler/UUID.h>
-#include <LibCompiler/Util/LCClUtils.h>
+#include <LibCompiler/Util/CompilerUtils.h>
/* NeKernel C++ Compiler Driver */
/* This is part of the LibCompiler. */
@@ -126,7 +125,8 @@ class CompilerFrontendCPlusPlus final LC_COMPILER_FRONTEND {
LIBCOMPILER_COPY_DEFAULT(CompilerFrontendCPlusPlus);
- LibCompiler::SyntaxLeafList::SyntaxLeaf Compile(const LibCompiler::STLString text, LibCompiler::STLString file) override;
+ LibCompiler::SyntaxLeafList::SyntaxLeaf Compile(const LibCompiler::STLString text,
+ LibCompiler::STLString file) override;
const char* Language() override;
};
@@ -736,6 +736,9 @@ class AssemblyCPlusPlusInterface final LC_ASSEMBLY_INTERFACE {
LibCompiler::STLString line_source;
+ out_fp << "#bits 64\n";
+ out_fp << "#org " << kOrigin << "\n\n";
+
while (std::getline(src_fp, line_source)) {
out_fp << kCompilerFrontend->Compile(line_source, src).fUserValue;
}
@@ -817,7 +820,7 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) {
kCompilerFrontend = new CompilerFrontendCPlusPlus();
kFactory.Mount(new AssemblyCPlusPlusInterface());
- ::signal(SIGSEGV, Detail::drvi_crash_handler);
+ LibCompiler::install_signal(SIGSEGV, Detail::drvi_crash_handler);
for (auto index = 1UL; index < argc; ++index) {
if (!argv[index]) break;