[all-commits] [llvm/llvm-project] 05523d: [BOLT] Support multiple parents for split jump table

Huan Nguyen via All-commits all-commits at lists.llvm.org
Wed Jul 13 23:38:06 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 05523dc32d8ca81d9a92ff955194a9e80cf79dc0
      https://github.com/llvm/llvm-project/commit/05523dc32d8ca81d9a92ff955194a9e80cf79dc0
  Author: Huan Nguyen <nhuhuan at yahoo.com>
  Date:   2022-07-13 (Wed, 13 Jul 2022)

  Changed paths:
    M bolt/include/bolt/Core/BinaryContext.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/JumpTable.h
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/JumpTable.cpp
    M bolt/lib/Passes/AsmDump.cpp
    M bolt/lib/Rewrite/RewriteInstance.cpp
    A bolt/test/X86/jump-table-move.s
    M bolt/test/X86/split-func-jump-table-fragment-bidirection.s

  Log Message:
  -----------
  [BOLT] Support multiple parents for split jump table

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).

For jump table targets that can only be reached by one fragment, we
mark them as local label; otherwise, they would be the secondary
function entry to the target fragment.

Test Plan
```
ninja check-bolt
```

Reviewed By: Amir

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




More information about the All-commits mailing list