1
Fork 0

Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieu

Remove deprecated LLVM-style inline assembly

The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove
it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it
is time to remove `llvm_asm!` to avoid continued maintenance cost.

Closes #70173.
Closes #92794.
Closes #87612.
Closes #82065.

cc `@rust-lang/wg-inline-asm`

r? `@Amanieu`
This commit is contained in:
bors 2022-01-17 09:40:29 +00:00
commit a34c079752
171 changed files with 235 additions and 3297 deletions

View file

@ -569,7 +569,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
| ExprKind::ConstBlock { .. }
| ExprKind::StaticRef { .. }
| ExprKind::InlineAsm { .. }
| ExprKind::LlvmInlineAsm { .. }
| ExprKind::Yield { .. }
| ExprKind::ThreadLocalRef(_)
| ExprKind::Call { .. } => {

View file

@ -350,7 +350,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
| ExprKind::Continue { .. }
| ExprKind::Return { .. }
| ExprKind::InlineAsm { .. }
| ExprKind::LlvmInlineAsm { .. }
| ExprKind::PlaceTypeAscription { .. }
| ExprKind::ValueTypeAscription { .. } => {
// these do not have corresponding `Rvalue` variants,

View file

@ -67,8 +67,7 @@ impl Category {
| ExprKind::Repeat { .. }
| ExprKind::Assign { .. }
| ExprKind::AssignOp { .. }
| ExprKind::ThreadLocalRef(_)
| ExprKind::LlvmInlineAsm { .. } => Some(Category::Rvalue(RvalueFunc::AsRvalue)),
| ExprKind::ThreadLocalRef(_) => Some(Category::Rvalue(RvalueFunc::AsRvalue)),
ExprKind::ConstBlock { .. } | ExprKind::Literal { .. } | ExprKind::StaticRef { .. } => {
Some(Category::Constant)

View file

@ -477,9 +477,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
// These cases don't actually need a destination
ExprKind::Assign { .. }
| ExprKind::AssignOp { .. }
| ExprKind::LlvmInlineAsm { .. } => {
ExprKind::Assign { .. } | ExprKind::AssignOp { .. } => {
unpack!(block = this.stmt_expr(block, expr, None));
this.cfg.push_assign_unit(block, source_info, destination, this.tcx);
block.unit()

View file

@ -101,38 +101,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
BreakableTarget::Return,
source_info,
),
ExprKind::LlvmInlineAsm { asm, ref outputs, ref inputs } => {
debug!("stmt_expr LlvmInlineAsm block_context.push(SubExpr) : {:?}", expr);
this.block_context.push(BlockFrame::SubExpr);
let outputs = outputs
.into_iter()
.copied()
.map(|output| unpack!(block = this.as_place(block, &this.thir[output])))
.collect::<Vec<_>>()
.into_boxed_slice();
let inputs = inputs
.into_iter()
.copied()
.map(|input| {
let input = &this.thir[input];
(input.span, unpack!(block = this.as_local_operand(block, &input)))
})
.collect::<Vec<_>>()
.into_boxed_slice();
this.cfg.push(
block,
Statement {
source_info,
kind: StatementKind::LlvmInlineAsm(Box::new(LlvmInlineAsm {
asm: asm.clone(),
outputs,
inputs,
})),
},
);
this.block_context.pop();
block.unit()
}
_ => {
assert!(
statement_scope.is_some(),

View file

@ -329,7 +329,6 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
| ExprKind::Box { .. }
| ExprKind::If { .. }
| ExprKind::InlineAsm { .. }
| ExprKind::LlvmInlineAsm { .. }
| ExprKind::LogicalOp { .. }
| ExprKind::Use { .. } => {
// We don't need to save the old value and restore it
@ -377,7 +376,7 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
self.requires_unsafe(expr.span, DerefOfRawPointer);
}
}
ExprKind::InlineAsm { .. } | ExprKind::LlvmInlineAsm { .. } => {
ExprKind::InlineAsm { .. } => {
self.requires_unsafe(expr.span, UseOfInlineAssembly);
}
ExprKind::Adt(box Adt {

View file

@ -570,12 +570,6 @@ impl<'tcx> Cx<'tcx> {
line_spans: asm.line_spans,
},
hir::ExprKind::LlvmInlineAsm(ref asm) => ExprKind::LlvmInlineAsm {
asm: &asm.inner,
outputs: self.mirror_exprs(asm.outputs_exprs),
inputs: self.mirror_exprs(asm.inputs_exprs),
},
hir::ExprKind::ConstBlock(ref anon_const) => {
let anon_const_def_id = self.tcx.hir().local_def_id(anon_const.hir_id);
let value = ty::Const::from_inline_const(self.tcx, anon_const_def_id);