提交 e57ac764 编写于 作者: N Nicholas Nethercote

Box `thir::ExprKind::InlineAsm`.

This shrinks `thir::Expr`.
上级 b3245a8d
......@@ -133,6 +133,14 @@ pub struct ClosureExpr<'tcx> {
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)]
pub enum BlockSafety {
Safe,
......@@ -432,12 +440,7 @@ pub enum ExprKind<'tcx> {
def_id: DefId,
},
/// Inline assembly, i.e. `asm!()`.
InlineAsm {
template: &'tcx [InlineAsmTemplatePiece],
operands: Box<[InlineAsmOperand<'tcx>]>,
options: InlineAsmOptions,
line_spans: &'tcx [Span],
},
InlineAsm(Box<InlineAsmExpr<'tcx>>),
/// An expression taking a reference to a thread local.
ThreadLocalRef(DefId),
/// A `yield` expression.
......@@ -804,7 +807,7 @@ mod size_asserts {
use super::*;
// These are in alphabetical order, which is easy to maintain.
static_assert_size!(Block, 56);
static_assert_size!(Expr<'_>, 80);
static_assert_size!(Expr<'_>, 64);
static_assert_size!(Pat<'_>, 24);
static_assert_size!(Stmt<'_>, 72);
}
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,
};
......@@ -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: _ } => {}
ConstParam { param: _, 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 {
use InlineAsmOperand::*;
match op {
......
......@@ -400,7 +400,7 @@ pub(crate) fn expr_into_dest(
);
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};
let operands = operands
.into_iter()
......
......@@ -562,7 +562,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
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,
operands: asm
.operands
......@@ -621,7 +621,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
.collect(),
options: asm.options,
line_spans: asm.line_spans,
},
})),
hir::ExprKind::ConstBlock(ref anon_const) => {
let ty = self.typeck_results().node_type(anon_const.hir_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册