mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 03:56:16 +08:00
[mlir][CAPI] Add APIs for mlirOperationGetName and Identifier.
Reviewed By: ftynse Differential Revision: https://reviews.llvm.org/D90583
This commit is contained in:
@@ -249,6 +249,10 @@ int mlirOperationEqual(MlirOperation op, MlirOperation other) {
|
||||
return unwrap(op) == unwrap(other);
|
||||
}
|
||||
|
||||
MlirIdentifier mlirOperationGetName(MlirOperation op) {
|
||||
return wrap(unwrap(op)->getName().getIdentifier());
|
||||
}
|
||||
|
||||
MlirBlock mlirOperationGetBlock(MlirOperation op) {
|
||||
return wrap(unwrap(op)->getBlock());
|
||||
}
|
||||
@@ -576,3 +580,19 @@ void mlirAttributeDump(MlirAttribute attr) { unwrap(attr).dump(); }
|
||||
MlirNamedAttribute mlirNamedAttributeGet(const char *name, MlirAttribute attr) {
|
||||
return MlirNamedAttribute{name, attr};
|
||||
}
|
||||
|
||||
/*============================================================================*/
|
||||
/* Identifier API. */
|
||||
/*============================================================================*/
|
||||
|
||||
MlirIdentifier mlirIdentifierGet(MlirContext context, MlirStringRef str) {
|
||||
return wrap(Identifier::get(unwrap(str), unwrap(context)));
|
||||
}
|
||||
|
||||
int mlirIdentifierEqual(MlirIdentifier ident, MlirIdentifier other) {
|
||||
return unwrap(ident) == unwrap(other);
|
||||
}
|
||||
|
||||
MlirStringRef mlirIdentifierStr(MlirIdentifier ident) {
|
||||
return wrap(unwrap(ident).strref());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user