This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Move SymbolOpInterfaces "classof" check to a proper "extraClassOf" interface field
ClosedPublic

Authored by rriddle on Dec 16 2022, 2:42 AM.

Details

Summary

SymbolOpInterface overrides the base classof to provide support
for optionally implementing the interface. This is currently placed
in the extraClassDeclarations, but that is kind of awkard given that
it requires underlying knowledge of how the base classof is implemented.
This commit adds a proper "extraClassOf" field to allow interfaces to
implement this, which abstracts away the default classof logic.

Diff Detail

Event Timeline

rriddle created this revision.Dec 16 2022, 2:42 AM
rriddle requested review of this revision.Dec 16 2022, 2:42 AM
jpienaar added inline comments.Dec 16 2022, 11:07 AM
mlir/include/mlir/IR/OpBase.td
2052

This is not arbitrary logic, this requires to end in a return that reports whether a given op implements this interface.

Here we rely on -> for accessing the operation being checked and so need nothing else like $_op ? it may be good to document this. It feels partially weird/unsafe to say its an optional interface which you check if implemented by calling functions on that interface.

jpienaar accepted this revision.Dec 21 2022, 10:11 AM
This revision is now accepted and ready to land.Dec 21 2022, 10:11 AM
rriddle updated this revision to Diff 488758.Jan 12 2023, 1:37 PM
rriddle edited the summary of this revision. (Show Details)
rriddle marked an inline comment as done.