diff options
author | Mike Urbach <mikeurbach@gmail.com> | 2022-12-06 15:56:08 -0700 |
---|---|---|
committer | Mike Urbach <mikeurbach@gmail.com> | 2022-12-12 14:14:53 -0700 |
commit | dd8e443539cc3e3cb4389268e58934910b5455c3 (patch) | |
tree | c8839b2bce3d16438b813ef0b3e3c55e64f1052d /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 9beb8d1109c00575c9a30df5f931804cd81ad891 (diff) | |
download | llvm-dd8e443539cc3e3cb4389268e58934910b5455c3.zip llvm-dd8e443539cc3e3cb4389268e58934910b5455c3.tar.gz llvm-dd8e443539cc3e3cb4389268e58934910b5455c3.tar.bz2 |
[mlir][CAPI] Add a simple MlirOpOperand API for MlirValue uses.
This allows basic IR traversal via the C API, which is useful for
analyses in languages other than C++.
This starts by defining an MlirOpOperand struct to encapsulate a pair
of an owner operation and an operand number.
A new API is added for MlirValue, to return the first use of the Value
as an MlirOpOperand, or a "null" MlirOpOperand if there are no uses.
A couple APIs are added for MlirOpOperand. The first checks if an
MlirOpOperand is "null", by checking if its owner's pointer is
null. The second supports iteration along the use-def lists by
accepting an MlirOpOperand and returning the next use of the Value as
another MlirOpOperand, or a "null" MlirOpOperand if there are no more
uses.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D139596
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions