CodeGen: switch raw array to std::vector
authorDylan Noblesmith <nobled@dreamwidth.org>
Mon, 25 Aug 2014 00:28:31 +0000 (00:28 +0000)
committerDylan Noblesmith <nobled@dreamwidth.org>
Mon, 25 Aug 2014 00:28:31 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216355 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineRegisterInfo.h
lib/CodeGen/MachineRegisterInfo.cpp

index 356e882cdd0f578467a81ae9148afd36d4116957..2e7f034be6b02f4feec82b80efdeabb7e3fa8b62 100644 (file)
@@ -70,7 +70,7 @@ private:
 
   /// PhysRegUseDefLists - This is an array of the head of the use/def list for
   /// physical registers.
-  MachineOperand **PhysRegUseDefLists;
+  std::vector<MachineOperand *> PhysRegUseDefLists;
 
   /// getRegUseDefListHead - Return the head pointer for the register use/def
   /// list for the specified virtual or physical register.
@@ -124,7 +124,6 @@ private:
   void operator=(const MachineRegisterInfo&) LLVM_DELETED_FUNCTION;
 public:
   explicit MachineRegisterInfo(const MachineFunction *MF);
-  ~MachineRegisterInfo();
 
   const TargetRegisterInfo *getTargetRegisterInfo() const {
     return MF->getSubtarget().getRegisterInfo();
index 1b95b40b6b250e011fbb25f8a795f7e4f1d66a51..e9612f3cfde0866f94f57ccc9df1fe795e27fafe 100644 (file)
@@ -31,14 +31,7 @@ MachineRegisterInfo::MachineRegisterInfo(const MachineFunction *MF)
   UsedPhysRegMask.resize(getTargetRegisterInfo()->getNumRegs());
 
   // Create the physreg use/def lists.
-  PhysRegUseDefLists =
-    new MachineOperand*[getTargetRegisterInfo()->getNumRegs()];
-  memset(PhysRegUseDefLists, 0,
-         sizeof(MachineOperand*)*getTargetRegisterInfo()->getNumRegs());
-}
-
-MachineRegisterInfo::~MachineRegisterInfo() {
-  delete [] PhysRegUseDefLists;
+  PhysRegUseDefLists.resize(getTargetRegisterInfo()->getNumRegs(), nullptr);
 }
 
 /// setRegClass - Set the register class of the specified virtual register.