@@ -135,9 +135,9 @@ namespace {
135
135
void RA::releaseMemory ()
136
136
{
137
137
unhandled_.clear ();
138
+ fixed_.clear ();
138
139
active_.clear ();
139
140
inactive_.clear ();
140
- fixed_.clear ();
141
141
handled_.clear ();
142
142
}
143
143
@@ -171,25 +171,10 @@ void RA::linearScan()
171
171
DEBUG (printIntervals (" active" , active_.begin (), active_.end ()));
172
172
DEBUG (printIntervals (" inactive" , inactive_.begin (), inactive_.end ()));
173
173
174
- while (!unhandled_.empty () || !fixed_. empty () ) {
174
+ while (!unhandled_.empty ()) {
175
175
// pick the interval with the earliest start point
176
- IntervalPtrs::value_type cur;
177
- if (fixed_.empty ()) {
178
- cur = unhandled_.front ();
179
- unhandled_.pop_front ();
180
- }
181
- else if (unhandled_.empty ()) {
182
- cur = fixed_.front ();
183
- fixed_.pop_front ();
184
- }
185
- else if (unhandled_.front ()->start () < fixed_.front ()->start ()) {
186
- cur = unhandled_.front ();
187
- unhandled_.pop_front ();
188
- }
189
- else {
190
- cur = fixed_.front ();
191
- fixed_.pop_front ();
192
- }
176
+ IntervalPtrs::value_type cur = unhandled_.front ();
177
+ unhandled_.pop_front ();
193
178
194
179
DEBUG (std::cerr << " \n *** CURRENT ***: " << *cur << ' \n ' );
195
180
@@ -234,10 +219,9 @@ void RA::initIntervalSets(LiveIntervals::Intervals& li)
234
219
235
220
for (LiveIntervals::Intervals::iterator i = li.begin (), e = li.end ();
236
221
i != e; ++i) {
222
+ unhandled_.push_back (&*i);
237
223
if (MRegisterInfo::isPhysicalRegister (i->reg ))
238
224
fixed_.push_back (&*i);
239
- else
240
- unhandled_.push_back (&*i);
241
225
}
242
226
}
243
227
@@ -444,7 +428,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
444
428
445
429
DEBUG (std::cerr << " \t\t rolling back to: " << earliestStart << ' \n ' );
446
430
// scan handled in reverse order and undo each one, restoring the
447
- // state of unhandled and fixed
431
+ // state of unhandled
448
432
while (!handled_.empty ()) {
449
433
IntervalPtrs::value_type i = handled_.back ();
450
434
// if this interval starts before t we are done
@@ -456,8 +440,8 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
456
440
if ((it = find (active_.begin (), active_.end (), i)) != active_.end ()) {
457
441
active_.erase (it);
458
442
if (MRegisterInfo::isPhysicalRegister (i->reg )) {
459
- fixed_.push_front (i);
460
443
prt_->delRegUse (i->reg );
444
+ unhandled_.push_front (i);
461
445
}
462
446
else {
463
447
prt_->delRegUse (vrm_->getPhys (i->reg ));
@@ -479,7 +463,7 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
479
463
else if ((it = find (inactive_.begin (), inactive_.end (), i)) != inactive_.end ()) {
480
464
inactive_.erase (it);
481
465
if (MRegisterInfo::isPhysicalRegister (i->reg ))
482
- fixed_ .push_front (i);
466
+ unhandled_ .push_front (i);
483
467
else {
484
468
vrm_->clearVirt (i->reg );
485
469
if (i->spilled ()) {
@@ -496,12 +480,9 @@ void RA::assignRegOrStackSlotAtInterval(IntervalPtrs::value_type cur)
496
480
}
497
481
}
498
482
else {
499
- if (MRegisterInfo::isPhysicalRegister (i->reg ))
500
- fixed_.push_front (i);
501
- else {
483
+ if (MRegisterInfo::isVirtualRegister (i->reg ))
502
484
vrm_->clearVirt (i->reg );
503
- unhandled_.push_front (i);
504
- }
485
+ unhandled_.push_front (i);
505
486
}
506
487
}
507
488
0 commit comments