Assign stack slots to incoming function arguments.
Function arguments that don't fit in registers are passed on the stack. Create "incoming_arg" stack slots representing the stack arguments, and assign them to the value arguments during spilling.
This commit is contained in:
@@ -155,10 +155,10 @@ impl StackSlots {
|
||||
}
|
||||
|
||||
/// Create a stack slot representing an incoming function argument.
|
||||
pub fn make_incoming_arg(&mut self, ty: Type, offset: u32) -> StackSlot {
|
||||
pub fn make_incoming_arg(&mut self, ty: Type, offset: i32) -> StackSlot {
|
||||
let mut data = StackSlotData::new(StackSlotKind::IncomingArg, ty.bytes());
|
||||
assert!(offset <= i32::max_value() as u32 - data.size);
|
||||
data.offset = offset as i32;
|
||||
assert!(offset <= i32::max_value() - data.size as i32);
|
||||
data.offset = offset;
|
||||
self.push(data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,14 @@ impl ArgumentLoc {
|
||||
}
|
||||
}
|
||||
|
||||
/// Is this a stack location?
|
||||
pub fn is_stack(&self) -> bool {
|
||||
match *self {
|
||||
ArgumentLoc::Stack(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return an object that can display this argument location, using the register info from the
|
||||
/// target ISA.
|
||||
pub fn display<'a, R: Into<Option<&'a RegInfo>>>(self, regs: R) -> DisplayArgumentLoc<'a> {
|
||||
|
||||
Reference in New Issue
Block a user