This is an archive of the discontinued LLVM Phabricator instance.

[mlir][OpFormatGen] Add support for specifiy "custom" directives.
ClosedPublic

Authored by rriddle on Jul 27 2020, 6:57 PM.

Details

Summary

This revision adds support for custom directives to the declarative assembly format. This allows for users to use C++ for printing and parsing subsections of an otherwise declaratively specified format. The custom directive is structured as follows:

custom-directive ::= `custom` `<` UserDirective `>` `(` Params `)`

UserDirective is used as a suffix when this directive is used during printing and parsing. When parsing, parseUserDirective will be invoked. When printing, printUserDirective will be invoked. The first parameter to these methods must be a reference to either the OpAsmParser, or OpAsmPrinter. The type of rest of the parameters is dependent on the Params specified in the assembly format.

Diff Detail

Event Timeline

rriddle created this revision.Jul 27 2020, 6:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 27 2020, 6:57 PM
rriddle edited the summary of this revision. (Show Details)Jul 27 2020, 7:06 PM

Just saw this in the weekly newsletter - this is really really really cool, nice work!

jpienaar accepted this revision.Aug 27 2020, 8:11 PM

Thanks!

This revision is now accepted and ready to land.Aug 27 2020, 8:11 PM
mehdi_amini accepted this revision.Aug 27 2020, 9:39 PM

Neat!

mlir/docs/OpDefinitions.md
781

?

793

Should this be folded in the previous bullet?

rriddle updated this revision to Diff 288721.Aug 28 2020, 3:48 PM
rriddle marked 2 inline comments as done.

Address comments

This revision was landed with ongoing or failed builds.Aug 31 2020, 1:27 PM
This revision was automatically updated to reflect the committed changes.