implement valtree -> constvalue conversion

This commit is contained in:
b-naber 2022-04-05 16:33:42 +02:00
parent eaf8cdaa0b
commit 1157dc7167
9 changed files with 546 additions and 151 deletions

View file

@ -98,7 +98,7 @@ impl<'tcx, Tag: Provenance> Immediate<Tag> {
// as input for binary and cast operations.
#[derive(Copy, Clone, Debug)]
pub struct ImmTy<'tcx, Tag: Provenance = AllocId> {
imm: Immediate<Tag>,
pub imm: Immediate<Tag>,
pub layout: TyAndLayout<'tcx>,
}
@ -248,7 +248,7 @@ impl<'tcx, Tag: Provenance> ImmTy<'tcx, Tag> {
impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// Try reading an immediate in memory; this is interesting particularly for `ScalarPair`.
/// Returns `None` if the layout does not permit loading this as a value.
fn try_read_immediate_from_mplace(
pub(crate) fn try_read_immediate_from_mplace(
&self,
mplace: &MPlaceTy<'tcx, M::PointerTag>,
) -> InterpResult<'tcx, Option<ImmTy<'tcx, M::PointerTag>>> {
@ -424,6 +424,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
})
}
#[instrument(skip(self), level = "debug")]
pub fn operand_projection(
&self,
base: &OpTy<'tcx, M::PointerTag>,