Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 1 | #include "SparcRegClassInfo.h" |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 2 | #include "llvm/CodeGen/IGNode.h" |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 3 | #include "llvm/Target/Sparc.h" |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 4 | #include <iostream> |
| 5 | using std::cerr; |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 6 | |
| 7 | //----------------------------------------------------------------------------- |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 8 | // Int Register Class - method for coloring a node in the interference graph. |
| 9 | // |
| 10 | // Algorithm: |
| 11 | // Record the colors/suggested colors of all neighbors. |
| 12 | // |
| 13 | // If there is a suggested color, try to allocate it |
| 14 | // If there is no call interf, try to allocate volatile, then non volatile |
| 15 | // If there is call interf, try to allocate non-volatile. If that fails |
| 16 | // try to allocate a volatile and insert save across calls |
| 17 | // If both above fail, spill. |
| 18 | // |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 19 | //----------------------------------------------------------------------------- |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 20 | void SparcIntRegClass::colorIGNode(IGNode * Node, bool IsColorUsedArr[]) const { |
| 21 | LiveRange *LR = Node->getParentLR(); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 22 | unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors |
| 23 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 24 | for (unsigned n=0; n < NumNeighbors; n++) { // for each neigh |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 25 | IGNode *NeighIGNode = Node->getAdjIGNode(n); |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 26 | LiveRange *NeighLR = NeighIGNode->getParentLR(); |
| 27 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 28 | if(NeighLR->hasColor()) // if has a color |
| 29 | IsColorUsedArr[NeighLR->getColor()] = true; // record that color |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 30 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 31 | else if (NeighLR->hasSuggestedColor()) { |
Ruchira Sasanka | b49865f | 2001-10-19 21:41:16 +0000 | [diff] [blame] | 32 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 33 | // if the neighbout can use the suggested color |
| 34 | if(NeighLR->isSuggestedColorUsable()) |
| 35 | IsColorUsedArr[NeighLR->getSuggestedColor()] = true; |
Ruchira Sasanka | b49865f | 2001-10-19 21:41:16 +0000 | [diff] [blame] | 36 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 39 | if( DEBUG_RA ) { |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 40 | cerr << "\nColoring LR [CallInt=" << LR->isCallInterference() <<"]:"; |
Chris Lattner | 296b773 | 2002-02-05 02:52:05 +0000 | [diff] [blame^] | 41 | printSet(*LR); |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 42 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 43 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 44 | if( LR->hasSuggestedColor() ) { |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 45 | |
| 46 | unsigned SugCol = LR->getSuggestedColor(); |
| 47 | |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 48 | if( ! IsColorUsedArr[ SugCol ] ) { |
| 49 | |
Ruchira Sasanka | b49865f | 2001-10-19 21:41:16 +0000 | [diff] [blame] | 50 | if( LR->isSuggestedColorUsable() ) { |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 51 | |
| 52 | // if the suggested color is volatile, we should use it only if |
| 53 | // there are no call interferences. Otherwise, it will get spilled. |
| 54 | |
| 55 | if (DEBUG_RA) |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 56 | cerr << "\n -Coloring with sug color: " << SugCol; |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 57 | |
| 58 | LR->setColor( LR->getSuggestedColor() ); |
| 59 | return; |
| 60 | } |
| 61 | else if(DEBUG_RA) |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 62 | cerr << "\n Couldn't alloc Sug col - LR voloatile & calls interf"; |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 63 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 64 | } |
Ruchira Sasanka | 735d6e3 | 2001-10-18 22:38:52 +0000 | [diff] [blame] | 65 | else if ( DEBUG_RA ) { // can't allocate the suggested col |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 66 | cerr << " \n Could NOT allocate the suggested color (already used) "; |
Chris Lattner | 296b773 | 2002-02-05 02:52:05 +0000 | [diff] [blame^] | 67 | printSet(*LR); cerr << "\n"; |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 68 | } |
| 69 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 70 | |
| 71 | unsigned SearchStart; // start pos of color in pref-order |
| 72 | bool ColorFound= false; // have we found a color yet? |
| 73 | |
| 74 | //if this Node is between calls |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 75 | if( ! LR->isCallInterference() ) { |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 76 | |
| 77 | // start with volatiles (we can allocate volatiles safely) |
| 78 | SearchStart = SparcIntRegOrder::StartOfAllRegs; |
| 79 | } |
| 80 | else { |
| 81 | // start with non volatiles (no non-volatiles) |
| 82 | SearchStart = SparcIntRegOrder::StartOfNonVolatileRegs; |
| 83 | } |
| 84 | |
| 85 | unsigned c=0; // color |
| 86 | |
| 87 | // find first unused color |
| 88 | for( c=SearchStart; c < SparcIntRegOrder::NumOfAvailRegs; c++) { |
| 89 | if( ! IsColorUsedArr[ c ] ) { ColorFound = true; break; } |
| 90 | } |
| 91 | |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 92 | if( ColorFound) { |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 93 | LR->setColor(c); // first color found in preffered order |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 94 | if (DEBUG_RA) cerr << "\n Colored after first search with col " << c ; |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 95 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 96 | |
| 97 | // if color is not found because of call interference |
| 98 | // try even finding a volatile color and insert save across calls |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 99 | // |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 100 | else if( LR->isCallInterference() ) |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 101 | { |
| 102 | // start from 0 - try to find even a volatile this time |
| 103 | SearchStart = SparcIntRegOrder::StartOfAllRegs; |
| 104 | |
| 105 | // find first unused volatile color |
| 106 | for(c=SearchStart; c < SparcIntRegOrder::StartOfNonVolatileRegs; c++) { |
| 107 | if( ! IsColorUsedArr[ c ] ) { ColorFound = true; break; } |
| 108 | } |
| 109 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 110 | if (ColorFound) { |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 111 | LR->setColor(c); |
| 112 | // get the live range corresponding to live var |
| 113 | // since LR span across calls, must save across calls |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 114 | // |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 115 | LR->markForSaveAcrossCalls(); |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 116 | if(DEBUG_RA) cerr << "\n Colored after SECOND search with col " << c ; |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 117 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 118 | } |
| 119 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 120 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 121 | // If we couldn't find a color regardless of call interference - i.e., we |
| 122 | // don't have either a volatile or non-volatile color left |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 123 | // |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 124 | if (!ColorFound) |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 125 | LR->markForSpill(); // no color found - must spill |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | //----------------------------------------------------------------------------- |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 134 | // Float Register Class - method for coloring a node in the interference graph. |
| 135 | // |
| 136 | // Algorithm: |
| 137 | // |
| 138 | // If the LR is a double try to allocate f32 - f63 |
| 139 | // If the above fails or LR is single precision |
| 140 | // If the LR does not interfere with a call |
| 141 | // start allocating from f0 |
| 142 | // Else start allocating from f6 |
| 143 | // If a color is still not found because LR interferes with a call |
| 144 | // Search in f0 - f6. If found mark for spill across calls. |
| 145 | // If a color is still not fond, mark for spilling |
| 146 | // |
| 147 | //---------------------------------------------------------------------------- |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 148 | void SparcFloatRegClass::colorIGNode(IGNode * Node,bool IsColorUsedArr[]) const |
| 149 | { |
| 150 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 151 | LiveRange * LR = Node->getParentLR(); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 152 | unsigned NumNeighbors = Node->getNumOfNeighbors(); // total # of neighbors |
| 153 | |
| 154 | for(unsigned n=0; n < NumNeighbors; n++) { // for each neigh |
| 155 | IGNode *NeighIGNode = Node->getAdjIGNode(n); |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 156 | LiveRange *NeighLR = NeighIGNode->getParentLR(); |
| 157 | |
| 158 | if( NeighLR->hasColor() ) { // if neigh has a color |
| 159 | IsColorUsedArr[ NeighLR->getColor() ] = true; // record that color |
| 160 | if( NeighLR->getTypeID() == Type::DoubleTyID ) |
| 161 | IsColorUsedArr[ (NeighLR->getColor()) + 1 ] = true; |
| 162 | } |
| 163 | else if( NeighLR->hasSuggestedColor() ) { // if neigh has sugg color |
Ruchira Sasanka | b49865f | 2001-10-19 21:41:16 +0000 | [diff] [blame] | 164 | |
| 165 | if( NeighLR-> isSuggestedColorUsable() ) { |
| 166 | |
| 167 | // if the neighbout can use the suggested color |
| 168 | |
| 169 | IsColorUsedArr[ NeighLR->getSuggestedColor() ] = true; |
| 170 | if( NeighLR->getTypeID() == Type::DoubleTyID ) |
| 171 | IsColorUsedArr[ (NeighLR->getSuggestedColor()) + 1 ] = true; |
| 172 | } |
| 173 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | } |
| 177 | |
| 178 | |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 179 | // **NOTE: We don't check for call interferences in allocating suggested |
| 180 | // color in this class since ALL registers are volatile. If this fact |
| 181 | // changes, we should change the following part |
| 182 | //- see SparcIntRegClass::colorIGNode() |
| 183 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 184 | if( LR->hasSuggestedColor() ) { |
| 185 | if( ! IsColorUsedArr[ LR->getSuggestedColor() ] ) { |
| 186 | LR->setColor( LR->getSuggestedColor() ); |
| 187 | return; |
Chris Lattner | 296b773 | 2002-02-05 02:52:05 +0000 | [diff] [blame^] | 188 | } else if (DEBUG_RA) { // can't allocate the suggested col |
Chris Lattner | 1e23ed7 | 2001-10-15 18:15:27 +0000 | [diff] [blame] | 189 | cerr << " Could NOT allocate the suggested color for LR "; |
Chris Lattner | 296b773 | 2002-02-05 02:52:05 +0000 | [diff] [blame^] | 190 | printSet(*LR); cerr << "\n"; |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 191 | } |
| 192 | } |
| 193 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 194 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 195 | int ColorFound = -1; // have we found a color yet? |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 196 | bool isCallInterf = LR->isCallInterference(); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 197 | |
| 198 | // if value is a double - search the double only reigon (f32 - f63) |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 199 | // i.e. we try to allocate f32 - f63 first for doubles since singles |
| 200 | // cannot go there. By doing that, we provide more space for singles |
| 201 | // in f0 - f31 |
| 202 | // |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 203 | if( LR->getTypeID() == Type::DoubleTyID ) |
| 204 | ColorFound = findFloatColor( LR, 32, 64, IsColorUsedArr ); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 205 | |
| 206 | |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 207 | if( ColorFound >= 0 ) { // if we could find a color |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 208 | LR->setColor(ColorFound); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 209 | return; |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 210 | } else { |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 211 | |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 212 | // if we didn't find a color becuase the LR was single precision or |
| 213 | // all f32-f63 range is filled, we try to allocate a register from |
| 214 | // the f0 - f31 region |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 215 | |
| 216 | unsigned SearchStart; // start pos of color in pref-order |
| 217 | |
| 218 | //if this Node is between calls (i.e., no call interferences ) |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 219 | if( ! isCallInterf ) { |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 220 | // start with volatiles (we can allocate volatiles safely) |
| 221 | SearchStart = SparcFloatRegOrder::StartOfAllRegs; |
| 222 | } |
| 223 | else { |
| 224 | // start with non volatiles (no non-volatiles) |
| 225 | SearchStart = SparcFloatRegOrder::StartOfNonVolatileRegs; |
| 226 | } |
| 227 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 228 | ColorFound = findFloatColor( LR, SearchStart, 32, IsColorUsedArr ); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 229 | } |
| 230 | |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 231 | |
| 232 | |
| 233 | if( ColorFound >= 0 ) { // if we could find a color |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 234 | LR->setColor(ColorFound); |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 235 | return; |
| 236 | } |
Ruchira Sasanka | 0f5e988 | 2001-10-19 17:23:43 +0000 | [diff] [blame] | 237 | else if( isCallInterf ) { |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 238 | |
| 239 | // We are here because there is a call interference and no non-volatile |
| 240 | // color could be found. |
| 241 | // Now try to allocate even a volatile color |
| 242 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 243 | ColorFound = findFloatColor( LR, SparcFloatRegOrder::StartOfAllRegs, |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 244 | SparcFloatRegOrder::StartOfNonVolatileRegs, |
| 245 | IsColorUsedArr); |
| 246 | } |
| 247 | |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 248 | |
| 249 | |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 250 | if( ColorFound >= 0 ) { |
Ruchira Sasanka | 9144228 | 2001-09-30 23:16:47 +0000 | [diff] [blame] | 251 | LR->setColor(ColorFound); // first color found in preffered order |
| 252 | LR->markForSaveAcrossCalls(); |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 253 | } else { |
| 254 | // we are here because no color could be found |
| 255 | LR->markForSpill(); // no color found - must spill |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 256 | } |
Ruchira Sasanka | 89fb46b | 2001-09-18 22:52:44 +0000 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 260 | //----------------------------------------------------------------------------- |
| 261 | // Helper method for coloring a node of Float Reg class. |
| 262 | // Finds the first available color in the range [Start,End] depending on the |
| 263 | // type of the Node (i.e., float/double) |
| 264 | //----------------------------------------------------------------------------- |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 265 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 266 | int SparcFloatRegClass::findFloatColor(const LiveRange *LR, |
| 267 | unsigned Start, unsigned End, |
| 268 | bool IsColorUsedArr[] ) const { |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 269 | bool ColorFound = false; |
| 270 | unsigned c; |
| 271 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 272 | if (LR->getTypeID() == Type::DoubleTyID) { |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 273 | // find first unused color for a double |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 274 | for (c=Start; c < End ; c+= 2) |
| 275 | if (!IsColorUsedArr[c] && !IsColorUsedArr[c+1]) |
| 276 | return c; |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 277 | } else { |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 278 | // find first unused color for a single |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 279 | for (c = Start; c < End; c++) |
| 280 | if (!IsColorUsedArr[c]) |
| 281 | return c; |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 282 | } |
| 283 | |
Chris Lattner | 699683c | 2002-02-04 05:59:25 +0000 | [diff] [blame] | 284 | return -1; |
Ruchira Sasanka | d00982a | 2002-01-07 19:20:28 +0000 | [diff] [blame] | 285 | } |