diff options
author | Job Noorman <jnoorman@igalia.com> | 2023-10-20 06:09:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 06:09:01 +0000 |
commit | 614a8cbfd155b706688cfca0101f8d99988a9871 (patch) | |
tree | a75429f9188e9556753bb39163ebb7d32c430aaf /mlir/test/lib/Interfaces/TilingInterface/TestTilingInterface.cpp | |
parent | b2d3c7b200492e8b4b45e71da53c3331a557b67c (diff) | |
download | llvm-614a8cbfd155b706688cfca0101f8d99988a9871.zip llvm-614a8cbfd155b706688cfca0101f8d99988a9871.tar.gz llvm-614a8cbfd155b706688cfca0101f8d99988a9871.tar.bz2 |
[MC][NFC] Allow MCInstrAnalysis to store state (#65479)
Currently, all the analysis functions provided by `MCInstrAnalysis` work
on a single instruction. On some targets, this limits the kind of
instructions that can be successfully analyzed as common constructs may
need multiple instructions.
For example, a typical call sequence on RISC-V uses a auipc+jalr pair.
In order to analyse the jalr inside `evaluateBranch`, information about
the corresponding auipc is needed. Similarly, AArch64 uses adrp+ldr
pairs to access globals.
This patch proposes to add state to `MCInstrAnalysis` to support these
use cases. Two new virtual methods are added:
- `updateState`: takes an instruction and its address. This methods
should be called by clients on every instruction and allows targets to
store whatever information they need to analyse future instructions.
- `resetState`: clears the state whenever it becomes irrelevant. Clients
could call this, for example, when starting to disassemble a new
function.
Note that the default implementations do nothing so this patch is NFC.
No actual state is stored inside `MCInstrAnalysis`; deciding the
structure of the state is left to the targets.
This patch also modifies llvm-objdump to use the new interface.
This patch is an alternative to
[D116677](https://reviews.llvm.org/D116677) and the idea of storing
state in `MCInstrAnalysis` was first discussed there.
Diffstat (limited to 'mlir/test/lib/Interfaces/TilingInterface/TestTilingInterface.cpp')
0 files changed, 0 insertions, 0 deletions