numRegions(numRegions), hasOperandStorage(hasOperandStorage), name(name),
attrs(attributes) {
assert(attributes && "unexpected null attribute dictionary");
-#ifndef NDEBUG
- if (!getDialect() && !getContext()->allowsUnregisteredDialects())
- llvm::report_fatal_error(
- name.getStringRef() +
- " created with unregistered dialect. If this is intended, please call "
- "allowUnregisteredDialects() on the MLIRContext, or use "
- "-allow-unregistered-dialect with the MLIR opt tool used");
-#endif
}
// Operations are deleted through the destroy() member because they are
// Otherwise, this is a forward reference. Create a placeholder and remember
// that we did so.
- Value result = createForwardRefPlaceholder(useInfo.loc, type);
+ auto result = createForwardRefPlaceholder(useInfo.loc, type);
entries[useInfo.number] = {result, useInfo.loc};
return maybeRecordUse(result);
}
// We create these placeholders as having an empty name, which we know
// cannot be created through normal user input, allowing us to distinguish
// them.
- auto name = OperationName("unrealized_conversion_cast", getContext());
+ auto name = OperationName("placeholder", getContext());
auto *op = Operation::create(
getEncodedSourceLocation(loc), name, type, /*operands=*/{},
/*attributes=*/llvm::None, /*successors=*/{}, /*numRegions=*/0);
/// block/operation-relative API and their final order is checked.
static void buildWithInsertionsAndPrint(MlirContext ctx) {
MlirLocation loc = mlirLocationUnknownGet(ctx);
- mlirContextSetAllowUnregisteredDialects(ctx, true);
MlirRegion owningRegion = mlirRegionCreate();
MlirBlock nullBlock = mlirRegionGetFirstBlock(owningRegion);
mlirOperationDump(op);
mlirOperationDestroy(op);
- mlirContextSetAllowUnregisteredDialects(ctx, false);
// clang-format off
// CHECK-LABEL: "insertion.order.test"
// CHECK: ^{{.*}}(%{{.*}}: i1
// CHECK-LABEL: @testOperands
MlirContext ctx = mlirContextCreate();
- mlirRegisterAllDialects(ctx);
- mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("test"));
MlirLocation loc = mlirLocationUnknownGet(ctx);
MlirType indexType = mlirIndexTypeGet(ctx);
MlirValue constOneValue = mlirOperationGetResult(constOne, 0);
// Create the operation under test.
- mlirContextSetAllowUnregisteredDialects(ctx, true);
MlirOperationState opState =
mlirOperationStateGet(mlirStringRefCreateFromCString("dummy.op"), loc);
MlirValue initialOperands[] = {constZeroValue};
MlirValue opOperand = mlirOperationGetOperand(op, 0);
fprintf(stderr, "Original operand: ");
mlirValuePrint(opOperand, printToStderr, NULL);
- // CHECK: Original operand: {{.+}} constant 0 : index
+ // CHECK: Original operand: {{.+}} {value = 0 : index}
mlirOperationSetOperand(op, 0, constOneValue);
opOperand = mlirOperationGetOperand(op, 0);
fprintf(stderr, "Updated operand: ");
mlirValuePrint(opOperand, printToStderr, NULL);
- // CHECK: Updated operand: {{.+}} constant 1 : index
+ // CHECK: Updated operand: {{.+}} {value = 1 : index}
mlirOperationDestroy(op);
mlirOperationDestroy(constZero);
// CHECK-LABEL: @testClone
MlirContext ctx = mlirContextCreate();
- mlirRegisterAllDialects(ctx);
- mlirContextGetOrLoadDialect(ctx, mlirStringRefCreateFromCString("std"));
MlirLocation loc = mlirLocationUnknownGet(ctx);
MlirType indexType = mlirIndexTypeGet(ctx);
MlirStringRef valueStringRef = mlirStringRefCreateFromCString("value");
mlirOperationPrint(constZero, printToStderr, NULL);
mlirOperationPrint(constOne, printToStderr, NULL);
- // CHECK: constant 0 : index
- // CHECK: constant 1 : index
+ // CHECK: %0 = "std.constant"() {value = 0 : index} : () -> index
+ // CHECK: %0 = "std.constant"() {value = 1 : index} : () -> index
return 0;
}