Resource in MemoryEffects

Hi all, is there any documentation other than comments in the code about the design of MemoryEffects? I’m curious specifically about Resource, which is a relatively generic name, and yields quite a lot of irrelevant results when searching in the codebase, and nothing when searching the web.

I’m working on representing register reads and writes as memory effects, to leverage generic transformations safely. It seems that leveraging Resource is the right approach, I just wanted to check that this is the case, and whether it would make sense to carry the specific register written to/from in the Resource subclass or not.

There isn’t much documentation, potentially in some old mailing list archives. You can create new resources rather easily llvm-project/mlir/include/mlir/Interfaces/SideEffectInterfaceBase.td at 52113cf14f8f8163d921e2ed7be9378be2b1a857 · llvm/llvm-project · GitHub but at this point I expect most of the code to assume there is only the default resource.

Separately, documenting and cleaning this up would be nice, in particular we have a whole SideEffect interface that doesn’t seem actively used upstream unless through MemoryEffects…