Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/IR/Verifier.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | LogicalResult OperationVerifier::verifyOperation( | ||||
// Check that operands are non-nil and structurally ok. | // Check that operands are non-nil and structurally ok. | ||||
for (auto operand : op.getOperands()) | for (auto operand : op.getOperands()) | ||||
if (!operand) | if (!operand) | ||||
return op.emitError("null operand found"); | return op.emitError("null operand found"); | ||||
/// Verify that all of the attributes are okay. | /// Verify that all of the attributes are okay. | ||||
for (auto attr : op.getAttrs()) { | for (auto attr : op.getAttrs()) { | ||||
// Check for any optional dialect specific attributes. | // Check for any optional dialect specific attributes. | ||||
if (auto *dialect = attr.first.getDialect()) | if (auto *dialect = attr.first.getReferencedDialect()) | ||||
if (failed(dialect->verifyOperationAttribute(&op, attr))) | if (failed(dialect->verifyOperationAttribute(&op, attr))) | ||||
return failure(); | return failure(); | ||||
} | } | ||||
// If we can get operation info for this, check the custom hook. | // If we can get operation info for this, check the custom hook. | ||||
OperationName opName = op.getName(); | OperationName opName = op.getName(); | ||||
auto *opInfo = opName.getAbstractOperation(); | auto *opInfo = opName.getAbstractOperation(); | ||||
if (opInfo && failed(opInfo->verifyInvariants(&op))) | if (opInfo && failed(opInfo->verifyInvariants(&op))) | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |