This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Separate the SelectionDAG importer from the emitter. NFC: alternative using Expected<>
ClosedPublic

Authored by ab on Feb 8 2017, 6:27 PM.

Details

Summary

This is an alternative to parts of D29709: instead of appending our new RuleMatcher to a vector, return it and the SkipReason as an Expected<RuleMatcher>.

It's a somewhat unconventional use of Error, but it's nicer than, say, std::pair because of the bool conversions.

Diff Detail

Repository
rL LLVM

Event Timeline

ab created this revision.Feb 8 2017, 6:27 PM
dsanders accepted this revision.Feb 9 2017, 2:39 AM

This will LGTM with the emitted separated from the importer like D29709 was.

I mentioned it on D29709 but just to mention it here. I'm not completely sure that runOnPattern() doesn't need to produce multiple rules for a single pattern at the moment but the original use case (commutativity) looks like it will be better handled in InstructionMatcher.

utils/TableGen/GlobalISelEmitter.cpp
409 ↗(On Diff #87746)

Would this make more sense as ImportError()?

548–550 ↗(On Diff #87746)

The main aim of D29709 was to separate the importer from the emitter so that there can be a sort inserted between them. As such, this needs to be in a separate loop that iterates over the whole rule-set.

This revision is now accepted and ready to land.Feb 9 2017, 2:39 AM
This revision was automatically updated to reflect the committed changes.
ab added inline comments.Feb 9 2017, 8:17 PM
utils/TableGen/GlobalISelEmitter.cpp
409 ↗(On Diff #87746)

Yeah, that's better. I went with failedImport to keep it a verb, let me know if you have a better idea!

548–550 ↗(On Diff #87746)

Let me get rid of this and let's do the more interesting stuff in D29709; do you want me to rebase it onto this?