mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Box thir::ExprKind::InlineAsm
.
This shrinks `thir::Expr`.
This commit is contained in:
parent
b3245a8dff
commit
e57ac764b8
@ -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);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
);
|
||||
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 @@ impl<'tcx> Cx<'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 @@ impl<'tcx> Cx<'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);
|
||||
|
Loading…
Reference in New Issue
Block a user