Add register-reuse to frame-index register scavenging. When a target uses
authorJim Grosbach <grosbach@apple.com>
Wed, 7 Oct 2009 17:12:56 +0000 (17:12 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 7 Oct 2009 17:12:56 +0000 (17:12 +0000)
commitb58f498f7502e7e1833decbbbb4df771367c7341
tree87f2fd132b2e82049b7648ad35e7c2c30b4ceeef
parent7f93f4d66c54e2628fbd159fa19bcfbe601458ae
Add register-reuse to frame-index register scavenging. When a target uses
a virtual register to eliminate a frame index, it can return that register
and the constant stored there to PEI to track. When scavenging to allocate
for those registers, PEI then tracks the last-used register and value, and
if it is still available and matches the value for the next index, reuses
the existing value rather and removes the re-materialization instructions.
Fancier tracking and adjustment of scavenger allocations to keep more
values live for longer is possible, but not yet implemented and would likely
be better done via a different, less special-purpose, approach to the
problem.

eliminateFrameIndex() is modified so the target implementations can return
the registers they wish to be tracked for reuse.

ARM Thumb1 implements and utilizes the new mechanism. All other targets are
simply modified to adjust for the changed eliminateFrameIndex() prototype.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83467 91177308-0d34-0410-b5e6-96231b3b80d8
31 files changed:
include/llvm/CodeGen/RegisterScavenging.h
include/llvm/Target/TargetRegisterInfo.h
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/PrologEpilogInserter.h
lib/CodeGen/RegisterScavenging.cpp
lib/Target/ARM/ARMBaseRegisterInfo.cpp
lib/Target/ARM/ARMBaseRegisterInfo.h
lib/Target/ARM/Thumb1RegisterInfo.cpp
lib/Target/ARM/Thumb1RegisterInfo.h
lib/Target/Alpha/AlphaRegisterInfo.cpp
lib/Target/Alpha/AlphaRegisterInfo.h
lib/Target/Blackfin/BlackfinRegisterInfo.cpp
lib/Target/Blackfin/BlackfinRegisterInfo.h
lib/Target/CellSPU/SPURegisterInfo.cpp
lib/Target/CellSPU/SPURegisterInfo.h
lib/Target/MSP430/MSP430RegisterInfo.cpp
lib/Target/MSP430/MSP430RegisterInfo.h
lib/Target/Mips/MipsRegisterInfo.cpp
lib/Target/Mips/MipsRegisterInfo.h
lib/Target/PIC16/PIC16RegisterInfo.cpp
lib/Target/PIC16/PIC16RegisterInfo.h
lib/Target/PowerPC/PPCRegisterInfo.cpp
lib/Target/PowerPC/PPCRegisterInfo.h
lib/Target/Sparc/SparcRegisterInfo.cpp
lib/Target/Sparc/SparcRegisterInfo.h
lib/Target/SystemZ/SystemZRegisterInfo.cpp
lib/Target/SystemZ/SystemZRegisterInfo.h
lib/Target/X86/X86RegisterInfo.cpp
lib/Target/X86/X86RegisterInfo.h
lib/Target/XCore/XCoreRegisterInfo.cpp
lib/Target/XCore/XCoreRegisterInfo.h