summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PrologEpilogInserter.h
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2009-10-07 17:12:56 +0000
committerJim Grosbach <grosbach@apple.com>2009-10-07 17:12:56 +0000
commitb58f498f7502e7e1833decbbbb4df771367c7341 (patch)
tree87f2fd132b2e82049b7648ad35e7c2c30b4ceeef /lib/CodeGen/PrologEpilogInserter.h
parent7f93f4d66c54e2628fbd159fa19bcfbe601458ae (diff)
downloadllvm-b58f498f7502e7e1833decbbbb4df771367c7341.tar.gz
llvm-b58f498f7502e7e1833decbbbb4df771367c7341.tar.bz2
llvm-b58f498f7502e7e1833decbbbb4df771367c7341.tar.xz
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
Diffstat (limited to 'lib/CodeGen/PrologEpilogInserter.h')
-rw-r--r--lib/CodeGen/PrologEpilogInserter.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/PrologEpilogInserter.h b/lib/CodeGen/PrologEpilogInserter.h
index d0a68e19a2..ee759e8622 100644
--- a/lib/CodeGen/PrologEpilogInserter.h
+++ b/lib/CodeGen/PrologEpilogInserter.h
@@ -27,6 +27,8 @@
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/ADT/SparseBitVector.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/IndexedMap.h"
+#include "llvm/Target/TargetRegisterInfo.h"
namespace llvm {
class RegScavenger;
@@ -93,6 +95,12 @@ namespace llvm {
// functions.
bool ShrinkWrapThisFunction;
+ // When using the scavenger post-pass to resolve frame reference
+ // materialization registers, maintain a map of the registers to
+ // the constant value and SP adjustment associated with it.
+ typedef std::pair<int, int> FrameConstantEntry;
+ IndexedMap<FrameConstantEntry, VirtReg2IndexFunctor> FrameConstantRegMap;
+
#ifndef NDEBUG
// Machine function handle.
MachineFunction* MF;