[llvm-commits] CVS: llvm/lib/CodeGen/VirtRegMap.cpp

Evan Cheng evan.cheng at apple.com
Tue Feb 20 18:22:19 PST 2007



Changes in directory llvm/lib/CodeGen:

VirtRegMap.cpp updated: 1.96 -> 1.97
---
Log message:

Use BitVector instead. No functionality change.

---
Diffs of the changes:  (+5 -8)

 VirtRegMap.cpp |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/VirtRegMap.cpp
diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.96 llvm/lib/CodeGen/VirtRegMap.cpp:1.97
--- llvm/lib/CodeGen/VirtRegMap.cpp:1.96	Mon Feb 19 19:29:10 2007
+++ llvm/lib/CodeGen/VirtRegMap.cpp	Tue Feb 20 20:22:03 2007
@@ -27,6 +27,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallSet.h"
@@ -423,14 +424,10 @@
   class VISIBILITY_HIDDEN ReuseInfo {
     MachineInstr &MI;
     std::vector<ReusedOp> Reuses;
-    bool *PhysRegsClobbered;
+    BitVector PhysRegsClobbered;
   public:
     ReuseInfo(MachineInstr &mi, const MRegisterInfo *mri) : MI(mi) {
-      PhysRegsClobbered = new bool[mri->getNumRegs()];
-      std::fill(PhysRegsClobbered, PhysRegsClobbered+mri->getNumRegs(), false);
-    }
-    ~ReuseInfo() {
-      delete[] PhysRegsClobbered;
+      PhysRegsClobbered.resize(mri->getNumRegs());
     }
     
     bool hasReuses() const {
@@ -452,11 +449,11 @@
     }
 
     void markClobbered(unsigned PhysReg) {
-      PhysRegsClobbered[PhysReg] = true;
+      PhysRegsClobbered.set(PhysReg);
     }
 
     bool isClobbered(unsigned PhysReg) const {
-      return PhysRegsClobbered[PhysReg];
+      return PhysRegsClobbered.test(PhysReg);
     }
     
     /// GetRegForReload - We are about to emit a reload into PhysReg.  If there






More information about the llvm-commits mailing list