Add an isa::StackRef type.

This contains encoding details for a stack reference: The base register
and offset to use in the specific instruction encoding.

Generate StackRef objects called in_stk0 etc for the binemit recipe
code. All binemit recipes need to compute base pointer offsets for stack
references, so have the automatically generated code do it.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-22 11:16:07 -07:00
parent 2946cc54d3
commit 76eb7df9f0
6 changed files with 123 additions and 12 deletions

View File

@@ -104,6 +104,13 @@ impl SubTest for TestBinEmit {
// value locations. The current error reporting is just crashing...
let mut func = func.into_owned();
// Fix the stack frame layout so we can test spill/fill encodings.
let min_offset = func.stack_slots
.keys()
.map(|ss| func.stack_slots[ss].offset)
.min();
func.stack_slots.frame_size = min_offset.map(|off| (-off) as u32);
let is_compressed = isa.flags().is_compressed();
// Give an encoding to any instruction that doesn't already have one.