1
Fork 0

Remove CPlaceInner::Stack

This commit is contained in:
bjorn3 2019-12-20 22:00:12 +01:00
parent 3d363d54fd
commit ad72afaad3
4 changed files with 5 additions and 26 deletions

View file

@ -75,17 +75,6 @@ pub fn add_local_place_comments<'tcx>(
align.pref.bytes(),
));
}
CPlaceInner::Stack(stack_slot) => fx.add_entity_comment(
stack_slot,
format!(
"{:?}: {:?} size={} align={},{}",
local,
ty,
size.bytes(),
align.abi.bytes(),
align.pref.bytes(),
),
),
CPlaceInner::NoPlace => fx.add_global_comment(format!(
"zst {:5} {:20} {:4}b {}, {}",
format!("{:?}", local),

View file

@ -345,9 +345,9 @@ fn place_location<'a, 'tcx>(
// FIXME implement this (used by arguments and returns)
AttributeValue::Exprloc(Expression(vec![]))
}
CPlaceInner::Stack(stack_slot) => {
AttributeValue::Exprloc(Expression(translate_loc(ValueLoc::Stack(*stack_slot), &context.func.stack_slots).unwrap()))
// For PointerBase::Stack:
//AttributeValue::Exprloc(Expression(translate_loc(ValueLoc::Stack(*stack_slot), &context.func.stack_slots).unwrap()))
}
CPlaceInner::NoPlace => AttributeValue::Exprloc(Expression(vec![])),
}

View file

@ -669,7 +669,7 @@ pub fn codegen_intrinsic_call<'tcx>(
fx.bcx.set_val_label(val, cranelift::codegen::ir::ValueLabel::from_u32(var.as_u32()));
fx.bcx.def_var(mir_var(var), val);
}
CPlaceInner::Addr(_, _) | CPlaceInner::Stack(_) => {
CPlaceInner::Addr(_, _) => {
// Don't write to `ret`, as the destination memory is already uninitialized.
}
}

View file

@ -233,7 +233,6 @@ pub struct CPlace<'tcx> {
pub enum CPlaceInner {
Var(Local),
Addr(Pointer, Option<Value>),
Stack(StackSlot),
NoPlace,
}
@ -272,7 +271,7 @@ impl<'tcx> CPlace<'tcx> {
offset: None,
});
CPlace {
inner: CPlaceInner::Stack(stack_slot),
inner: CPlaceInner::Addr(Pointer::stack_slot(stack_slot), None),
layout,
}
}
@ -316,10 +315,6 @@ impl<'tcx> CPlace<'tcx> {
assert!(extra.is_none(), "unsized values are not yet supported");
CValue::by_ref(ptr, layout)
}
CPlaceInner::Stack(stack_slot) => CValue::by_ref(
Pointer::stack_slot(stack_slot),
layout,
),
CPlaceInner::NoPlace => CValue::by_ref(
Pointer::const_addr(fx, i64::try_from(self.layout.align.pref.bytes()).unwrap()),
layout,
@ -340,10 +335,6 @@ impl<'tcx> CPlace<'tcx> {
) -> (Pointer, Option<Value>) {
match self.inner {
CPlaceInner::Addr(ptr, extra) => (ptr, extra),
CPlaceInner::Stack(stack_slot) => (
Pointer::stack_slot(stack_slot),
None,
),
CPlaceInner::NoPlace => {
(
Pointer::const_addr(fx, i64::try_from(self.layout.align.pref.bytes()).unwrap()),
@ -431,7 +422,6 @@ impl<'tcx> CPlace<'tcx> {
return;
}
CPlaceInner::Addr(ptr, None) => ptr,
CPlaceInner::Stack(stack_slot) => Pointer::stack_slot(stack_slot),
CPlaceInner::NoPlace => {
if dst_layout.abi != Abi::Uninhabited {
assert_eq!(dst_layout.size.bytes(), 0, "{:?}", dst_layout);