AMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies
authorTom Stellard <thomas.stellard@amd.com>
Tue, 6 Sep 2016 20:00:26 +0000 (20:00 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 6 Sep 2016 20:00:26 +0000 (20:00 +0000)
commit2add8a114054a7ae3acdea286d3b6542f3be8838
tree781d5adbba2e8d276ebef1119528ddafa5b8ca21
parent36103e868b8e1743aedcbc004ee211edbce720b1
AMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies

Summary:
I put this code here, because I want to re-use it in a few other places.
This supersedes some of the immediate folding code we have in SIFoldOperands.
I think the peephole optimizers is probably a better place for folding
immediates into copies, since it does some register coalescing in the same time.

This will also make it easier to transition SIFoldOperands into a smarter pass,
where it looks at all uses of instruction at once to determine the optimal way to
fold operands.  Right now, the pass just considers one operand at a time.

Reviewers: arsenm

Subscribers: wdng, nhaehnle, arsenm, llvm-commits, kzhuravl

Differential Revision: https://reviews.llvm.org/D23402

llvm-svn: 280744
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Target/AMDGPU/SOPInstructions.td