Hi Richard, > Yeah, I'm not disagreeing with any of that. It's just a question of > whether the problem should be fixed by artificially lowering the general > rtx costs with one particular user (RA spill costs) in mind, or whether > it should be fixed by making the RA spill code take the factors above > into account.
The RA spill code already works fine on immediates but not on address constants. And the reason is that the current rtx costs for addresses are set artificially high without justification (I checked the patch that increased the costs but there was nothing explaining why it was beneficial). It's certainly possible to experiment with increasing the spill costs, but that won't improve the issue with address constants unless they are at least doubled. And it has the effect of halving all rtx costs in the register allocator which is likely to cause regressions. So we'd need to adjust many rtx costs to keep the allocator working, plus fix any further regressions this causes. Cheers, Wilco