ValueOrAttr is more generally informative: this type is useful beyond folding.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/IR/OpDefinition.h | ||
---|---|---|
218 | Please update the documentation. I would also consider moving this into a separate file. I suppose we don't want Attribute.h to depend on Value.h or vice versa, neither do we want to include OpDefinition.h in files that are not defining ops but just want to use this utility. |
mlir/include/mlir/IR/OpDefinition.h | ||
---|---|---|
218 | Is the plan here that this is just a dumb union, or that it carries semantics: either a Value or an attr that needs to be materialized with an appropriate constant materialization hook (from which dialect??) into a Value. |
I don't know about changing the name just because the elements the type has makes it useful in other context. In this case the name is quite descriptive for me: these are potential results from folding. E.g., IntPair vs SliceStartAndEnd, both could be a std::pair of ints, but I wouldn't rename the latter to the former to enable reuse with, say, LineAndColPair.
Please update the documentation.
I would also consider moving this into a separate file. I suppose we don't want Attribute.h to depend on Value.h or vice versa, neither do we want to include OpDefinition.h in files that are not defining ops but just want to use this utility.