Append link and sret arguments in legalize_signature.

These special-purpose arguments and return values are only relevant for
the function being compiled, so add a `current` flag to
legalize_signature().

- Add the necessary argument values to the entry block to represent
  the special-purpose arguments.
- Propagate the link and sret arguments to return instructions if the
  legalized signature asks for it.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-19 15:44:17 -07:00
parent d9ddf4fc5a
commit e44a5a4391
9 changed files with 161 additions and 35 deletions

View File

@@ -6,7 +6,7 @@
//! This module declares the data types used to represent external functions and call signatures.
use ir::{Type, FunctionName, SigRef, ArgumentLoc};
use isa::RegInfo;
use isa::{RegInfo, RegUnit};
use std::cmp;
use std::fmt;
use std::str::FromStr;
@@ -133,6 +133,16 @@ impl ArgumentType {
}
}
/// Create an argument type for a special-purpose register.
pub fn special_reg(vt: Type, purpose: ArgumentPurpose, regunit: RegUnit) -> ArgumentType {
ArgumentType {
value_type: vt,
extension: ArgumentExtension::None,
purpose: purpose,
location: ArgumentLoc::Reg(regunit),
}
}
/// Return an object that can display `self` with correct register names.
pub fn display<'a, R: Into<Option<&'a RegInfo>>>(&'a self, regs: R) -> DisplayArgumentType<'a> {
DisplayArgumentType(self, regs.into())