[all-commits] [llvm/llvm-project] 8ec9fd: Support unwinding from inline assembly

cynecx via All-commits all-commits at lists.llvm.org
Thu May 13 11:15:28 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ec9fd483949ca3b23053effcac226dcc56e7a95
      https://github.com/llvm/llvm-project/commit/8ec9fd483949ca3b23053effcac226dcc56e7a95
  Author: cynecx <me at cynecx.net>
  Date:   2021-05-13 (Thu, 13 May 2021)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Basic/TargetInfo.cpp
    M clang/lib/CodeGen/CGStmt.cpp
    M clang/lib/Sema/SemaStmtAsm.cpp
    A clang/test/CodeGenCXX/unwind-inline-asm.cpp
    M llvm/bindings/go/llvm/ir.go
    M llvm/include/llvm-c/Core.h
    M llvm/include/llvm/Bitcode/LLVMBitCodes.h
    M llvm/include/llvm/IR/InlineAsm.h
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/Bitcode/Reader/BitcodeReader.cpp
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
    M llvm/lib/IR/AsmWriter.cpp
    M llvm/lib/IR/ConstantsContext.h
    M llvm/lib/IR/Core.cpp
    M llvm/lib/IR/InlineAsm.cpp
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/lib/Transforms/Utils/InlineFunction.cpp
    M llvm/lib/Transforms/Utils/ValueMapper.cpp
    A llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-no-unwind-inline-asm.ll
    A llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-unwind-inline-asm.ll
    A llvm/test/CodeGen/AArch64/GlobalISel/unwind-inline-asm.ll
    A llvm/test/CodeGen/X86/no-seh-unwind-inline-asm-codegen.ll
    A llvm/test/CodeGen/X86/no-unwind-inline-asm-codegen.ll
    A llvm/test/CodeGen/X86/seh-unwind-inline-asm-codegen.ll
    A llvm/test/CodeGen/X86/sjlj-unwind-inline-asm-codegen.ll
    A llvm/test/CodeGen/X86/unwind-inline-asm-codegen.ll
    A llvm/test/Transforms/Inline/no-unwind-inline-asm.ll
    A llvm/test/Transforms/Inline/unwind-inline-asm.ll
    A llvm/test/Transforms/InstCombine/no-unwind-inline-asm.ll
    A llvm/test/Transforms/InstCombine/unwind-inline-asm.ll

  Log Message:
  -----------
  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




More information about the All-commits mailing list