[LLVMdev] How to assign a constant to a register?
Duncan Sands
baldrick at free.fr
Mon Oct 18 05:51:30 PDT 2010
Hi Alasdair,
> But the cost of doing that might be greater than the costs
> of keeping it in a register. Suppose the code was ORing a value
> with 5 and the target only had OR-register and not OR-immediate.
> You would expect local code generation to handle OR-immediate by
> locally materialising the constant into a spare register.
> 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.
it is up to the code generators to take care of this kind of thing.
I don't see how having (at the IR level) a register called %x which
contains the value 5 makes it easier for the code generators to perform
this optimization than if you directly use 5 everywhere %x would occur.
Ciao,
Duncan.
More information about the llvm-dev
mailing list