mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-26 23:21:11 +00:00
[mlir][CAPI] Add mlirOpOperandGetValue (#75032)
This commit is contained in:
parent
3764f5e816
commit
dc2ce60024
@ -940,6 +940,9 @@ MLIR_CAPI_EXPORTED void mlirValueReplaceAllUsesOfWith(MlirValue of,
|
||||
/// Returns whether the op operand is null.
|
||||
MLIR_CAPI_EXPORTED bool mlirOpOperandIsNull(MlirOpOperand opOperand);
|
||||
|
||||
/// Returns the value of an op operand.
|
||||
MLIR_CAPI_EXPORTED MlirValue mlirOpOperandGetValue(MlirOpOperand opOperand);
|
||||
|
||||
/// Returns the owner operation of an op operand.
|
||||
MLIR_CAPI_EXPORTED MlirOperation mlirOpOperandGetOwner(MlirOpOperand opOperand);
|
||||
|
||||
|
@ -986,6 +986,10 @@ MlirOperation mlirOpOperandGetOwner(MlirOpOperand opOperand) {
|
||||
return wrap(unwrap(opOperand)->getOwner());
|
||||
}
|
||||
|
||||
MlirValue mlirOpOperandGetValue(MlirOpOperand opOperand) {
|
||||
return wrap(unwrap(opOperand)->get());
|
||||
}
|
||||
|
||||
unsigned mlirOpOperandGetOperandNumber(MlirOpOperand opOperand) {
|
||||
return unwrap(opOperand)->getOperandNumber();
|
||||
}
|
||||
|
@ -1970,6 +1970,15 @@ int testOperands(void) {
|
||||
fprintf(stderr, "\n");
|
||||
// CHECK: Second replacement use owner: "dummy.op2"
|
||||
|
||||
MlirOpOperand use5 = mlirValueGetFirstUse(constTwoValue);
|
||||
MlirOpOperand use6 = mlirOpOperandGetNextUse(use5);
|
||||
if (!mlirValueEqual(mlirOpOperandGetValue(use5),
|
||||
mlirOpOperandGetValue(use6))) {
|
||||
fprintf(stderr,
|
||||
"ERROR: First and second operand should share the same value\n");
|
||||
return 5;
|
||||
}
|
||||
|
||||
mlirOperationDestroy(op);
|
||||
mlirOperationDestroy(op2);
|
||||
mlirOperationDestroy(constZero);
|
||||
|
Loading…
Reference in New Issue
Block a user