MCPcopy Create free account
hub / github.com/chc4/lineiform / shift_stack

Method shift_stack

lineiform/src/lift.rs:752–768  ·  view source on GitHub ↗

Move the stack either up or down N slots. -1 becomes a -4 or -8

(&mut self, slots: isize)

Source from the content-addressed store, hash-verified

750
751 /// Move the stack either up or down N slots. -1 becomes a -4 or -8
752 pub fn shift_stack(&mut self, slots: isize) {
753 let stack = self.context.stack();
754 if slots < 0 {
755 // we are potentially creating stack slots
756 for slot in 0..(slots*-1) {
757 let slot = (STACK_TOP - (slot as usize*HOST_WIDTH as usize));
758 self.context.bound.entry(Location::Stack(slot)).or_insert_with(|| {
759 println!("creating stack slot {:x}", slot);
760 // bind the state variable port
761 JitVariable::Variable(self.f.add_stack_slot(&mut self.ir))
762 });
763 }
764 }
765 self.context.bound.insert(Location::Reg(RegSpec::rsp()),
766 JitVariable::Known(JitValue::Const(Wrapping(
767 (self.context.stack() as isize + (slots*HOST_WIDTH as isize)) as usize))));
768 }
769
770 fn constant(&mut self, c: isize) -> PortIdx {
771 // TODO: constant pooling? idk

Callers 1

emitMethod · 0.80

Calls 2

stackMethod · 0.80
add_stack_slotMethod · 0.80

Tested by

no test coverage detected