From: Bryan English Date: Sat, 31 Jan 2026 03:52:58 +0000 (-0500) Subject: fix strings and loading tweak X-Git-Url: https://rethought.computer/gitweb//gitweb//git?a=commitdiff_plain;h=beb88edf1239064096e54420a911dbec5c877106;p=sorel-lang.git fix strings and loading tweak --- diff --git a/rel-lang/relc/src/riscv_asm_codegen.rs b/rel-lang/relc/src/riscv_asm_codegen.rs index 148423d..184a44a 100644 --- a/rel-lang/relc/src/riscv_asm_codegen.rs +++ b/rel-lang/relc/src/riscv_asm_codegen.rs @@ -106,7 +106,7 @@ impl<'a> CodeGen<'a> { match ir { IR::StringDef(string_label, some_string) => { string_table.insert(some_string.clone(), string_label); - self.label(string_label); + self.label(format!("{}:", string_label)); self.line(format!(".asciz \"{}\"", some_string)); // should this be .asciz? self.label(""); }, @@ -184,7 +184,7 @@ impl<'a> CodeGen<'a> { IR::Load => { self.label("# load 64"); self.copy_top_stack_value_to("t0"); - self.line(format!("ld {}, 0({})", "t0", "t0")); // deref pointer int t0 to t0 + self.line("ld t0, 0(t0)"); // deref pointer in t0 to t0 self.copy_to_top_of_stack("t0"); }, IR::Store => { // ( x addr -- ) @@ -198,7 +198,7 @@ impl<'a> CodeGen<'a> { }, IR::StackPushString(name) => { self.label(format!("# stackpushstring {}", name)); - self.line(format!("li t0, {}", name)); + self.line(format!("la t0, {}", name)); self.push_from("t0"); }, IR::AddU64 => {