[Mlir-commits] [mlir] [emitC]Pass in `mlir-opt` to wrap a func in class (PR #141158)
Jaden Angella
llvmlistbot at llvm.org
Mon Jun 23 09:58:24 PDT 2025
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jaddyen <ajaden at google.com>,Jaddyen
<ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaddyen
<ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaddyen <ajaden at google.com>,
Valentin Clement =?utf-8?b?KOODkOODrOODsw=?=,Jaddyen <ajaden at google.com>,Jaddyen
<ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaddyen <ajaden at google.com>,Jaden
Angella <141196890+Jaddyen at users.noreply.github.com>,Jaden Angella
<141196890+Jaddyen at users.noreply.github.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/141158 at github.com>
================
@@ -1400,6 +1400,77 @@ void FileOp::build(OpBuilder &builder, OperationState &state, StringRef id) {
builder.getNamedAttr("id", builder.getStringAttr(id)));
}
+//===----------------------------------------------------------------------===//
+// FieldOp
+//===----------------------------------------------------------------------===//
+LogicalResult FieldOp::verify() {
+ if (!isSupportedEmitCType(getType())) {
+ return emitOpError("expected valid emitc type");
+ }
+
+ if (!getInitialValue()) {
+ return success();
+ }
+
+ Attribute initValue = *getInitialValue();
+ // Check that the type of the initial value is compatible with the type of
+ // the global variable.
+ if (ElementsAttr elementsAttr = llvm::dyn_cast<ElementsAttr>(initValue)) {
+ Type initialValueType = elementsAttr.getType();
+ if (!initialValueType) {
----------------
Jaddyen wrote:
Yes, I got rid of this part when I changed the FieldOp to only have attributes and no initialvalue. We no longer check for this.
https://github.com/llvm/llvm-project/pull/141158
More information about the Mlir-commits
mailing list