[PATCH] D128474: [BOLT] Support multiple parents for split jump table

Huan Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 15:41:15 PDT 2022


nhuhuan created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
nhuhuan requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

There are two assumptions regarding jump table:
(a) It is accessed by only one fragment, say, Parent
(b) All entries target instructions in Parent

For (a), BOLT stores jump table entries as relative offset to Parent.
For (b), BOLT treats jump table entries target somewhere out of Parent
as INVALID_OFFSET, including fragment of same split function.

In this update, we extend (a) and (b) to include fragment of same split
functinon. For (a), we store jump table entries in absolute offset
instead. In addition, jump table will store all fragments that access
it. A fragment uses this information to only create label for jump table
entries that target to that fragment.

For (b), using absolute offset allows jump table entries to target
fragments of same split function, i.e., extend support for split jump
table. This can be done using relocation (fragment start/size) and
fragment detection heuristics (e.g., using symbol name pattern for
non-stripped binaries).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128474

Files:
  bolt/include/bolt/Core/BinaryContext.h
  bolt/include/bolt/Core/BinaryFunction.h
  bolt/include/bolt/Core/JumpTable.h
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Core/BinaryFunction.cpp
  bolt/lib/Core/JumpTable.cpp
  bolt/lib/Passes/AsmDump.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128474.439552.patch
Type: text/x-patch
Size: 17562 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220623/fcaf0966/attachment-0001.bin>


More information about the llvm-commits mailing list