// These next ones should always be inlined, so they're in IR.
Load, // @ ( addr -- x ) -- Fetch memory contents at addr
+ Load8,
+ Load16,
+ Load32,
Store, // ! ( x addr -- ) -- Store x at addr
// These ones might not be inlined, but should be built-in, so a compiler might
self.line("ret");
}
},
+ IR::Load8 => {
+ self.label("# load 8");
+ self.copy_top_stack_value_to("t0");
+ self.line("lbu t0, 0(t0)"); // deref pointer in t0 to t0
+ self.copy_to_top_of_stack("t0");
+ },
+ IR::Load16 => {
+ self.label("# load 16");
+ self.copy_top_stack_value_to("t0");
+ self.line("lhu t0, 0(t0)"); // deref pointer in t0 to t0
+ self.copy_to_top_of_stack("t0");
+ },
+ IR::Load32 => {
+ self.label("# load 32");
+ self.copy_top_stack_value_to("t0");
+ self.line("lwu t0, 0(t0)"); // deref pointer in t0 to t0
+ self.copy_to_top_of_stack("t0");
+ },
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.copy_to_top_of_stack("t0");