Legalize entry block arguments to match ABI types.

Insert conversion code that reconstructs the original function argument
types from the legalized ABI signature.

Add abi::legalize_abi_value(). This function is used when adapting code
to a legalized function signature.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-06 13:57:36 -08:00
parent 5185cce1e9
commit 5d266acb5f
6 changed files with 288 additions and 27 deletions

View File

@@ -5,7 +5,7 @@
//!
//! This doesn't support the soft-float ABI at the moment.
use abi::{ArgAction, ArgAssigner, legalize_args};
use abi::{ArgAction, ValueConversion, ArgAssigner, legalize_args};
use ir::{Signature, ArgumentType, ArgumentLoc};
use isa::riscv::registers::{GPR, FPR};
use settings as shared_settings;
@@ -39,7 +39,7 @@ impl ArgAssigner for Args {
// Check for a legal type.
// RISC-V doesn't have SIMD at all, so break all vectors down.
if !ty.is_scalar() {
return ArgAction::Split;
return ArgAction::Convert(ValueConversion::VectorSplit);
}
// Large integers and booleans are broken down to fit in a register.
@@ -47,7 +47,7 @@ impl ArgAssigner for Args {
// Align registers and stack to a multiple of two pointers.
self.regs = align(self.regs, 2);
self.offset = align(self.offset, 2 * self.pointer_bytes);
return ArgAction::Split;
return ArgAction::Convert(ValueConversion::IntSplit);
}
if self.regs < 8 {