]> rethought.computer Git - sorel-lang.git/commitdiff
fix strings and loading tweak keep/beb88edf1239064096e54420a911dbec5c877106
authorBryan English <bryan@rethought.computer>
Sat, 31 Jan 2026 03:52:58 +0000 (22:52 -0500)
committerBryan English <bryan@rethought.computer>
Tue, 10 Feb 2026 04:08:54 +0000 (04:08 +0000)
rel-lang/relc/src/riscv_asm_codegen.rs

index 148423d7648d41996c49c9af857beaa6f6bcfe13..184a44af11de28a4a1435c80255ae31ff51d3a9f 100644 (file)
@@ -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 => {