aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAnalysisManager.cpp
diff options
context:
space:
mode:
authorSimon Tatham <simon.tatham@arm.com>2023-02-16 15:34:33 +0000
committerSimon Tatham <simon.tatham@arm.com>2023-02-20 10:46:47 +0000
commita8cd35c3b7d56608fe7799fa203ab86bdf0315ca (patch)
tree869f867cbb06beb52b2c4bfec938d5d766652542 /llvm/lib/Analysis/LoopAnalysisManager.cpp
parent9333b977638475d6b068cd005f8ea39406634c57 (diff)
downloadllvm-a8cd35c3b7d56608fe7799fa203ab86bdf0315ca.zip
llvm-a8cd35c3b7d56608fe7799fa203ab86bdf0315ca.tar.gz
llvm-a8cd35c3b7d56608fe7799fa203ab86bdf0315ca.tar.bz2
[LowerTypeTests] Support generating Armv6-M jump tables. (reland)
[Originally committed as f6ddf7781471b71243fa3c3ae7c93073f95c7dff; reverted in bbef38352fbade9e014ec97d5991da5dee306da7 due to test breakage; now relanded with the Arm tests conditioned on `arm-registered-target`] The LowerTypeTests pass emits a jump table in the form of an `inlineasm` IR node containing a string representation of some assembly. It tests the target triple to see what architecture it should be generating assembly for. But that's not good enough for `Triple::thumb`, because the 32-bit PC-relative `b.w` branch instruction isn't available in all supported architecture versions. In particular, Armv6-M doesn't support that instruction (although the similar Armv8-M Baseline does). Most of this patch is concerned with working out whether the compilation target is Armv6-M or not, which I'm doing by going through all the functions in the module, retrieving a TargetTransformInfo for each one, and querying it via a new method I've added to check its SubtargetInfo. If any function's TTI indicates that it's targeting an architecture supporting B.W, then we assume we're also allowed to use B.W in the jump table. The Armv6-M compatible jump table format requires a temporary register, and therefore also has to use the stack in order to restore that register. Another consequence of this change is that jump tables on Arm/Thumb are no longer always the same size. In particular, on an architecture that supports Arm and Thumb-1 but not Thumb-2, the Arm and Thumb tables are different sizes from //each other//. As a consequence, ``getJumpTableEntrySize`` can no longer base its answer on the target triple's architecture: it has to take into account the decision that ``selectJumpTableArmEncoding`` made, which meant I had to move that function to an earlier point in the code and store its answer in the ``LowerTypeTestsModule`` class. Reviewed By: lenary Differential Revision: https://reviews.llvm.org/D143576
Diffstat (limited to 'llvm/lib/Analysis/LoopAnalysisManager.cpp')
0 files changed, 0 insertions, 0 deletions