Box thir::ExprKind::InlineAsm
.
This shrinks `thir::Expr`.
This commit is contained in:
parent
b3245a8dff
commit
e57ac764b8
4 changed files with 15 additions and 12 deletions
|
@ -133,6 +133,14 @@ pub struct ClosureExpr<'tcx> {
|
||||||
pub fake_reads: Vec<(ExprId, FakeReadCause, hir::HirId)>,
|
pub fake_reads: Vec<(ExprId, FakeReadCause, hir::HirId)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, HashStable)]
|
||||||
|
pub struct InlineAsmExpr<'tcx> {
|
||||||
|
pub template: &'tcx [InlineAsmTemplatePiece],
|
||||||
|
pub operands: Box<[InlineAsmOperand<'tcx>]>,
|
||||||
|
pub options: InlineAsmOptions,
|
||||||
|
pub line_spans: &'tcx [Span],
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, HashStable)]
|
#[derive(Copy, Clone, Debug, HashStable)]
|
||||||
pub enum BlockSafety {
|
pub enum BlockSafety {
|
||||||
Safe,
|
Safe,
|
||||||
|
@ -432,12 +440,7 @@ pub enum ExprKind<'tcx> {
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
},
|
},
|
||||||
/// Inline assembly, i.e. `asm!()`.
|
/// Inline assembly, i.e. `asm!()`.
|
||||||
InlineAsm {
|
InlineAsm(Box<InlineAsmExpr<'tcx>>),
|
||||||
template: &'tcx [InlineAsmTemplatePiece],
|
|
||||||
operands: Box<[InlineAsmOperand<'tcx>]>,
|
|
||||||
options: InlineAsmOptions,
|
|
||||||
line_spans: &'tcx [Span],
|
|
||||||
},
|
|
||||||
/// An expression taking a reference to a thread local.
|
/// An expression taking a reference to a thread local.
|
||||||
ThreadLocalRef(DefId),
|
ThreadLocalRef(DefId),
|
||||||
/// A `yield` expression.
|
/// A `yield` expression.
|
||||||
|
@ -804,7 +807,7 @@ mod size_asserts {
|
||||||
use super::*;
|
use super::*;
|
||||||
// These are in alphabetical order, which is easy to maintain.
|
// These are in alphabetical order, which is easy to maintain.
|
||||||
static_assert_size!(Block, 56);
|
static_assert_size!(Block, 56);
|
||||||
static_assert_size!(Expr<'_>, 80);
|
static_assert_size!(Expr<'_>, 64);
|
||||||
static_assert_size!(Pat<'_>, 24);
|
static_assert_size!(Pat<'_>, 24);
|
||||||
static_assert_size!(Stmt<'_>, 72);
|
static_assert_size!(Stmt<'_>, 72);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::{
|
use super::{
|
||||||
Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind,
|
Arm, Block, ClosureExpr, Expr, ExprKind, Guard, InlineAsmExpr, InlineAsmOperand, Pat, PatKind, Stmt, StmtKind,
|
||||||
Thir,
|
Thir,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
|
||||||
NamedConst { def_id: _, substs: _, user_ty: _ } => {}
|
NamedConst { def_id: _, substs: _, user_ty: _ } => {}
|
||||||
ConstParam { param: _, def_id: _ } => {}
|
ConstParam { param: _, def_id: _ } => {}
|
||||||
StaticRef { alloc_id: _, ty: _, def_id: _ } => {}
|
StaticRef { alloc_id: _, ty: _, def_id: _ } => {}
|
||||||
InlineAsm { ref operands, template: _, options: _, line_spans: _ } => {
|
InlineAsm(box InlineAsmExpr { ref operands, template: _, options: _, line_spans: _ }) => {
|
||||||
for op in &**operands {
|
for op in &**operands {
|
||||||
use InlineAsmOperand::*;
|
use InlineAsmOperand::*;
|
||||||
match op {
|
match op {
|
||||||
|
|
|
@ -400,7 +400,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
block.unit()
|
block.unit()
|
||||||
}
|
}
|
||||||
ExprKind::InlineAsm { template, ref operands, options, line_spans } => {
|
ExprKind::InlineAsm(box InlineAsmExpr { template, ref operands, options, line_spans }) => {
|
||||||
use rustc_middle::{mir, thir};
|
use rustc_middle::{mir, thir};
|
||||||
let operands = operands
|
let operands = operands
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
|
@ -562,7 +562,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
self.convert_path_expr(expr, res)
|
self.convert_path_expr(expr, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::ExprKind::InlineAsm(ref asm) => ExprKind::InlineAsm {
|
hir::ExprKind::InlineAsm(ref asm) => ExprKind::InlineAsm(Box::new(InlineAsmExpr {
|
||||||
template: asm.template,
|
template: asm.template,
|
||||||
operands: asm
|
operands: asm
|
||||||
.operands
|
.operands
|
||||||
|
@ -621,7 +621,7 @@ impl<'tcx> Cx<'tcx> {
|
||||||
.collect(),
|
.collect(),
|
||||||
options: asm.options,
|
options: asm.options,
|
||||||
line_spans: asm.line_spans,
|
line_spans: asm.line_spans,
|
||||||
},
|
})),
|
||||||
|
|
||||||
hir::ExprKind::ConstBlock(ref anon_const) => {
|
hir::ExprKind::ConstBlock(ref anon_const) => {
|
||||||
let ty = self.typeck_results().node_type(anon_const.hir_id);
|
let ty = self.typeck_results().node_type(anon_const.hir_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue