Add a legalize_signature method to TargetIsa.
This entry point will be used for controlling ABI conventions when legalizing. Provide an empty implementation for RISC-V and let the other ISAs crash in legalization. This is just the scaffolding. We still need to: - Rewrite the entry block arguments to match the legalized signature. - Rewrite call and return instructions. - Implement the legalize_signature() function for all ISAs. - Add shared generic types to help with the legalize_signature() functions.
This commit is contained in:
@@ -45,7 +45,7 @@ pub use isa::registers::{RegInfo, RegUnit, RegClass, RegClassIndex};
|
||||
pub use isa::constraints::{RecipeConstraints, OperandConstraint, ConstraintKind};
|
||||
|
||||
use settings;
|
||||
use ir::{InstructionData, DataFlowGraph};
|
||||
use ir::{InstructionData, DataFlowGraph, Signature};
|
||||
|
||||
pub mod riscv;
|
||||
pub mod intel;
|
||||
@@ -161,4 +161,24 @@ pub trait TargetIsa {
|
||||
recipe_names: self.recipe_names(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Legalize a function signature.
|
||||
///
|
||||
/// This is used to legalize both the signature of the function being compiled and any called
|
||||
/// functions. The signature should be modified by adding `ArgumentLoc` annotations to all
|
||||
/// arguments and return values.
|
||||
///
|
||||
/// Arguments with types that are not supported by the ABI can be expanded into multiple
|
||||
/// arguments:
|
||||
///
|
||||
/// - Integer types that are too large to fit in a register can be broken into multiple
|
||||
/// arguments of a smaller integer type.
|
||||
/// - Floating point types can be bit-cast to an integer type of the same size, and possible
|
||||
/// broken into smaller integer types.
|
||||
/// - Vector types can be bit-cast and broken down into smaller vectors or scalars.
|
||||
///
|
||||
/// The legalizer will adapt argument and return values as necessary at all ABI boundaries.
|
||||
fn legalize_signature(&self, _sig: &mut Signature) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user