[LLVMdev] How to assign a constant to a register?
eli.friedman at gmail.com
Tue Oct 19 02:40:37 CDT 2010
On Tue, Oct 19, 2010 at 12:19 AM, Arnaud Allard de Grandmaison
<Arnaud.AllardDeGrandMaison at dibcom.com> wrote:
>> But if the usage was in a loop it would be better (at the cost of
>> register pressure) to materialise 5 into a register outside of the
>> loop and use the register repeatedly in the loop.
> Bouncing on this subject: you can not know before isel is over if the constants have to materialize into registers or not, as this is really dependent on the target's instruction set. Do we have any pass hoisting the constant loading out of the (inner) loops after isel ? I guess this could be beneficial for most targets --- assuming the pass does not increase the register pressure to some unreasonnable level.
Yes; see lib/CodeGen/MachineLICM.cpp.
More information about the LLVMdev