hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 4efc5f7f4b09c9d16e1ff1b80df8479fe73d0bcf
parent c40a6c39e86d4f2da6a728e1f6de9ab290786938
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 10 Mar 2021 11:47:09 -0500

Schedule hare object separately from executable

Diffstat:
Mmain.ha | 2+-
Mplan.ha | 20++++++++++++++------
2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/main.ha b/main.ha @@ -39,7 +39,7 @@ export fn main() void = { name = "linux", mode = module::tag_mode::INCLUSIVE, }]); - //defer module::context_free(&ctx); // TODO + defer module::context_finish(&ctx); const rtdir = match (module::lookup(&ctx, ["rt"])) { err: module::error => fmt::fatal("Error resolving rt: {}", diff --git a/plan.ha b/plan.ha @@ -79,8 +79,8 @@ fn sched_qbe(plan: *plan, output: str, depend: *task) *task = { return task; }; -// Schedules tasks which compiles hare sources into an executable. -fn sched_hare_exe( +// Schedules tasks which compiles a Hare module into an object or archive. +fn sched_hare_object( plan: *plan, inputs: []module::input, output: str, @@ -89,7 +89,6 @@ fn sched_hare_exe( // TODO: Handle mixed sources let ssa = mkfile(plan, "ssa"); let s = mkfile(plan, "s"); - let o = mkfile(plan, "o"); let harec = alloc(task { status = status::SCHEDULED, @@ -106,9 +105,18 @@ fn sched_hare_exe( }; append(plan.scheduled, harec); - let qbe = sched_qbe(plan, s, harec); - let asm = sched_as(plan, o, qbe); - return sched_ld(plan, strings::dup(output), asm); + return sched_as(plan, output, sched_qbe(plan, s, harec)); +}; + +// Schedules tasks which compiles hare sources into an executable. +fn sched_hare_exe( + plan: *plan, + inputs: []module::input, + output: str, + depend: *task... +) *task = { + let o = sched_hare_object(plan, inputs, mkfile(plan, "o"), depend...); + return sched_ld(plan, strings::dup(output), o); }; fn execute(