2015-06-30 07:51:55 +08:00
|
|
|
set(LLVM_TARGET_DEFINITIONS WebAssembly.td)
|
|
|
|
|
2018-04-04 20:37:44 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenAsmMatcher.inc -gen-asm-matcher)
|
2015-07-23 05:28:15 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenAsmWriter.inc -gen-asm-writer)
|
|
|
|
tablegen(LLVM WebAssemblyGenDAGISel.inc -gen-dag-isel)
|
2018-05-11 06:16:44 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenDisassemblerTables.inc -gen-disassembler)
|
2015-08-25 02:44:37 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenFastISel.inc -gen-fast-isel)
|
2015-07-23 05:28:15 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenInstrInfo.inc -gen-instr-info)
|
2015-06-30 07:51:55 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenMCCodeEmitter.inc -gen-emitter)
|
2015-07-11 02:23:10 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenRegisterInfo.inc -gen-register-info)
|
2015-06-30 07:51:55 +08:00
|
|
|
tablegen(LLVM WebAssemblyGenSubtargetInfo.inc -gen-subtarget)
|
2018-04-04 20:37:44 +08:00
|
|
|
|
2015-06-30 07:51:55 +08:00
|
|
|
add_public_tablegen_target(WebAssemblyCommonTableGen)
|
|
|
|
|
|
|
|
add_llvm_target(WebAssemblyCodeGen
|
2018-07-11 12:29:36 +08:00
|
|
|
WebAssemblyAddMissingPrototypes.cpp
|
2015-12-10 00:23:59 +08:00
|
|
|
WebAssemblyArgumentMove.cpp
|
2015-07-23 05:28:15 +08:00
|
|
|
WebAssemblyAsmPrinter.cpp
|
2015-09-17 00:51:30 +08:00
|
|
|
WebAssemblyCFGStackify.cpp
|
2017-02-28 06:38:58 +08:00
|
|
|
WebAssemblyCFGSort.cpp
|
2020-05-01 02:41:39 +08:00
|
|
|
WebAssemblyDebugFixup.cpp
|
2019-01-16 02:14:12 +08:00
|
|
|
WebAssemblyDebugValueManager.cpp
|
2018-06-25 09:07:11 +08:00
|
|
|
WebAssemblyLateEHPrepare.cpp
|
2018-06-25 09:20:21 +08:00
|
|
|
WebAssemblyExceptionInfo.cpp
|
2016-10-25 03:49:43 +08:00
|
|
|
WebAssemblyExplicitLocals.cpp
|
2015-08-25 02:44:37 +08:00
|
|
|
WebAssemblyFastISel.cpp
|
2020-06-04 05:04:59 +08:00
|
|
|
WebAssemblyFixBrTableDefaults.cpp
|
2016-03-09 10:01:14 +08:00
|
|
|
WebAssemblyFixIrreducibleControlFlow.cpp
|
2017-01-07 08:34:54 +08:00
|
|
|
WebAssemblyFixFunctionBitcasts.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblyFrameLowering.cpp
|
|
|
|
WebAssemblyISelDAGToDAG.cpp
|
|
|
|
WebAssemblyISelLowering.cpp
|
2015-07-23 05:28:15 +08:00
|
|
|
WebAssemblyInstrInfo.cpp
|
2015-12-05 11:03:35 +08:00
|
|
|
WebAssemblyLowerBrUnless.cpp
|
2016-08-18 23:27:25 +08:00
|
|
|
WebAssemblyLowerEmscriptenEHSjLj.cpp
|
2017-12-15 08:17:10 +08:00
|
|
|
WebAssemblyLowerGlobalDtors.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblyMachineFunctionInfo.cpp
|
2015-11-06 03:28:16 +08:00
|
|
|
WebAssemblyMCInstLower.cpp
|
2016-05-10 12:24:02 +08:00
|
|
|
WebAssemblyOptimizeLiveIntervals.cpp
|
2015-11-26 00:55:01 +08:00
|
|
|
WebAssemblyOptimizeReturned.cpp
|
|
|
|
WebAssemblyPeephole.cpp
|
2016-05-10 12:24:02 +08:00
|
|
|
WebAssemblyPrepareForLiveIntervals.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblyRegisterInfo.cpp
|
2015-11-17 00:18:28 +08:00
|
|
|
WebAssemblyRegColoring.cpp
|
2015-11-13 01:04:33 +08:00
|
|
|
WebAssemblyRegNumbering.cpp
|
2015-11-17 00:18:28 +08:00
|
|
|
WebAssemblyRegStackify.cpp
|
2016-05-10 12:24:02 +08:00
|
|
|
WebAssemblyReplacePhysRegs.cpp
|
2017-02-23 02:34:16 +08:00
|
|
|
WebAssemblyRuntimeLibcallSignatures.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblySelectionDAGInfo.cpp
|
2016-01-26 11:39:31 +08:00
|
|
|
WebAssemblySetP2AlignOperands.cpp
|
[WebAssembly] Fix getBottom for loops
When it was first created, CFGSort only made sure BBs in each
`MachineLoop` are sorted together. After we added exception support,
CFGSort now also sorts BBs in each `WebAssemblyException`, which
represents a `catch` block, together, and
`Region` class was introduced to be a thin wrapper for both
`MachineLoop` and `WebAssemblyException`.
But how we compute those loops and exceptions is different.
`MachineLoopInfo` is constructed using the standard loop computation
algorithm in LLVM; the definition of loop is "a set of BBs that are
dominated by a loop header and have a path back to the loop header". So
even if some BBs are semantically contained by a loop in the original
program, or in other words dominated by a loop header, if they don't
have a path back to the loop header, they are not considered a part of
the loop. For example, if a BB is dominated by a loop header but
contains `call abort()` or `rethrow`, it wouldn't have a path back to
the header, so it is not included in the loop.
But `WebAssemblyException` is wasm-specific data structure, and its
algorithm is simple: a `WebAssemblyException` consists of an EH pad and
all BBs dominated by the EH pad. So this scenario is possible: (This is
also the situation in the newly added test in cfg-stackify-eh.ll)
```
Loop L: header, A, ehpad, latch
Exception E: ehpad, latch, B
```
(B contains `abort()`, so it does not have a path back to the loop
header, so it is not included in L.)
And it is sorted in this order:
```
header
A
ehpad
latch
B
```
And when CFGStackify places `end_loop` or `end_try` markers, it
previously used `WebAssembly::getBottom()`, which returns the latest BB
in the sorted order, and placed the marker there. So in this case the
marker placements will be like this:
```
loop
header
try
A
catch
ehpad
latch
end_loop <-- misplaced!
B
end_try
```
in which nesting between the loop and the exception is not correct.
`end_loop` marker has to be placed after `B`, and also after `end_try`.
Maybe the fundamental way to solve this problem is to come up with our
own algorithm for computing loop region too, in which we include all BBs
dominated by a loop header in a loop. But this takes a lot more effort.
The only thing we need to fix is actually, `getBottom()`. If we make it
return the right BB, which means in case of a loop, the latest BB of the
loop itself and all exceptions contained in there, we are good.
This renames `Region` and `RegionInfo` to `SortRegion` and
`SortRegionInfo` and extracts them into their own file. And add
`getBottom` to `SortRegionInfo` class, from which it can access
`WebAssemblyExceptionInfo`, so that it can compute a correct bottom
block for loops.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D84724
2020-07-29 16:19:36 +08:00
|
|
|
WebAssemblySortRegion.cpp
|
2019-01-09 06:35:18 +08:00
|
|
|
WebAssemblyMemIntrinsicResults.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblySubtarget.cpp
|
|
|
|
WebAssemblyTargetMachine.cpp
|
2015-12-17 12:55:44 +08:00
|
|
|
WebAssemblyTargetObjectFile.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
WebAssemblyTargetTransformInfo.cpp
|
2016-10-25 03:49:43 +08:00
|
|
|
WebAssemblyUtilities.cpp
|
2015-06-30 07:51:55 +08:00
|
|
|
|
2016-11-17 12:36:50 +08:00
|
|
|
DEPENDS
|
|
|
|
intrinsics_gen
|
|
|
|
)
|
2015-06-30 07:51:55 +08:00
|
|
|
|
2018-03-21 04:06:35 +08:00
|
|
|
add_subdirectory(AsmParser)
|
2016-01-12 11:32:29 +08:00
|
|
|
add_subdirectory(Disassembler)
|
2015-06-30 07:51:55 +08:00
|
|
|
add_subdirectory(MCTargetDesc)
|
2016-01-08 09:06:00 +08:00
|
|
|
add_subdirectory(TargetInfo)
|