diff options
author | Anatoly Trosinenko <atrosinenko@accesssoftek.com> | 2025-09-30 21:24:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-30 21:24:44 +0300 |
commit | d884b55ea40e455bcef162d6c6e3176c078f41ef (patch) | |
tree | 8abb2d0568c1363f02313d021a524ead45335812 /lldb/packages/Python/lldbsuite/test/configuration.py | |
parent | 6caa0d05c2282feafa1479141c0009257639e48f (diff) | |
download | llvm-d884b55ea40e455bcef162d6c6e3176c078f41ef.zip llvm-d884b55ea40e455bcef162d6c6e3176c078f41ef.tar.gz llvm-d884b55ea40e455bcef162d6c6e3176c078f41ef.tar.bz2 |
[BOLT] Introduce helpers to match `MCInst`s one at a time (NFC) (#138883)
Introduce a low-level instruction matching DSL to capture and/or match
the operands of MCInst, single instruction at a time. Unlike the
existing `MCPlusBuilder::MCInstMatcher` machinery, this DSL is intended
for the use cases when the precise control over the instruction order is
required. For example, when validating PtrAuth hardening, all registers
are usually considered unsafe after a function call, even though
callee-saved registers should preserve their old
values _under normal operation_.
Usage example:
// Bring the short names into the local scope:
using namespace LowLevelInstMatcherDSL;
// Declare the registers to capture:
Reg Xn, Xm;
// Capture the 0th and 1st operands, match the 2nd operand against the
// just captured Xm register, match the 3rd operand against literal 0:
if (!matchInst(MaybeAdd, AArch64::ADDXrs, Xm, Xn, Xm, Imm(0))
return AArch64::NoRegister;
// Match the 0th operand against Xm:
if (!matchInst(MaybeBr, AArch64::BR, Xm))
return AArch64::NoRegister;
// Manually check that Xm and Xn did not match the same register:
if (Xm.get() == Xn.get())
return AArch64::NoRegister;
// Return the matched register:
return Xm.get();
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/configuration.py')
0 files changed, 0 insertions, 0 deletions