[PATCH] D140633: [lld][ARM] don't use short thumb thunks if no branch range extension

Ties Stuij via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 23 09:50:55 PST 2022


stuij created this revision.
Herald added subscribers: kristof.beyls, arichardson, emaste.
Herald added a reviewer: MaskRay.
Herald added a project: All.
stuij requested review of this revision.
Herald added subscribers: llvm-commits, StephenFan.
Herald added a project: LLVM.

In ThumbThunk::isCompatibleWith, we check if we can use short thunks if we are
within branch range. However these short thumb thunks will generate b.w
instructions, and these are not available on pre branch range extension
architectures.

On these architectures (v4, v5, and most of v6), we could replace the b.w with a
Thumb b (2) instruction, but that would in an ideal situation only give us an
extra range of 2048 bytes on top of the 4MB range of a BL, if a thunk section
happens to be placed on the outer range of a BL and the stars are aligned. It
doesn't seem worth it.

What would be worth it is a state change to Arm and a subsequent branch to
either Arm or Thumb code. But that's the subject of another patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140633

Files:
  lld/ELF/Thunks.cpp
  lld/test/ELF/arm-thumb-range-thunk-os-no-ext.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140633.485142.patch
Type: text/x-patch
Size: 7651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221223/025be5dd/attachment.bin>


More information about the llvm-commits mailing list