mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-13 19:32:41 +00:00
[MLIR] Add an Op util which returns its name with the dialect stripped.
Differential Revision: https://reviews.llvm.org/D81435
This commit is contained in:
parent
8e204f807b
commit
7b226fde67
@ -302,6 +302,9 @@ public:
|
||||
/// Return the name of the dialect this operation is registered to.
|
||||
StringRef getDialect() const;
|
||||
|
||||
/// Return the operation name with dialect name stripped, if it has one.
|
||||
StringRef stripDialect() const;
|
||||
|
||||
/// Return the name of this operation. This always succeeds.
|
||||
StringRef getStringRef() const;
|
||||
|
||||
|
@ -554,8 +554,7 @@ bool MLIRContext::isOperationRegistered(StringRef name) {
|
||||
}
|
||||
|
||||
void Dialect::addOperation(AbstractOperation opInfo) {
|
||||
assert((getNamespace().empty() ||
|
||||
opInfo.name.split('.').first == getNamespace()) &&
|
||||
assert((getNamespace().empty() || opInfo.dialect.name == getNamespace()) &&
|
||||
"op name doesn't start with dialect namespace");
|
||||
assert(&opInfo.dialect == this && "Dialect object mismatch");
|
||||
auto &impl = context->getImpl();
|
||||
|
@ -38,6 +38,12 @@ StringRef OperationName::getDialect() const {
|
||||
return getStringRef().split('.').first;
|
||||
}
|
||||
|
||||
/// Return the operation name with dialect name stripped, if it has one.
|
||||
StringRef OperationName::stripDialect() const {
|
||||
auto splitName = getStringRef().split(".");
|
||||
return splitName.second.empty() ? splitName.first : splitName.second;
|
||||
}
|
||||
|
||||
/// Return the name of this operation. This always succeeds.
|
||||
StringRef OperationName::getStringRef() const {
|
||||
if (auto *op = representation.dyn_cast<const AbstractOperation *>())
|
||||
|
Loading…
x
Reference in New Issue
Block a user