Use AnonConst for asm! constants
This commit is contained in:
parent
cbd6ec7604
commit
32be124e30
37 changed files with 281 additions and 242 deletions
|
@ -366,9 +366,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
}),
|
||||
}
|
||||
}
|
||||
thir::InlineAsmOperand::Const { expr } => mir::InlineAsmOperand::Const {
|
||||
value: unpack!(block = this.as_local_operand(block, expr)),
|
||||
},
|
||||
thir::InlineAsmOperand::Const { value, span } => {
|
||||
mir::InlineAsmOperand::Const {
|
||||
value: box Constant { span, user_ty: None, literal: value.into() },
|
||||
}
|
||||
}
|
||||
thir::InlineAsmOperand::SymFn { expr } => {
|
||||
mir::InlineAsmOperand::SymFn { value: box this.as_constant(expr) }
|
||||
}
|
||||
|
|
|
@ -503,8 +503,12 @@ impl<'thir, 'tcx> Cx<'thir, 'tcx> {
|
|||
in_expr: self.mirror_expr(in_expr),
|
||||
out_expr: out_expr.as_ref().map(|expr| self.mirror_expr(expr)),
|
||||
},
|
||||
hir::InlineAsmOperand::Const { ref expr } => {
|
||||
InlineAsmOperand::Const { expr: self.mirror_expr(expr) }
|
||||
hir::InlineAsmOperand::Const { ref anon_const } => {
|
||||
let anon_const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id);
|
||||
let value = ty::Const::from_anon_const(self.tcx, anon_const_def_id);
|
||||
let span = self.tcx.hir().span(anon_const.hir_id);
|
||||
|
||||
InlineAsmOperand::Const { value, span }
|
||||
}
|
||||
hir::InlineAsmOperand::Sym { ref expr } => {
|
||||
let qpath = match expr.kind {
|
||||
|
|
|
@ -374,7 +374,8 @@ pub enum InlineAsmOperand<'thir, 'tcx> {
|
|||
out_expr: Option<&'thir Expr<'thir, 'tcx>>,
|
||||
},
|
||||
Const {
|
||||
expr: &'thir Expr<'thir, 'tcx>,
|
||||
value: &'tcx Const<'tcx>,
|
||||
span: Span,
|
||||
},
|
||||
SymFn {
|
||||
expr: &'thir Expr<'thir, 'tcx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue