[LLVMdev] How to assign a constant to a register?

Arnaud Allard de Grandmaison Arnaud.AllardDeGrandMaison at dibcom.com
Tue Oct 19 00:55:29 PDT 2010


Thanks Eli,
I now have to understand why it does not seem to be running in my case :)
--
Arnaud de Grandmaison


-----Original Message-----
From: Eli Friedman [mailto:eli.friedman at gmail.com]
Sent: Tuesday, October 19, 2010 9:41 AM
To: Arnaud Allard de Grandmaison
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] How to assign a constant to a register?

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.

-Eli




More information about the llvm-dev mailing list