On 07/19/2011 03:24 PM, Joern Rennecke wrote: >> Andrew Pinski points out that the feature could probably be >> equivalently implemented via outlining and function calls >> (I assume well back at the gimple level). > > Function calls would mean that you'd have to deal with > call-clobbered registers - any working size set savings from outlining > could easily be drowned by worsening register allocation or insertion of > caller-save instructions. And you can't easily set multiple values in > specific registers and stack slots. Unless you want to add fancy custom > ABIs for the outlined functions. > And then there is the issue that function tend to have a single > return address. You might have a complex piece of error handling code > that makes a decision where it comes back into the hot code. With a > function, you would need yet another return value, and then a tablejump > depending on that value.
All true. Although I'll note that while doing profiledbootstrap with partitioning enabled, a very large fraction of what gets pushed to the cold section seems to be noreturn paths that lead to abort. > I suppose the basic problem is that these jumps are so easily > mistaken for ordinary jump_insns. If they were more obviously > different, like a tablejmp, we'd leave them alone by default. We > don't do jump threading through non-simplified tablejumps, either. > What would you think about putting the destination section in the > instruction pattern? Having some obviously distinguishable mechanism might be an interesting solution. > Of course, changing the rtl representation doesn't fix the problems with > passes like cfglayout. Yeah, I'm not sure what to do with cfglayout. We definitely do not want it considering insns from both segments at the same time. I wonder how well we'd get away with marking crossing edges as abnormal? Or something else that automatically prevents anyone from trying to split such an edge. r~