As of this patch, 350 out of 3938 rules are currently imported.
Depends on D32229
Differential D32275
[globalisel][tablegen] Add several GINodeEquiv's for operators that do not require additional support. dsanders on Apr 20 2017, 12:42 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions One thing to mention for this patch is that G_ICMP and G_FCMP are not included due to a difference in operand order between G_ICMP/G_FCMP in GlobalISel and setcc in SelectionDAG (predicate, lhs, rhs vs lhs, rhs, predicate). I can support those in a later patch by adding more information to GINodeEquiv or by changing G_ICMP/G_FCMP. I don't see a particularly strong argument either way on that point but I'm expecting to need to convert the predicate operand too so I'm leaning towards making GINodeEquiv more descriptive. Does anyone else have a preference?
Comment Actions LGTM Eh, I mildly prefer changing G_ICMP, to avoid making tablegen even more complicated. But that's not the main issue ...
... because the predicates are different, right? In general, setcc/br_cc and friends are IMO at the limit of what we should support in the importer, but I suppose it could be worth it if it's not too involved. I'm *terrified* by the lack of testing: we have no idea what changes and what's covered. But that's true for all tablegen changes, and I'm even more worried about sdag pattern changes affecting gisel. Comment Actions Thanks.
That's right. LLVM-IR uses CmpInst::Predicate and SelectionDAG uses ISD::CondCode. MIR may differ from both or may use something else like opcodes. On the br_cc side of things, there's also an operator mismatch between GlobalISel and SelectionDAG on some targets caused by the lowering of BRCOND+SETCC to BR_CC. The rules are still importable but tablegen would have to undo the lowering and it's probably not worth it.
We could potentially diff code coverage reports to find out which parts of the C++ implementation are ignored because of new tablegenerated rules.
It would be fairly easy to add a way to disable the importer for some patterns. Eventually, I'd expect to dump the imported rules in whatever format GlobalISel defines its rules and use that as the input with the importer disabled.
This is on my todo list. I had some experimental patches a while back but they'll need a lot of work.
I'm not sure I understand this bit. Is the intent to prompt us to look at the new rules? Comment Actions Yeah, otherwise I'm guessing the generated tests stop covering everything as soon as something else is added, unless we automate it somehow. (so the main actionable thing would really be "generate tests for the new stuff") Comment Actions I decided to have a look at code coverage differences before committing this. This patch made no difference to the code coverage. On closer inspection it turns out beginFunction() isn't being executed so no rules with rule predicates can match. I'll take a look at this, maybe something from the rule-predicates patch didn't make it into the final commit. A few other notable things in the coverage information:
Comment Actions I literally just ran into this while trying to enable TableGen for ARM. I'm wondering if it's really a good idea to have beginFunction in the first place. There's a related FIXME in TargetSubtargetInfo.h around getInstructionSelector. Maybe we should have an instruction selector per MachineFunction?
Comment Actions I'm having another go at that approach at the moment. Last time I had some trouble with it using the wrong instruction selector during instruction selection but hopefully I'll figure that one out this time. The tricky predicate is NotWin64WithoutFP from X86 which needs access to the MachineFunction that getSubtargetImpl() doesn't have. |
It turns out these two lines aren't entirely true. In AArch64 they're used as operators in some contexts and operands in others. I'll drop these lines.