[Mlir-commits] [mlir] [mlir][ODS] Allow inferring operand types from multiple variables (PR #127517)
Markus Böck
llvmlistbot at llvm.org
Tue Feb 18 05:09:30 PST 2025
================
@@ -303,22 +303,33 @@ struct OperationFormat {
std::optional<int> getBuilderIdx() const { return builderIdx; }
void setBuilderIdx(int idx) { builderIdx = idx; }
+ int getNumArgs() const { return resolver.size(); }
+
/// Get the variable this type is resolved to, or nullptr.
- const NamedTypeConstraint *getVariable() const {
- return llvm::dyn_cast_if_present<const NamedTypeConstraint *>(resolver);
+ const NamedTypeConstraint *getVariable(int i) const {
+ return resolver.empty()
+ ? nullptr
+ : llvm::dyn_cast_if_present<const NamedTypeConstraint *>(
+ resolver[i]);
}
/// Get the attribute this type is resolved to, or nullptr.
- const NamedAttribute *getAttribute() const {
- return llvm::dyn_cast_if_present<const NamedAttribute *>(resolver);
+ const NamedAttribute *getAttribute(int i) const {
+ return resolver.empty()
+ ? nullptr
+ : llvm::dyn_cast_if_present<const NamedAttribute *>(
+ resolver[i]);
}
/// Get the transformer for the type of the variable, or std::nullopt.
std::optional<StringRef> getVarTransformer() const {
return variableTransformer;
}
- void setResolver(ConstArgument arg, std::optional<StringRef> transformer) {
+ void setResolver(const SmallVector<ConstArgument, 1> &arg,
+ std::optional<StringRef> transformer) {
resolver = arg;
----------------
zero9178 wrote:
```suggestion
void setResolver(SmallVector<ConstArgument, 1> arg,
std::optional<StringRef> transformer) {
resolver = std::move(arg);
```
ulta nit
https://github.com/llvm/llvm-project/pull/127517
More information about the Mlir-commits
mailing list