stage1 重构代码新增c后端

This commit is contained in:
zzy committed 2026-10-13 13:14:48 +08:00
1 parent fc2d8f8db4
commit 3714c2d142
24 files changed
+1539 -593

No files matched your search

+53 -18
View File
@@ -19,7 +19,6 @@ static const char *splc0_srcs[] = {
"stage1/spl_lexer.c",
"stage1/spl_ast.c",
"stage1/spl_parser.c",
"stage1/spl_dumptree.c",
"stage1/spl_type.c",
"stage1/spl_fold.c",
"stage1/spl_lang_type.c",
@@ -31,6 +30,7 @@ static const char *splc0_srcs[] = {
"stage1/spl_ast2ir.c",
"stage1/spl_layout.c",
"stage1/spl_ir2vm.c",
"stage1/spl_ir2c.c",
"stage1/ir_opt.c",
"stage1/vm_opt.c",
"stage0/spl_mcode.c",
@@ -95,16 +95,6 @@ static const char* splc1_deps[] = {
};
static const char* splc2_deps[] = {
/* stage3 */
"stage3/builtin.spl",
"stage3/hir.spl",
"stage3/hir2ir.spl",
"stage3/lang_type.spl",
"stage3/lower.spl",
"stage3/scope.spl",
"stage3/sema.spl",
"stage3/splc2.spl",
"stage3/tag.spl",
/* stage2 */
"stage2/sys/exit.spl",
"stage2/sys/file.spl",
@@ -157,10 +147,31 @@ static const char* splc2_deps[] = {
"stage2/type_table.spl",
};
static const char *splc2_crt_deps[] = {
"stage0/spl_rt.h", "stage0/spl_rt_core.h", "stage0/spl_asp.h",
"stage0/spl_mcode.h", "stage0/spl_vm.h", "stage0/spl_syscall.h",
#define CRT_DEPS \
"stage0/spl_rt.h", "stage0/spl_rt_core.h", "stage0/spl_asp.h", \
"stage0/spl_mcode.h", "stage0/spl_vm.h", "stage0/spl_syscall.h", \
"stage0/spl_vm_embed.h",
static const char *splc2_crt_deps[] = {
CRT_DEPS
};
static const char* splc3_deps[] = {
"stage3/ast2hir.spl",
"stage3/intrinsic.spl",
"stage3/comptime.spl",
"stage3/hir2ir.spl",
"stage3/lang_type.spl",
"stage3/mangling.spl",
"stage3/sema.spl",
"stage3/spl_ir.spl",
"stage3/spl_ir_builder.spl",
"stage3/splc2.spl",
"stage3/tag.spl",
};
static const char *splc3_crt_deps[] = {
CRT_DEPS
};
/* clang-format on */
@@ -263,7 +274,7 @@ static build_t targets[] = {
"splc1n",
BUILD_NATIVE,
.native = {.src = "stage2/splc1.spl",
.compiler = "splc1",
.compiler = "splc0",
.deps = splc1_deps,
.deps_count = NOB_ARRAY_LEN(splc1_deps),
.crt_deps = splc1_crt_deps,
@@ -287,12 +298,36 @@ static build_t targets[] = {
.crt_deps = splc2_crt_deps,
.crt_deps_count = NOB_ARRAY_LEN(splc2_crt_deps)},
},
{
"splc3",
BUILD_SIR,
.sir =
{
.src = "stage3/splc3.spl",
.compiler = "splc2n",
.deps = splc3_deps,
.deps_count = NOB_ARRAY_LEN(splc3_deps),
},
},
{
"splc3n",
BUILD_NATIVE,
.native =
{
.src = "stage3/splc3.spl",
.compiler = "splc2n",
.deps = splc3_deps,
.deps_count = NOB_ARRAY_LEN(splc3_deps),
.crt_deps = splc3_crt_deps,
.crt_deps_count = NOB_ARRAY_LEN(splc3_crt_deps),
},
},
};
static run_t runs[] = {
{"spl_cli", NULL}, {"vm_test", NULL}, {"splc0", NULL},
{"splc1", "spl_cli"}, {"splc1r", "spl_cli"}, {"splc1s", "spl_cli"},
{"splc1n", NULL}, {"splc2", "spl_cli"}, {"splc2n", NULL},
{"spl_cli", NULL}, {"vm_test", NULL}, {"splc0", NULL}, {"splc1", "spl_cli"},
{"splc1r", "spl_cli"}, {"splc1s", "spl_cli"}, {"splc1n", NULL}, {"splc2", "spl_cli"},
{"splc2n", NULL}, {"splc3", "spl_cli"}, {"splc3n", NULL},
};
#endif /* __NOB_DATA_H__ */