Implement SystemV struct argument passing

This commit is contained in:
bjorn3
2020-04-20 12:01:53 +02:00
committed by Benjamin Bouvier
parent 2f368ed5d6
commit 4431ac1108
15 changed files with 298 additions and 50 deletions

View File

@@ -18,6 +18,10 @@ pub enum ArgAction {
/// Assign the argument to the given location.
Assign(ArgumentLoc),
/// Assign the argument to the given location and change the type to the specified type.
/// This is used by [`ArgumentPurpose::StructArgument`].
AssignAndChangeType(ArgumentLoc, Type),
/// Convert the argument, then call again.
///
/// This action can split an integer type into two smaller integer arguments, or it can split a
@@ -119,6 +123,13 @@ pub fn legalize_args<AA: ArgAssigner>(args: &[AbiParam], aa: &mut AA) -> Option<
args.to_mut()[argno].location = loc;
argno += 1;
}
// Assign argument to a location, change type to `INVALID` and move on to the next one.
ArgAction::AssignAndChangeType(loc, ty) => {
let arg = &mut args.to_mut()[argno];
arg.location = loc;
arg.value_type = ty;
argno += 1;
}
// Split this argument into two smaller ones. Then revisit both.
ArgAction::Convert(conv) => {
debug_assert!(