But don't actually inspect the tree any deeper than we already do. This
change is NFC but the next one will enable full traversal of the
source/destination patterns.
Depends on D30535
Paths
| Differential D30536
[tablegen][globalisel] Convert the SelectionDAG importer to a tree walking approach. NFC ClosedPublic Authored by dsanders on Mar 2 2017, 7:31 AM.
Details Summary But don't actually inspect the tree any deeper than we already do. This Depends on D30535
Diff Detail
Event Timelinedsanders added a child revision: D30539: [tablegen][globalisel] Add support for nested instruction matching..Mar 2 2017, 9:25 AM Comment Actions This generally seems sensible, but if feasible it might be a good idea to replace the 'Expected<bool>' with 'Error'.
Closed by commit rL299001: [tablegen][globalisel] Convert the SelectionDAG importer to a tree walking… (authored by dsanders). · Explain WhyMar 29 2017, 8:49 AM This revision was automatically updated to reflect the committed changes. Comment Actions
It returns Error::success(). The name is somewhat awkward, but think of it as a replacement for the old-style 'int' return values, or c++ std::error_code. There are a few examples in http://llvm.org/docs/ProgrammersManual.html#recoverable-errors. Comment Actions
Hmm, I'm not keen returning an Error that represents success or using multiple error handling strategies for one family of functions. That said, the former is an established idiom and I suppose I could deal with the latter by renaming to createAndImport*() for the ones that return an Expected<X> and keeping import*() for the ones that return Error. I'll commit a follow-up tomorrow to make that change.
Revision Contents
Diff 93238 utils/TableGen/GlobalISelEmitter.cpp
|
Here and elsewhere: is it possible to fold the call into the if? Something like:
That also lets you avoid the not-very-descriptive 'TrueOrError'.
More generally, an 'Expected<bool>' that's always true seems odd. If you don't have plans to add more information, maybe just return an Error? Then the whole takeError vs weird-name problem goes away.