提交 3e62ba1a 编写于 作者: B bjorn3

Add method to get OpTy for local from arbitrary frame

上级 ea51e320
......@@ -291,7 +291,7 @@ pub fn to_immediate(self) -> Value<Tag>
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct OpTy<'tcx, Tag=()> {
pub op: Operand<Tag>, // This is used by [priroda](https://github.com/oli-obk/priroda)
crate op: Operand<Tag>, // ideally we'd make this private, but const_prop needs this
pub layout: TyLayout<'tcx>,
}
......@@ -772,4 +772,14 @@ pub fn read_discriminant(
})
}
/// This is used by [priroda](https://github.com/oli-obk/priroda) to get an OpTy from a local
pub fn read_local_of_frame(
&self,
frame: &super::Frame,
local: mir::Local
) -> EvalResult<'tcx, OpTy<'tcx>> {
let op = frame.locals[local].access()?;
let layout = self.layout_of_local(frame, local)?;
OpTy { op, layout }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册