Add a pointer to address cast kind

A pointer to address cast are often special-cased.
Introduce a dedicated cast kind to make them easy distinguishable.
This commit is contained in:
Tomasz Miąsko 2022-05-31 00:00:00 +00:00
parent d35d972e69
commit dff602fc18
15 changed files with 96 additions and 94 deletions

View file

@ -607,7 +607,7 @@ fn codegen_stmt<'tcx>(
let operand = codegen_operand(fx, operand);
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
}
Rvalue::Cast(CastKind::Misc, ref operand, to_ty) => {
Rvalue::Cast(CastKind::Misc | CastKind::PointerAddress, ref operand, to_ty) => {
let operand = codegen_operand(fx, operand);
let from_ty = operand.layout().ty;
let to_ty = fx.monomorphize(to_ty);