[RFC] [TargetTransformInfo] Introduce hook to tell middle-end to not worry about register pressure

Hi all,

Currently in the llvm middle-end, we disable some optimizations because we worry about the register pressure, (e.g. GVNHoist and ArgumentPromotion).

However, in the architecture that are register-rich, e.g. FPGAs, we do not need to worry about the register pressure at all. For these architecures, we may want to optimization the LLVM IR without worrying about the register pressure.

I suggest that we introduce a hook in the TargetTransformInfo to tell if the current target architecture is register-rich or not. With this hook, we can enable the optimizations that increase register pressure in case the current architecture is register-rich.

One problem for introducing this hook: we are not able to test it (in the public buildbot) without an register-rich target architecture in LLVM trunk, and unfortunately, we do not have one today.

To address this problem, I propose to add a command line option to enable the register-rich mode such that we can test the corresponding code path as well.

I put a patch here: https://reviews.llvm.org/D42191

Feel free to add yourselves as reviewer/subscriber if you are interested.

Thanks
Hongbin