summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-23 15:50:03 +0000
committerChris Lattner <sabre@nondot.org>2002-05-23 15:50:03 +0000
commit85c5465e072b3bbebb1f5e112fb2db46f7fba148 (patch)
tree180e26923207d78d82621158e9f5476d9554008d /include/llvm
parent195755ced7b7fb8b941e5d085fe5bd82f36f481e (diff)
downloadllvm-85c5465e072b3bbebb1f5e112fb2db46f7fba148.tar.gz
llvm-85c5465e072b3bbebb1f5e112fb2db46f7fba148.tar.bz2
llvm-85c5465e072b3bbebb1f5e112fb2db46f7fba148.tar.xz
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
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/CodeGen/RegClass.h19
-rw-r--r--include/llvm/Target/TargetRegInfo.h3
2 files changed, 11 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/RegClass.h b/include/llvm/CodeGen/RegClass.h
index c93d6961e0..4584a5f7a1 100644
--- a/include/llvm/CodeGen/RegClass.h
+++ b/include/llvm/CodeGen/RegClass.h
@@ -42,16 +42,17 @@ class RegClass {
// buildInterferenceGraph
std::stack<IGNode *> IGNodeStack; // the stack used for coloring
- const ReservedColorListType *const ReservedColorList;
+ // ReservedColorList - for passing registers that are pre-allocated and cannot
+ // be used by the register allocator for this function.
//
- // for passing registers that are pre-allocated and cannot be used by the
- // register allocator for this function.
+ const ReservedColorListType *const ReservedColorList;
- 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 @@ class RegClass {
const MachineRegClassInfo *MRC,
const ReservedColorListType *RCL = 0);
- ~RegClass() { delete[] IsColorUsedArr; }
-
inline void createInterferenceGraph() { IG.createGraph(); }
inline InterferenceGraph &getIG() { return IG; }
@@ -106,7 +105,7 @@ class RegClass {
{ IG.mergeIGNodesOfLRs(LR1, LR2); }
- inline bool * getIsColorUsedArr() { return IsColorUsedArr; }
+ inline std::vector<bool> &getIsColorUsedArr() { return IsColorUsedArr; }
inline void printIGNodeList() const {
diff --git a/include/llvm/Target/TargetRegInfo.h b/include/llvm/Target/TargetRegInfo.h
index 1067a9a18d..99a89feb2e 100644
--- a/include/llvm/Target/TargetRegInfo.h
+++ b/include/llvm/Target/TargetRegInfo.h
@@ -51,7 +51,8 @@ public:
// This method should find a color which is not used by neighbors
// (i.e., a false position in IsColorUsedArr) and
- virtual void colorIGNode(IGNode *Node, bool IsColorUsedArr[]) const = 0;
+ virtual void colorIGNode(IGNode *Node,
+ std::vector<bool> &IsColorUsedArr) const = 0;
virtual bool isRegVolatile(int Reg) const = 0;
MachineRegClassInfo(unsigned ID, unsigned NVR, unsigned NAR)