[Mlir-commits] [mlir] [mlir][IR] Add `getPropertyFromAttr` and `setPropertyFromAttr` methods. (PR #150060)

Mehdi Amini llvmlistbot at llvm.org
Thu Jul 24 03:50:50 PDT 2025


joker-eph wrote:

> However, even in the absence of those custom bindings it's possible to create attributes in python or C by parsing a string. Something, that's not possible with properties as they there's no generic parsePropertyFromString.

So: properties don't have a mnemnonic and registration for their parsing logic, but in general they can be parsed/printed if you know the class you want to parse/print I think.
Look at the `let parser` and `let printer` in the property class in ODS.

> To answer more explicitly, in my view props are a C++ storage detail of the IR element Operation, whereas an attribute is an IR element itself. As such, prop storage doesn't have a well defined meaning outside C++, unlike an Attr, Op or Type that do have a meaning. 

What is the meaning of an Attribute?
That is for example what difference to you make between EnumProp and EnumAttr?

https://github.com/llvm/llvm-project/pull/150060


More information about the Mlir-commits mailing list