llvm-project/llvm/lib/CodeGen/SelectionDAG
Heejin Ahn d6f487863d [WebAssembly] Exception handling: Switch to the new proposal
Summary:
This switches the EH implementation to the new proposal:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
(The previous proposal was
 https://github.com/WebAssembly/exception-handling/blob/master/proposals/old/Exceptions.md)

- Instruction changes
  - Now we have one single `catch` instruction that returns a except_ref
    value
  - `throw` now can take variable number of operations
  - `rethrow` does not have 'depth' argument anymore
  - `br_on_exn` queries an except_ref to see if it matches the tag and
    branches to the given label if true.
  - `extract_exception` is a pseudo instruction that simulates popping
    values from wasm stack. This is to make `br_on_exn`, a very special
    instruction, work: `br_on_exn` puts values onto the stack only if it
    is taken, and the # of values can vay depending on the tag.

- Now there's only one `catch` per `try`, this patch removes all special
  handling for terminate pad with a call to `__clang_call_terminate`.
  Before it was the only case there are two catch clauses (a normal
  `catch` and `catch_all` per `try`).

- Make `rethrow` act as a terminator like `throw`. This splits BB after
  `rethrow` in WasmEHPrepare, and deletes an unnecessary `unreachable`
  after `rethrow` in LateEHPrepare.

- Now we stop at all catchpads (because we add wasm `catch` instruction
  that catches all exceptions), this creates new
  `findWasmUnwindDestinations` function in SelectionDAGBuilder.

- Now we use `br_on_exn` instrution to figure out if an except_ref
  matches the current tag or not, LateEHPrepare generates this sequence
  for catch pads:
```
  catch
  block i32
  br_on_exn $__cpp_exception
  end_block
  extract_exception
```

- Branch analysis for `br_on_exn` in WebAssemblyInstrInfo

- Other various misc. changes to switch to the new proposal.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

Differential Revision: https://reviews.llvm.org/D57134

llvm-svn: 352598
2019-01-30 03:21:57 +00:00
..
CMakeLists.txt Remove trailing whitespace to trigger re-cmaking 2017-10-02 21:54:38 +00:00
DAGCombiner.cpp [DAGCombiner] fold extract_subvector of extract_subvector 2019-01-29 19:13:39 +00:00
FastISel.cpp Fix emission of _fltused for MSVC. 2019-01-24 18:34:00 +00:00
FunctionLoweringInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InstrEmitter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InstrEmitter.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LegalizeDAG.cpp [TargetLowering] Rename getExpandedFixedPointMultiplication to expandFixedPointMul. NFCI. 2019-01-24 15:46:54 +00:00
LegalizeFloatTypes.cpp [LegalizeTypes] Add debug prints to the top of PromoteFloatOperand and PromoteFloatResult. 2019-01-22 22:33:55 +00:00
LegalizeIntegerTypes.cpp Recommit r352255 "[SelectionDAG][X86] Don't use SEXTLOAD for promoting masked loads in the type legalizer" 2019-01-28 21:38:47 +00:00
LegalizeTypes.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LegalizeTypes.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LegalizeTypesGeneric.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LegalizeVectorOps.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LegalizeVectorTypes.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ResourcePriorityQueue.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SDNodeDbgValue.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScheduleDAGFast.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScheduleDAGRRList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScheduleDAGSDNodes.cpp [DebugInfo][DAG] Avoid re-ordering of DBG_VALUEs 2019-01-28 12:08:31 +00:00
ScheduleDAGSDNodes.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ScheduleDAGVLIW.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SelectionDAG.cpp Codegen support for atomicrmw fadd/fsub 2019-01-22 18:36:06 +00:00
SelectionDAGAddressAnalysis.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SelectionDAGBuilder.cpp [WebAssembly] Exception handling: Switch to the new proposal 2019-01-30 03:21:57 +00:00
SelectionDAGBuilder.h Reversing the checkin for version 352484 as tests are failing. 2019-01-29 15:00:50 +00:00
SelectionDAGDumper.cpp [X86] Update SelectionDAGDumper to print the extension type and expanding flag for masked loads. Add truncating and compressing for masked stores. 2019-01-24 07:51:34 +00:00
SelectionDAGISel.cpp Fix emission of _fltused for MSVC. 2019-01-24 18:34:00 +00:00
SelectionDAGPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SelectionDAGTargetInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StatepointLowering.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
StatepointLowering.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TargetLowering.cpp Adjust documentation for git migration. 2019-01-29 16:37:27 +00:00