[all-commits] [llvm/llvm-project] 1012d4: [CodeGen] Refactor and document ThunkInserter

Anatoly Trosinenko via All-commits all-commits at lists.llvm.org
Tue Jul 2 12:51:14 PDT 2024


  Branch: refs/heads/users/atrosinenko/refactor-thunk-inserter
  Home:   https://github.com/llvm/llvm-project
  Commit: 1012d4cdc68770a24825338ca3aaf405ebe0a96e
      https://github.com/llvm/llvm-project/commit/1012d4cdc68770a24825338ca3aaf405ebe0a96e
  Author: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
  Date:   2024-07-02 (Tue, 02 Jul 2024)

  Changed paths:
    M llvm/include/llvm/CodeGen/IndirectThunks.h
    M llvm/lib/Target/AArch64/AArch64SLSHardening.cpp
    M llvm/lib/Target/ARM/ARMSLSHardening.cpp
    M llvm/lib/Target/X86/X86IndirectThunks.cpp

  Log Message:
  -----------
  [CodeGen] Refactor and document ThunkInserter

In preparation for supporting BLRA* instructions in SLS Hardening on
AArch64, refactor ThunkInserter class.

The main intention of this commit is to document the way to merge
the BLR-rewriting logic of the AArch64SLSHardening pass into the
SLSBLRThunkInserter class. This makes it possible to only call
createThunkFunction for the thunks that are actually referenced.
Ultimately, it will prevent SLSBLRThunkInserter from unconditionally
generating about 1800 thunk functions corresponding to every possible
combination of operands passed to BLRAA or BLRAB instructions.

This particular commit does not affect the generated machine code and
consists of the following changes:
* document the existing behavior of ThunkInserter class
* introduce ThunkInserterPass template class to get rid of mostly
  identical boilerplate code in ARM, AArch64 and X86 implementations
* move the InsertedThunks parameter from `mayUseThunk` to
  `insertThunks` method



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list