Convert RegClass::IsColorUsedArr from a dynamically allocated array to
a vector. This makes asserting on array bounds easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2731 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/RegAlloc/RegClass.h b/lib/CodeGen/RegAlloc/RegClass.h
index c93d696..4584a5f 100644
--- a/lib/CodeGen/RegAlloc/RegClass.h
+++ b/lib/CodeGen/RegAlloc/RegClass.h
@@ -42,16 +42,17 @@
// buildInterferenceGraph
std::stack<IGNode *> IGNodeStack; // the stack used for coloring
+ // ReservedColorList - for passing registers that are pre-allocated and cannot
+ // be used by the register allocator for this function.
+ //
const ReservedColorListType *const ReservedColorList;
- //
- // for passing registers that are pre-allocated and cannot be used by the
- // register allocator for this function.
- bool *IsColorUsedArr;
+ // IsColorUsedArr - An array used for coloring each node. This array must be
+ // of size MRC->getNumOfAllRegs(). Allocated once in the constructor for
+ // efficiency.
//
- // An array used for coloring each node. This array must be of size
- // MRC->getNumOfAllRegs(). Allocated once in the constructor
- // for efficiency.
+ std::vector<bool> IsColorUsedArr;
+
//--------------------------- private methods ------------------------------
@@ -71,8 +72,6 @@
const MachineRegClassInfo *MRC,
const ReservedColorListType *RCL = 0);
- ~RegClass() { delete[] IsColorUsedArr; }
-
inline void createInterferenceGraph() { IG.createGraph(); }
inline InterferenceGraph &getIG() { return IG; }
@@ -106,7 +105,7 @@
{ IG.mergeIGNodesOfLRs(LR1, LR2); }
- inline bool * getIsColorUsedArr() { return IsColorUsedArr; }
+ inline std::vector<bool> &getIsColorUsedArr() { return IsColorUsedArr; }
inline void printIGNodeList() const {