Page MenuHomePhabricator

[mlir][llvm] Use tablegen for enum conversion.

Authored by gysit on Feb 2 2023, 7:40 AM.



The revision uses tablegen to convert multiple atomic and comparison
related enums automatically rather than using hand coded functions
in the import and export from and to LLVM IR.

The revision also adds additional binary operation cases to the
AtomicBinOp enum that have not been supported till now. It also
introduces the possibility to define unsupported enum cases that exist
only in LLVM IR and that are not imported into MLIR. These unsupported
cases are helpful to handle sentinel values such as BAD_BINOP that
LLVM commonly uses to terminate its enums.

Diff Detail

Event Timeline

gysit created this revision.Feb 2 2023, 7:40 AM
Herald added a project: Restricted Project. · View Herald Transcript
gysit requested review of this revision.Feb 2 2023, 7:40 AM
Dinistro accepted this revision.Feb 2 2023, 11:51 PM

I added one comment regarding naming but the rest LGTM! It's nice to see this conversion functions gone, especially as some of them did not cover everything.


"sentinels" might be misleading here. These are unsupported cases and do not necessarily correspond to sentinel values in the original LLVM enum. Change to something like unsupportedCases?

This revision is now accepted and ready to land.Feb 2 2023, 11:51 PM
gysit updated this revision to Diff 494589.Feb 3 2023, 4:39 AM
gysit marked an inline comment as done.
gysit edited the summary of this revision. (Show Details)

Address review comment.

This revision was automatically updated to reflect the committed changes.