On Tue, Sep 13, 2016 at 10:37 PM, Jeff Law <l...@redhat.com> wrote: > On 09/12/2016 12:57 PM, David Malcolm wrote: >> >> >> I'm not sure I follow - this sounds like a dedicated target for >> selftesting. > > That's exactly what it is. We'd essentially put in knobs so that we could > control the different things we need to. For example, if we wanted to test > a particular problem with promotions of arguments, we can do that. If we > wanted to test how we handled a secondary address reload to implemenet a > GP<->FP register copy through memory, we can control all the parameters for > that too. And so on. > > It's Bernd's idea and I think it has a lot of merit and I think it's largely > complementary to what you're doing.
Note that while the "snippets" may largely work (not sure how many you tried to come up with) I see the issue that a lot of RTL "unit tests" would need some trees set up, like to properly form MEM_EXPRs or REG_DECL or even SYMBOL_REFs. So I fear that the scope of unit-tests we can implement with the proposed scheme is very limited (you may also need other stuff setup, like alias analysis or parts of IRA or cost analysis parts). So I agree a separate testing backend is a good way to make unit-testing more stable on the target side we also need a way to provide input on some of the global state that is currently set up by frontends. But my biggest worry is with putting unit-tests into cc1 itself -- even more so with RTL unit tests of this kind than with all the other ones we have. We'll quickly have 99% of a source file comprised of RTL unit tests rather than source (and cc1 object size as well). Hardly something we want to have (not even mentioning bootstrap time issues). Yes, putting the unit-tests in source files makes us not require exporting an interface to the parts we are testing. But that's about the only advantage I can see. You didn't show that it isn't possible to put the small test you were writing into a RTL-frontendish test which starts compiling the function with the test with the pass you are about to unit-test. Richard. > jeff >