Support unwinding from inline assembly
I've taken the following steps to add unwinding support from inline assembly:
1) Add a new `unwind` "attribute" (like `sideeffect`) to the asm syntax:
```
invoke void asm sideeffect unwind "call thrower", "~{dirflag},~{fpsr},~{flags}"()
to label %exit unwind label %uexit
```
2.) Add Bitcode writing/reading support + LLVM-IR parsing.
3.) Emit EHLabels around inline assembly lowering (SelectionDAGBuilder + GlobalISel) when `InlineAsm::canThrow` is enabled.
4.) Tweak InstCombineCalls/InlineFunction pass to not mark inline assembly "calls" as nounwind.
5.) Add clang support by introducing a new clobber: "unwind", which lower to the `canThrow` being enabled.
6.) Don't allow unwinding callbr.
Reviewed By: Amanieu
Differential Revision: https://reviews.llvm.org/D95745
This commit is contained in:
@@ -2429,9 +2429,9 @@ void ModuleBitcodeWriter::writeConstants(unsigned FirstVal, unsigned LastVal,
|
||||
}
|
||||
|
||||
if (const InlineAsm *IA = dyn_cast<InlineAsm>(V)) {
|
||||
Record.push_back(unsigned(IA->hasSideEffects()) |
|
||||
unsigned(IA->isAlignStack()) << 1 |
|
||||
unsigned(IA->getDialect()&1) << 2);
|
||||
Record.push_back(
|
||||
unsigned(IA->hasSideEffects()) | unsigned(IA->isAlignStack()) << 1 |
|
||||
unsigned(IA->getDialect() & 1) << 2 | unsigned(IA->canThrow()) << 3);
|
||||
|
||||
// Add the asm string.
|
||||
const std::string &AsmStr = IA->getAsmString();
|
||||
|
||||
Reference in New Issue
Block a user