-use crate::abi::{self, Abi, Align, FieldPlacement, Size};
-use crate::abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods};
+use crate::abi::{self, Abi, Align, FieldsShape, Size};
+use crate::abi::{HasDataLayout, LayoutOf, TyAndLayout, TyAndLayoutMethods};
use crate::spec::{self, HasTargetSpec};
mod aarch64;
}
}
-impl<'a, Ty> TyLayout<'a, Ty> {
+impl<'a, Ty> TyAndLayout<'a, Ty> {
fn is_aggregate(&self) -> bool {
match self.abi {
Abi::Uninhabited | Abi::Scalar(_) | Abi::Vector { .. } => false,
/// specific targets.
pub fn homogeneous_aggregate<C>(&self, cx: &C) -> Result<HomogeneousAggregate, Heterogeneous>
where
- Ty: TyLayoutMethods<'a, C> + Copy,
- C: LayoutOf<Ty = Ty, TyLayout = Self>,
+ Ty: TyAndLayoutMethods<'a, C> + Copy,
+ C: LayoutOf<Ty = Ty, TyAndLayout = Self>,
{
match self.abi {
Abi::Uninhabited => Err(Heterogeneous),
}
Abi::ScalarPair(..) | Abi::Aggregate { .. } => {
- // Helper for computing `homogenous_aggregate`, allowing a custom
+ // Helper for computing `homogeneous_aggregate`, allowing a custom
// starting offset (used below for handling variants).
let from_fields_at =
|layout: Self,
start: Size|
-> Result<(HomogeneousAggregate, Size), Heterogeneous> {
let is_union = match layout.fields {
- FieldPlacement::Array { count, .. } => {
+ FieldsShape::Primitive => {
+ unreachable!("aggregates can't have `FieldsShape::Primitive`")
+ }
+ FieldsShape::Array { count, .. } => {
assert_eq!(start, Size::ZERO);
let result = if count > 0 {
};
return Ok((result, layout.size));
}
- FieldPlacement::Union(_) => true,
- FieldPlacement::Arbitrary { .. } => false,
+ FieldsShape::Union(_) => true,
+ FieldsShape::Arbitrary { .. } => false,
};
let mut result = HomogeneousAggregate::NoData;
/// or return a value from, a function, under some ABI.
#[derive(Debug)]
pub struct ArgAbi<'a, Ty> {
- pub layout: TyLayout<'a, Ty>,
+ pub layout: TyAndLayout<'a, Ty>,
/// Dummy argument, which is emitted before the real argument.
pub pad: Option<Reg>,
}
impl<'a, Ty> ArgAbi<'a, Ty> {
- pub fn new(layout: TyLayout<'a, Ty>) -> Self {
+ pub fn new(layout: TyAndLayout<'a, Ty>) -> Self {
ArgAbi { layout, pad: None, mode: PassMode::Direct(ArgAttributes::new()) }
}
pub fixed_count: usize,
pub conv: Conv,
+
+ pub can_unwind: bool,
}
impl<'a, Ty> FnAbi<'a, Ty> {
pub fn adjust_for_cabi<C>(&mut self, cx: &C, abi: spec::abi::Abi) -> Result<(), String>
where
- Ty: TyLayoutMethods<'a, C> + Copy,
- C: LayoutOf<Ty = Ty, TyLayout = TyLayout<'a, Ty>> + HasDataLayout + HasTargetSpec,
+ Ty: TyAndLayoutMethods<'a, C> + Copy,
+ C: LayoutOf<Ty = Ty, TyAndLayout = TyAndLayout<'a, Ty>> + HasDataLayout + HasTargetSpec,
{
match &cx.target_spec().arch[..] {
"x86" => {