turns out Layout has some more things to worry about -- move ABI comparison into helper function
like is_bool, and some special magic extra fields
This commit is contained in:
parent
28d152935e
commit
b0cf4c28ea
4 changed files with 38 additions and 25 deletions
|
@ -60,7 +60,8 @@ pub enum PassMode {
|
|||
|
||||
impl PassMode {
|
||||
/// Checks if these two `PassMode` are equal enough to be considered "the same for all
|
||||
/// function call ABIs".
|
||||
/// function call ABIs". However, the `Layout` can also impact ABI decisions,
|
||||
/// so that needs to be compared as well!
|
||||
pub fn eq_abi(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(PassMode::Ignore, PassMode::Ignore) => true, // can still be reached for the return type
|
||||
|
@ -623,6 +624,14 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
|
|||
pub fn is_ignore(&self) -> bool {
|
||||
matches!(self.mode, PassMode::Ignore)
|
||||
}
|
||||
|
||||
/// Checks if these two `ArgAbi` are equal enough to be considered "the same for all
|
||||
/// function call ABIs".
|
||||
pub fn eq_abi(&self, other: &Self) -> bool {
|
||||
// Ideally we'd just compare the `mode`, but that is not enough -- for some modes LLVM will look
|
||||
// at the type.
|
||||
self.layout.eq_abi(&other.layout) && self.mode.eq_abi(&other.mode)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue