summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
diff options
context:
space:
mode:
authorAmara Emerson <aemerson@apple.com>2019-06-21 18:10:38 +0000
committerAmara Emerson <aemerson@apple.com>2019-06-21 18:10:38 +0000
commitfe4625fb2485d7bdc2dfbe3561a4d1d638886b2c (patch)
tree552ecf790abac5ecfbf905e460ca015e37463b62 /llvm/lib/CodeGen/SwitchLoweringUtils.cpp
parent5698921be2d567f6abf925479ac9f5a376d6d74f (diff)
downloadbcm5719-llvm-fe4625fb2485d7bdc2dfbe3561a4d1d638886b2c.tar.gz
bcm5719-llvm-fe4625fb2485d7bdc2dfbe3561a4d1d638886b2c.zip
[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 llvm-svn: 364085
Diffstat (limited to 'llvm/lib/CodeGen/SwitchLoweringUtils.cpp')
-rw-r--r--llvm/lib/CodeGen/SwitchLoweringUtils.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SwitchLoweringUtils.cpp b/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
index 53b6940e06b..83acf7f8071 100644
--- a/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
+++ b/llvm/lib/CodeGen/SwitchLoweringUtils.cpp
@@ -52,6 +52,7 @@ void SwitchCG::SwitchLowering::findJumpTables(CaseClusterVector &Clusters,
assert(Clusters[i - 1].High->getValue().slt(Clusters[i].Low->getValue()));
#endif
+ assert(TLI && "TLI not set!");
if (!TLI->areJTsAllowed(SI->getParent()->getParent()))
return;
OpenPOWER on IntegriCloud