3 Commits

Author SHA1 Message Date
Amara Emerson
4878bbd9a2 [GlobalISel][IRTranslator] Change switch table translation to generate jump tables and range checks.
This change makes use of the newly refactored SwitchLoweringUtils code from
SelectionDAG to in order to generate jump tables and range checks where appropriate.

Much of this code is ported from SDAG with some modifications. We generate
G_JUMP_TABLE and G_BRJT instructions when JT opportunities are found. This means
that targets which previously relied on the naive one MBB per case stmt
translation will now start falling back until they add support for the new opcodes.

For range checks, we don't generate any previously unused operations. This
just recognizes contiguous ranges of case values and generates a single block per
range. Single case value blocks are just a special case of ranges so we get that
support almost for free.

There are still some optimizations missing that I haven't ported over, and
bit-tests are also unimplemented. This patch series is already complex enough.

Actual arm64 support for selection of jump tables is coming in a later patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364085 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-21 18:10:38 +00:00
Evandro Menezes
ecb26a7f3f [CodeGen] Fix formatting and comments (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363947 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-20 16:34:00 +00:00
Amara Emerson
27a3c6c8d9 Factor out SelectionDAG's switch analysis and lowering into a separate component.
In order for GlobalISel to re-use the significant amount of analysis and
optimization code in SDAG's switch lowering, we first have to extract it and
create an interface to be used by both frameworks.

No test changes as it's NFC.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362857 91177308-0d34-0410-b5e6-96231b3b80d8
2019-06-08 00:05:17 +00:00