Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/IR/MLIRContext.cpp
Show First 20 Lines • Show All 554 Lines • ▼ Show 20 Lines | |||||
void Dialect::addOperation(AbstractOperation opInfo) { | void Dialect::addOperation(AbstractOperation opInfo) { | ||||
assert((getNamespace().empty() || opInfo.dialect.name == getNamespace()) && | assert((getNamespace().empty() || opInfo.dialect.name == getNamespace()) && | ||||
"op name doesn't start with dialect namespace"); | "op name doesn't start with dialect namespace"); | ||||
assert(&opInfo.dialect == this && "Dialect object mismatch"); | assert(&opInfo.dialect == this && "Dialect object mismatch"); | ||||
auto &impl = context->getImpl(); | auto &impl = context->getImpl(); | ||||
// Lock access to the context registry. | // Lock access to the context registry. | ||||
StringRef opName = opInfo.name; | |||||
ScopedWriterLock registryLock(impl.contextMutex, impl.threadingIsEnabled); | ScopedWriterLock registryLock(impl.contextMutex, impl.threadingIsEnabled); | ||||
if (!impl.registeredOperations.insert({opInfo.name, opInfo}).second) { | if (!impl.registeredOperations.insert({opName, std::move(opInfo)}).second) { | ||||
llvm::errs() << "error: operation named '" << opInfo.name | llvm::errs() << "error: operation named '" << opName | ||||
<< "' is already registered.\n"; | << "' is already registered.\n"; | ||||
abort(); | abort(); | ||||
} | } | ||||
} | } | ||||
/// Register a dialect-specific symbol(e.g. type) with the current context. | /// Register a dialect-specific symbol(e.g. type) with the current context. | ||||
void Dialect::addSymbol(TypeID typeID) { | void Dialect::addSymbol(TypeID typeID) { | ||||
auto &impl = context->getImpl(); | auto &impl = context->getImpl(); | ||||
▲ Show 20 Lines • Show All 292 Lines • Show Last 20 Lines |