summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/RegisterScavenging.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-27 21:09:48 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-27 21:09:48 +0000
commitbb6fb3357d6c1e9ffb15de4893e59e3bbdd600a3 (patch)
tree0d807a8baa9e3495fe83196f883616dbe16af9d8 /include/llvm/CodeGen/RegisterScavenging.h
parent171eed533408a23de0b141af17475fd6b4da72e0 (diff)
downloadllvm-bb6fb3357d6c1e9ffb15de4893e59e3bbdd600a3.tar.gz
llvm-bb6fb3357d6c1e9ffb15de4893e59e3bbdd600a3.tar.bz2
llvm-bb6fb3357d6c1e9ffb15de4893e59e3bbdd600a3.tar.xz
RegScavenger interface change to make it more flexible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34690 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/RegisterScavenging.h')
-rw-r--r--include/llvm/CodeGen/RegisterScavenging.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/include/llvm/CodeGen/RegisterScavenging.h b/include/llvm/CodeGen/RegisterScavenging.h
index 33d00a7443..65fdaea104 100644
--- a/include/llvm/CodeGen/RegisterScavenging.h
+++ b/include/llvm/CodeGen/RegisterScavenging.h
@@ -27,16 +27,34 @@ class TargetRegisterClass;
class RegScavenger {
MachineBasicBlock *MBB;
MachineBasicBlock::iterator MBBI;
- bool MBBIInited;
unsigned NumPhysRegs;
+ /// Initialized - All states are initialized and ready to go!
+ bool Initialized;
+
/// RegStates - The current state of all the physical registers immediately
/// before MBBI. One bit per physical register. If bit is set that means it's
/// available, unset means the register is currently being used.
BitVector RegStates;
public:
- RegScavenger(MachineBasicBlock *mbb);
+ RegScavenger()
+ : MBB(NULL), Initialized(false) {};
+
+ RegScavenger(MachineBasicBlock *mbb)
+ : MBB(mbb), Initialized(false) {};
+
+ /// Init - Initialize the states.
+ ///
+ void init();
+
+ /// Reset - Discard previous states and re-initialize the states given for
+ /// the specific basic block.
+ void reset(MachineBasicBlock *mbb) {
+ MBB = mbb;
+ clear();
+ init();
+ }
/// forward / backward - Move the internal MBB iterator and update register
/// states.
@@ -45,8 +63,12 @@ public:
/// forward / backward - Move the internal MBB iterator and update register
/// states until it has reached but not processed the specific iterator.
- void forward(MachineBasicBlock::iterator I);
- void backward(MachineBasicBlock::iterator I);
+ void forward(MachineBasicBlock::iterator I) {
+ while (MBBI != I) forward();
+ }
+ void backward(MachineBasicBlock::iterator I) {
+ while (MBBI != I) backward();
+ }
/// isReserved - Returns true if a register is reserved. It is never "unused".
bool isReserved(unsigned Reg) const { return ReservedRegs[Reg]; }
@@ -69,10 +91,16 @@ public:
bool ExCalleeSaved = false) const;
private:
+ /// clear - Clear states.
+ ///
+ void clear();
+
/// CalleeSavedrRegs - A bitvector of callee saved registers for the target.
+ ///
BitVector CalleeSavedRegs;
/// ReservedRegs - A bitvector of reserved registers.
+ ///
BitVector ReservedRegs;
};