Sync from rust c7dbe7a830100c70d59994fd940bf75bb6e39b39
This commit is contained in:
commit
94ad37cd3d
@ -42,7 +42,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
continue;
|
||||
}
|
||||
|
||||
if stack.contains("rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items")
|
||||
if stack.contains("rustc_monomorphize::partitioning::collect_and_partition_mono_items")
|
||||
|| stack.contains("rustc_incremental::assert_dep_graph::assert_dep_graph")
|
||||
|| stack.contains("rustc_symbol_mangling::test::report_symbol_names")
|
||||
{
|
||||
@ -81,7 +81,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
const COLLECT_AND_PARTITION_MONO_ITEMS: &str =
|
||||
"rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items";
|
||||
"rustc_monomorphize::partitioning::collect_and_partition_mono_items";
|
||||
if let Some(index) = stack.find(COLLECT_AND_PARTITION_MONO_ITEMS) {
|
||||
stack = &stack[..index + COLLECT_AND_PARTITION_MONO_ITEMS.len()];
|
||||
}
|
||||
|
@ -92,9 +92,9 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
|
||||
fn get_abi_param(&self, tcx: TyCtxt<'tcx>) -> SmallVec<[AbiParam; 2]> {
|
||||
match self.mode {
|
||||
PassMode::Ignore => smallvec![],
|
||||
PassMode::Direct(attrs) => match &self.layout.abi {
|
||||
PassMode::Direct(attrs) => match self.layout.abi {
|
||||
Abi::Scalar(scalar) => smallvec![apply_arg_attrs_to_abi_param(
|
||||
AbiParam::new(scalar_to_clif_type(tcx, scalar.clone())),
|
||||
AbiParam::new(scalar_to_clif_type(tcx, scalar)),
|
||||
attrs
|
||||
)],
|
||||
Abi::Vector { .. } => {
|
||||
@ -103,10 +103,10 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
|
||||
}
|
||||
_ => unreachable!("{:?}", self.layout.abi),
|
||||
},
|
||||
PassMode::Pair(attrs_a, attrs_b) => match &self.layout.abi {
|
||||
PassMode::Pair(attrs_a, attrs_b) => match self.layout.abi {
|
||||
Abi::ScalarPair(a, b) => {
|
||||
let a = scalar_to_clif_type(tcx, a.clone());
|
||||
let b = scalar_to_clif_type(tcx, b.clone());
|
||||
let a = scalar_to_clif_type(tcx, a);
|
||||
let b = scalar_to_clif_type(tcx, b);
|
||||
smallvec![
|
||||
apply_arg_attrs_to_abi_param(AbiParam::new(a), attrs_a),
|
||||
apply_arg_attrs_to_abi_param(AbiParam::new(b), attrs_b),
|
||||
@ -139,9 +139,9 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
|
||||
fn get_abi_return(&self, tcx: TyCtxt<'tcx>) -> (Option<AbiParam>, Vec<AbiParam>) {
|
||||
match self.mode {
|
||||
PassMode::Ignore => (None, vec![]),
|
||||
PassMode::Direct(_) => match &self.layout.abi {
|
||||
PassMode::Direct(_) => match self.layout.abi {
|
||||
Abi::Scalar(scalar) => {
|
||||
(None, vec![AbiParam::new(scalar_to_clif_type(tcx, scalar.clone()))])
|
||||
(None, vec![AbiParam::new(scalar_to_clif_type(tcx, scalar))])
|
||||
}
|
||||
Abi::Vector { .. } => {
|
||||
let vector_ty = crate::intrinsics::clif_vector_type(tcx, self.layout).unwrap();
|
||||
@ -149,10 +149,10 @@ impl<'tcx> ArgAbiExt<'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
|
||||
}
|
||||
_ => unreachable!("{:?}", self.layout.abi),
|
||||
},
|
||||
PassMode::Pair(_, _) => match &self.layout.abi {
|
||||
PassMode::Pair(_, _) => match self.layout.abi {
|
||||
Abi::ScalarPair(a, b) => {
|
||||
let a = scalar_to_clif_type(tcx, a.clone());
|
||||
let b = scalar_to_clif_type(tcx, b.clone());
|
||||
let a = scalar_to_clif_type(tcx, a);
|
||||
let b = scalar_to_clif_type(tcx, b);
|
||||
(None, vec![AbiParam::new(a), AbiParam::new(b)])
|
||||
}
|
||||
_ => unreachable!("{:?}", self.layout.abi),
|
||||
|
@ -23,7 +23,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
||||
let mir = tcx.instance_mir(instance.def);
|
||||
let _mir_guard = crate::PrintOnPanic(|| {
|
||||
let mut buf = Vec::new();
|
||||
rustc_mir::util::write_mir_pretty(tcx, Some(instance.def_id()), &mut buf).unwrap();
|
||||
rustc_middle::mir::write_mir_pretty(tcx, Some(instance.def_id()), &mut buf).unwrap();
|
||||
String::from_utf8_lossy(&buf).into_owned()
|
||||
});
|
||||
|
||||
|
@ -143,8 +143,8 @@ macro validate_simd_type($fx:ident, $intrinsic:ident, $span:ident, $ty:expr) {
|
||||
}
|
||||
|
||||
pub(crate) fn clif_vector_type<'tcx>(tcx: TyCtxt<'tcx>, layout: TyAndLayout<'tcx>) -> Option<Type> {
|
||||
let (element, count) = match &layout.abi {
|
||||
Abi::Vector { element, count } => (element.clone(), *count),
|
||||
let (element, count) = match layout.abi {
|
||||
Abi::Vector { element, count } => (element, count),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,6 @@ extern crate rustc_incremental;
|
||||
extern crate rustc_index;
|
||||
extern crate rustc_interface;
|
||||
extern crate rustc_metadata;
|
||||
extern crate rustc_mir;
|
||||
extern crate rustc_session;
|
||||
extern crate rustc_span;
|
||||
extern crate rustc_target;
|
||||
|
@ -49,11 +49,7 @@ fn codegen_field<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn scalar_pair_calculate_b_offset(
|
||||
tcx: TyCtxt<'_>,
|
||||
a_scalar: &Scalar,
|
||||
b_scalar: &Scalar,
|
||||
) -> Offset32 {
|
||||
fn scalar_pair_calculate_b_offset(tcx: TyCtxt<'_>, a_scalar: Scalar, b_scalar: Scalar) -> Offset32 {
|
||||
let b_offset = a_scalar.value.size(&tcx).align_to(b_scalar.value.align(&tcx).abi);
|
||||
Offset32::new(b_offset.bytes().try_into().unwrap())
|
||||
}
|
||||
@ -124,12 +120,10 @@ impl<'tcx> CValue<'tcx> {
|
||||
match self.0 {
|
||||
CValueInner::ByRef(ptr, None) => {
|
||||
let clif_ty = match layout.abi {
|
||||
Abi::Scalar(ref scalar) => scalar_to_clif_type(fx.tcx, scalar.clone()),
|
||||
Abi::Vector { ref element, count } => {
|
||||
scalar_to_clif_type(fx.tcx, element.clone())
|
||||
.by(u16::try_from(count).unwrap())
|
||||
.unwrap()
|
||||
}
|
||||
Abi::Scalar(scalar) => scalar_to_clif_type(fx.tcx, scalar),
|
||||
Abi::Vector { element, count } => scalar_to_clif_type(fx.tcx, element)
|
||||
.by(u16::try_from(count).unwrap())
|
||||
.unwrap(),
|
||||
_ => unreachable!("{:?}", layout.ty),
|
||||
};
|
||||
let mut flags = MemFlags::new();
|
||||
@ -147,13 +141,13 @@ impl<'tcx> CValue<'tcx> {
|
||||
let layout = self.1;
|
||||
match self.0 {
|
||||
CValueInner::ByRef(ptr, None) => {
|
||||
let (a_scalar, b_scalar) = match &layout.abi {
|
||||
let (a_scalar, b_scalar) = match layout.abi {
|
||||
Abi::ScalarPair(a, b) => (a, b),
|
||||
_ => unreachable!("load_scalar_pair({:?})", self),
|
||||
};
|
||||
let b_offset = scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
|
||||
let clif_ty1 = scalar_to_clif_type(fx.tcx, a_scalar.clone());
|
||||
let clif_ty2 = scalar_to_clif_type(fx.tcx, b_scalar.clone());
|
||||
let clif_ty1 = scalar_to_clif_type(fx.tcx, a_scalar);
|
||||
let clif_ty2 = scalar_to_clif_type(fx.tcx, b_scalar);
|
||||
let mut flags = MemFlags::new();
|
||||
flags.set_notrap();
|
||||
let val1 = ptr.load(fx, clif_ty1, flags);
|
||||
@ -564,7 +558,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
to_ptr.store(fx, val, flags);
|
||||
return;
|
||||
}
|
||||
Abi::ScalarPair(ref a_scalar, ref b_scalar) => {
|
||||
Abi::ScalarPair(a_scalar, b_scalar) => {
|
||||
let (value, extra) = from.load_scalar_pair(fx);
|
||||
let b_offset = scalar_pair_calculate_b_offset(fx.tcx, a_scalar, b_scalar);
|
||||
to_ptr.store(fx, value, flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user