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