Add initial AST and MIR support for unwinding from inline assembly
This commit is contained in:
parent
532d2b14c0
commit
940b2eabad
39 changed files with 355 additions and 212 deletions
|
@ -467,8 +467,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
} else {
|
||||
Some(destination_block)
|
||||
},
|
||||
cleanup: None,
|
||||
},
|
||||
);
|
||||
if options.contains(InlineAsmOptions::MAY_UNWIND) {
|
||||
this.diverge_from(block);
|
||||
}
|
||||
destination_block.unit()
|
||||
}
|
||||
|
||||
|
|
|
@ -1034,6 +1034,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
|||
| TerminatorKind::Call { .. }
|
||||
| TerminatorKind::DropAndReplace { .. }
|
||||
| TerminatorKind::FalseUnwind { .. }
|
||||
| TerminatorKind::InlineAsm { .. }
|
||||
),
|
||||
"diverge_from called on block with terminator that cannot unwind."
|
||||
);
|
||||
|
@ -1373,7 +1374,8 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
|
|||
| TerminatorKind::DropAndReplace { unwind, .. }
|
||||
| TerminatorKind::FalseUnwind { unwind, .. }
|
||||
| TerminatorKind::Call { cleanup: unwind, .. }
|
||||
| TerminatorKind::Assert { cleanup: unwind, .. } => {
|
||||
| TerminatorKind::Assert { cleanup: unwind, .. }
|
||||
| TerminatorKind::InlineAsm { cleanup: unwind, .. } => {
|
||||
*unwind = Some(to);
|
||||
}
|
||||
TerminatorKind::Goto { .. }
|
||||
|
@ -1384,8 +1386,7 @@ impl<'tcx> DropTreeBuilder<'tcx> for Unwind {
|
|||
| TerminatorKind::Unreachable
|
||||
| TerminatorKind::Yield { .. }
|
||||
| TerminatorKind::GeneratorDrop
|
||||
| TerminatorKind::FalseEdge { .. }
|
||||
| TerminatorKind::InlineAsm { .. } => {
|
||||
| TerminatorKind::FalseEdge { .. } => {
|
||||
span_bug!(term.source_info.span, "cannot unwind from {:?}", term.kind)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue