This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] ODS typedef gen fixes & improvements
ClosedPublic

Authored by jdd on Nov 22 2020, 3:29 PM.

Details

Summary
  • Fixes bug 48242 point 3 crash.
  • Makes the improvments from points 1 & 2.

https://bugs.llvm.org/show_bug.cgi?id=48262

def RTLValueType : Type<CPred<"isRTLValueType($_self)">, "Type"> {
  string cppType = "::mlir::Type";
}

Works now, but merely by happenstance. Parameters expects a TypeParameter class def or a string representing a c++ type but doesn't enforce it.

Diff Detail

Event Timeline

jdd created this revision.Nov 22 2020, 3:29 PM
jdd requested review of this revision.Nov 22 2020, 3:29 PM
jdd edited the summary of this revision. (Show Details)Nov 22 2020, 3:30 PM
jdd added reviewers: lattner, rriddle.
jdd edited the summary of this revision. (Show Details)
jdd edited the summary of this revision. (Show Details)Nov 22 2020, 3:34 PM
lattner accepted this revision.Nov 22 2020, 3:38 PM

Nice, thanks! Does this add a verifier style check that makes sure that inner type is an RTLValueType, or is that still the responsibility of the custom parser logic?

This revision is now accepted and ready to land.Nov 22 2020, 3:38 PM
jdd added a comment.Nov 22 2020, 3:57 PM

Nice, thanks! Does this add a verifier style check that makes sure that inner type is an RTLValueType, or is that still the responsibility of the custom parser logic?

Not sure I fully understand your question, but the generated code doesn't do _any_ type checking. It relies on the C++ types in the storage class and C++ static type checking. Your example works entirely by happenstance, which I've updated this patch's description to explain.

Ah right, I suppose this will matter if/when the ODS support for custom types also provides a declarative way to specify asm printing/parsing.

This revision was automatically updated to reflect the committed changes.