------- Comment #3 from rsandifo at gcc dot gnu dot org 2010-06-05 07:27 ------- Kenny, I too don't like target_reinit, and FWIW I fought the same battle before the patch was submitted. The argument then, and I suspect the argument now, is that although the function is horribly inefficient, it still performs a useful function. The best way of making it efficient (the argument goes) is to gradually wean GCC off using global variables for target-specific stuff. And as that happens, target_reinit would get quicker for all targets.
As I remember it, even those supporting target_reinit didn't really _like_ the thing, but simply accepted it as the best we could do without major restructuring. As far as the IRA thing goes: as we talked about elsewhere, that's simply a bug. target_reinit should call ira_init. (Remember that target_reinit predates IRA, so this certainly isn't the fault of anyone on the "target_reinit side". It's just one of those things that happens, and needs to be fixed when the problem shows up.) What you're doing is probably fine for your port, but other targets (like MIPS for the MIPS16 switch) need to do more than modify registers. Things like rtx costs change too, and those costs are cached in various global variables. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40419