[all-commits] [llvm/llvm-project] 855e86: [X86] Add MI-layer routine for getting the index o...

Nicholas Mosier via All-commits all-commits at lists.llvm.org
Mon Jan 15 18:55:12 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 855e863004966e8856c0ab518c08079a1d192df2
      https://github.com/llvm/llvm-project/commit/855e863004966e8856c0ab518c08079a1d192df2
  Author: Nicholas Mosier <nmosier at stanford.edu>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M llvm/lib/Target/X86/X86InstrInfo.cpp
    M llvm/lib/Target/X86/X86InstrInfo.h
    M llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp
    M llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp

  Log Message:
  -----------
  [X86] Add MI-layer routine for getting the index of the first address operand, NFC (#78019)

Add the MI-layer routine X86::getFirstAddrOperandIdx(), which returns
the index of the first address operand of a MachineInstr (or -1 if there
is none).

X86II::getMemoryOperandNo(), the existing MC-layer routine used to
obtain the index of the first address operand in a 5-operand X86 memory
reference, is incomplete: it does not handle pseudo-instructions like
TCRETURNmi, resulting in security holes in the mitigation passes that
use it (e.g., x86-slh and x86-lvi-load).

X86::getFirstAddrOperandIdx() handles both pseudo and real instructions
and is thus more suitable for most use cases than
X86II::getMemoryOperandNo(), especially in mitigation passes like
x86-slh and x86-lvi-load. For this reason, this patch replaces all uses
of X86II::getMemoryOperandNo() with X86::getFirstAddrOperandIdx() in the
aforementioned mitigation passes.




More information about the All-commits mailing list