Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Symbolic variant to Operand #62197

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ impl<'tcx, Tag> ::std::ops::Deref for ImmTy<'tcx, Tag> {
/// or still in memory. The latter is an optimization, to delay reading that chunk of
/// memory and to avoid having to store arbitrary-sized data here.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum Operand<Tag=(), Id=AllocId> {
pub enum Operand<Tag=(), Id=AllocId, Sym=!> {
Immediate(Immediate<Tag, Id>),
Indirect(MemPlace<Tag, Id>),
Symbolic(Sym),
}

impl<Tag> Operand<Tag> {
Expand Down Expand Up @@ -146,20 +147,20 @@ impl<Tag> Operand<Tag> {
}

#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub struct OpTy<'tcx, Tag=()> {
op: Operand<Tag>,
pub struct OpTy<'tcx, Tag=(), Sym=!> {
op: Operand<Tag, AllocId, Sym>,
pub layout: TyLayout<'tcx>,
}

impl<'tcx, Tag> ::std::ops::Deref for OpTy<'tcx, Tag> {
type Target = Operand<Tag>;
impl<'tcx, Tag, Sym> ::std::ops::Deref for OpTy<'tcx, Tag, Sym> {
type Target = Operand<Tag, AllocId, Sym>;
#[inline(always)]
fn deref(&self) -> &Operand<Tag> {
fn deref(&self) -> &Self::Target {
&self.op
}
}

impl<'tcx, Tag: Copy> From<MPlaceTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
impl<'tcx, Tag: Copy, Sym> From<MPlaceTy<'tcx, Tag>> for OpTy<'tcx, Tag, Sym> {
#[inline(always)]
fn from(mplace: MPlaceTy<'tcx, Tag>) -> Self {
OpTy {
Expand All @@ -169,7 +170,7 @@ impl<'tcx, Tag: Copy> From<MPlaceTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
}
}

impl<'tcx, Tag> From<ImmTy<'tcx, Tag>> for OpTy<'tcx, Tag> {
impl<'tcx, Tag, Sym> From<ImmTy<'tcx, Tag>> for OpTy<'tcx, Tag, Sym> {
#[inline(always)]
fn from(val: ImmTy<'tcx, Tag>) -> Self {
OpTy {
Expand Down