blob: daaecf1f1b2d75c71fb5f27010c573f7f4ddfd68 [file] [log] [blame]
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +00001//===-- SpillPlacement.cpp - Optimal Spill Code Placement -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the spill code placement analysis.
11//
12// Each edge bundle corresponds to a node in a Hopfield network. Constraints on
13// basic blocks are weighted by the block frequency and added to become the node
14// bias.
15//
16// Transparent basic blocks have the variable live through, but don't care if it
17// is spilled or in a register. These blocks become connections in the Hopfield
18// network, again weighted by block frequency.
19//
20// The Hopfield network minimizes (possibly locally) its energy function:
21//
22// E = -sum_n V_n * ( B_n + sum_{n, m linked by b} V_m * F_b )
23//
24// The energy function represents the expected spill code execution frequency,
25// or the cost of spilling. This is a Lyapunov function which never increases
26// when a node is updated. It is guaranteed to converge to a local minimum.
27//
28//===----------------------------------------------------------------------===//
29
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000030#include "SpillPlacement.h"
Jakub Staszakb6970262013-03-18 23:45:45 +000031#include "llvm/ADT/BitVector.h"
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000032#include "llvm/CodeGen/EdgeBundles.h"
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000033#include "llvm/CodeGen/MachineBasicBlock.h"
Benjamin Kramere2a1d892013-06-17 19:00:36 +000034#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000035#include "llvm/CodeGen/MachineFunction.h"
36#include "llvm/CodeGen/MachineLoopInfo.h"
37#include "llvm/CodeGen/Passes.h"
38#include "llvm/Support/Debug.h"
39#include "llvm/Support/Format.h"
Chris Bieneman1a984902014-09-19 22:46:28 +000040#include "llvm/Support/ManagedStatic.h"
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000041
42using namespace llvm;
43
Chandler Carruth1b9dde02014-04-22 02:02:50 +000044#define DEBUG_TYPE "spillplacement"
45
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000046char SpillPlacement::ID = 0;
47INITIALIZE_PASS_BEGIN(SpillPlacement, "spill-code-placement",
48 "Spill Code Placement Analysis", true, true)
49INITIALIZE_PASS_DEPENDENCY(EdgeBundles)
50INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo)
51INITIALIZE_PASS_END(SpillPlacement, "spill-code-placement",
52 "Spill Code Placement Analysis", true, true)
53
54char &llvm::SpillPlacementID = SpillPlacement::ID;
55
56void SpillPlacement::getAnalysisUsage(AnalysisUsage &AU) const {
57 AU.setPreservesAll();
Benjamin Kramere2a1d892013-06-17 19:00:36 +000058 AU.addRequired<MachineBlockFrequencyInfo>();
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000059 AU.addRequiredTransitive<EdgeBundles>();
60 AU.addRequiredTransitive<MachineLoopInfo>();
61 MachineFunctionPass::getAnalysisUsage(AU);
62}
63
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +000064namespace {
Chris Bieneman1a984902014-09-19 22:46:28 +000065static ManagedStatic<BlockFrequency> Threshold;
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +000066}
67
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +000068/// Decision threshold. A node gets the output value 0 if the weighted sum of
69/// its inputs falls in the open interval (-Threshold;Threshold).
Chris Bieneman1a984902014-09-19 22:46:28 +000070static BlockFrequency getThreshold() { return *Threshold; }
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +000071
72/// \brief Set the threshold for a given entry frequency.
73///
74/// Set the threshold relative to \c Entry. Since the threshold is used as a
75/// bound on the open interval (-Threshold;Threshold), 1 is the minimum
76/// threshold.
77static void setThreshold(const BlockFrequency &Entry) {
78 // Apparently 2 is a good threshold when Entry==2^14, but we need to scale
79 // it. Divide by 2^13, rounding as appropriate.
80 uint64_t Freq = Entry.getFrequency();
81 uint64_t Scaled = (Freq >> 13) + bool(Freq & (1 << 12));
Chris Bieneman1a984902014-09-19 22:46:28 +000082 *Threshold = std::max(UINT64_C(1), Scaled);
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +000083}
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +000084
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000085/// Node - Each edge bundle corresponds to a Hopfield node.
86///
87/// The node contains precomputed frequency data that only depends on the CFG,
88/// but Bias and Links are computed each time placeSpills is called.
89///
90/// The node Value is positive when the variable should be in a register. The
91/// value can change when linked nodes change, but convergence is very fast
92/// because all weights are positive.
93///
94struct SpillPlacement::Node {
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +000095 /// BiasN - Sum of blocks that prefer a spill.
96 BlockFrequency BiasN;
97 /// BiasP - Sum of blocks that prefer a register.
98 BlockFrequency BiasP;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +000099
100 /// Value - Output value of this node computed from the Bias and links.
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000101 /// This is always on of the values {-1, 0, 1}. A positive number means the
102 /// variable should go in a register through this bundle.
103 int Value;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000104
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000105 typedef SmallVector<std::pair<BlockFrequency, unsigned>, 4> LinkVector;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000106
107 /// Links - (Weight, BundleNo) for all transparent blocks connecting to other
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000108 /// bundles. The weights are all positive block frequencies.
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000109 LinkVector Links;
110
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000111 /// SumLinkWeights - Cached sum of the weights of all links + ThresHold.
112 BlockFrequency SumLinkWeights;
113
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000114 /// preferReg - Return true when this node prefers to be in a register.
115 bool preferReg() const {
116 // Undecided nodes (Value==0) go on the stack.
117 return Value > 0;
118 }
119
120 /// mustSpill - Return True if this node is so biased that it must spill.
121 bool mustSpill() const {
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000122 // We must spill if Bias < -sum(weights) or the MustSpill flag was set.
123 // BiasN is saturated when MustSpill is set, make sure this still returns
124 // true when the RHS saturates. Note that SumLinkWeights includes Threshold.
125 return BiasN >= BiasP + SumLinkWeights;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000126 }
127
128 /// clear - Reset per-query data, but preserve frequencies that only depend on
129 // the CFG.
130 void clear() {
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000131 BiasN = BiasP = Value = 0;
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +0000132 SumLinkWeights = getThreshold();
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000133 Links.clear();
134 }
135
136 /// addLink - Add a link to bundle b with weight w.
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000137 void addLink(unsigned b, BlockFrequency w) {
138 // Update cached sum.
139 SumLinkWeights += w;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000140
141 // There can be multiple links to the same bundle, add them up.
142 for (LinkVector::iterator I = Links.begin(), E = Links.end(); I != E; ++I)
143 if (I->second == b) {
144 I->first += w;
145 return;
146 }
147 // This must be the first link to b.
148 Links.push_back(std::make_pair(w, b));
149 }
150
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000151 /// addBias - Bias this node.
152 void addBias(BlockFrequency freq, BorderConstraint direction) {
153 switch (direction) {
154 default:
155 break;
156 case PrefReg:
157 BiasP += freq;
158 break;
159 case PrefSpill:
160 BiasN += freq;
161 break;
162 case MustSpill:
163 BiasN = BlockFrequency::getMaxFrequency();
164 break;
165 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000166 }
167
168 /// update - Recompute Value from Bias and Links. Return true when node
169 /// preference changes.
170 bool update(const Node nodes[]) {
171 // Compute the weighted sum of inputs.
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000172 BlockFrequency SumN = BiasN;
173 BlockFrequency SumP = BiasP;
174 for (LinkVector::iterator I = Links.begin(), E = Links.end(); I != E; ++I) {
175 if (nodes[I->second].Value == -1)
176 SumN += I->first;
177 else if (nodes[I->second].Value == 1)
178 SumP += I->first;
179 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000180
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000181 // Each weighted sum is going to be less than the total frequency of the
182 // bundle. Ideally, we should simply set Value = sign(SumP - SumN), but we
183 // will add a dead zone around 0 for two reasons:
184 //
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000185 // 1. It avoids arbitrary bias when all links are 0 as is possible during
186 // initial iterations.
187 // 2. It helps tame rounding errors when the links nominally sum to 0.
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000188 //
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000189 bool Before = preferReg();
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +0000190 if (SumN >= SumP + getThreshold())
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000191 Value = -1;
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +0000192 else if (SumP >= SumN + getThreshold())
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000193 Value = 1;
194 else
195 Value = 0;
196 return Before != preferReg();
197 }
198};
199
200bool SpillPlacement::runOnMachineFunction(MachineFunction &mf) {
201 MF = &mf;
202 bundles = &getAnalysis<EdgeBundles>();
203 loops = &getAnalysis<MachineLoopInfo>();
204
205 assert(!nodes && "Leaking node array");
206 nodes = new Node[bundles->getNumBundles()];
207
208 // Compute total ingoing and outgoing block frequencies for all bundles.
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000209 BlockFrequencies.resize(mf.getNumBlockIDs());
Michael Gottesman092647b2013-12-14 00:25:47 +0000210 MBFI = &getAnalysis<MachineBlockFrequencyInfo>();
Duncan P. N. Exon Smitha5df8132014-04-08 19:18:56 +0000211 setThreshold(MBFI->getEntryFreq());
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000212 for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) {
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000213 unsigned Num = I->getNumber();
Michael Gottesman092647b2013-12-14 00:25:47 +0000214 BlockFrequencies[Num] = MBFI->getBlockFreq(I);
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000215 }
216
217 // We never change the function.
218 return false;
219}
220
221void SpillPlacement::releaseMemory() {
222 delete[] nodes;
Craig Topperc0196b12014-04-14 00:51:57 +0000223 nodes = nullptr;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000224}
225
226/// activate - mark node n as active if it wasn't already.
227void SpillPlacement::activate(unsigned n) {
228 if (ActiveNodes->test(n))
229 return;
230 ActiveNodes->set(n);
231 nodes[n].clear();
Jakob Stoklund Olesen29268b52012-05-21 03:11:23 +0000232
233 // Very large bundles usually come from big switches, indirect branches,
234 // landing pads, or loops with many 'continue' statements. It is difficult to
235 // allocate registers when so many different blocks are involved.
236 //
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000237 // Give a small negative bias to large bundles such that a substantial
238 // fraction of the connected blocks need to be interested before we consider
239 // expanding the region through the bundle. This helps compile time by
240 // limiting the number of blocks visited and the number of links in the
241 // Hopfield network.
242 if (bundles->getBlocks(n).size() > 100) {
243 nodes[n].BiasP = 0;
Michael Gottesman5e985ee2013-12-14 02:37:38 +0000244 nodes[n].BiasN = (MBFI->getEntryFreq() / 16);
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000245 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000246}
247
248
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000249/// addConstraints - Compute node biases and weights from a set of constraints.
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000250/// Set a bit in NodeMask for each active node.
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000251void SpillPlacement::addConstraints(ArrayRef<BlockConstraint> LiveBlocks) {
252 for (ArrayRef<BlockConstraint>::iterator I = LiveBlocks.begin(),
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000253 E = LiveBlocks.end(); I != E; ++I) {
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000254 BlockFrequency Freq = BlockFrequencies[I->Number];
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000255
256 // Live-in to block?
257 if (I->Entry != DontCare) {
258 unsigned ib = bundles->getBundle(I->Number, 0);
259 activate(ib);
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000260 nodes[ib].addBias(Freq, I->Entry);
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000261 }
262
263 // Live-out from block?
264 if (I->Exit != DontCare) {
265 unsigned ob = bundles->getBundle(I->Number, 1);
266 activate(ob);
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000267 nodes[ob].addBias(Freq, I->Exit);
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000268 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000269 }
270}
271
Jakob Stoklund Olesen0ab5d0e2011-07-23 03:10:19 +0000272/// addPrefSpill - Same as addConstraints(PrefSpill)
Jakob Stoklund Olesen86954522011-08-03 23:09:38 +0000273void SpillPlacement::addPrefSpill(ArrayRef<unsigned> Blocks, bool Strong) {
Jakob Stoklund Olesen0ab5d0e2011-07-23 03:10:19 +0000274 for (ArrayRef<unsigned>::iterator I = Blocks.begin(), E = Blocks.end();
275 I != E; ++I) {
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000276 BlockFrequency Freq = BlockFrequencies[*I];
Jakob Stoklund Olesen86954522011-08-03 23:09:38 +0000277 if (Strong)
278 Freq += Freq;
Jakob Stoklund Olesen0ab5d0e2011-07-23 03:10:19 +0000279 unsigned ib = bundles->getBundle(*I, 0);
280 unsigned ob = bundles->getBundle(*I, 1);
281 activate(ib);
282 activate(ob);
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000283 nodes[ib].addBias(Freq, PrefSpill);
284 nodes[ob].addBias(Freq, PrefSpill);
Jakob Stoklund Olesen0ab5d0e2011-07-23 03:10:19 +0000285 }
286}
287
Jakob Stoklund Olesen6d2bbc12011-04-07 17:27:46 +0000288void SpillPlacement::addLinks(ArrayRef<unsigned> Links) {
289 for (ArrayRef<unsigned>::iterator I = Links.begin(), E = Links.end(); I != E;
290 ++I) {
291 unsigned Number = *I;
292 unsigned ib = bundles->getBundle(Number, 0);
293 unsigned ob = bundles->getBundle(Number, 1);
294
295 // Ignore self-loops.
296 if (ib == ob)
297 continue;
298 activate(ib);
299 activate(ob);
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000300 if (nodes[ib].Links.empty() && !nodes[ib].mustSpill())
301 Linked.push_back(ib);
302 if (nodes[ob].Links.empty() && !nodes[ob].mustSpill())
303 Linked.push_back(ob);
Jakob Stoklund Olesenc5454ff2013-07-16 18:26:15 +0000304 BlockFrequency Freq = BlockFrequencies[Number];
305 nodes[ib].addLink(ob, Freq);
306 nodes[ob].addLink(ib, Freq);
Jakob Stoklund Olesen6d2bbc12011-04-07 17:27:46 +0000307 }
308}
309
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000310bool SpillPlacement::scanActiveBundles() {
311 Linked.clear();
312 RecentPositive.clear();
313 for (int n = ActiveNodes->find_first(); n>=0; n = ActiveNodes->find_next(n)) {
314 nodes[n].update(nodes);
315 // A node that must spill, or a node without any links is not going to
316 // change its value ever again, so exclude it from iterations.
317 if (nodes[n].mustSpill())
318 continue;
319 if (!nodes[n].Links.empty())
320 Linked.push_back(n);
321 if (nodes[n].preferReg())
322 RecentPositive.push_back(n);
323 }
324 return !RecentPositive.empty();
325}
326
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000327/// iterate - Repeatedly update the Hopfield nodes until stability or the
328/// maximum number of iterations is reached.
329/// @param Linked - Numbers of linked nodes that need updating.
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000330void SpillPlacement::iterate() {
331 // First update the recently positive nodes. They have likely received new
332 // negative bias that will turn them off.
333 while (!RecentPositive.empty())
334 nodes[RecentPositive.pop_back_val()].update(nodes);
335
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000336 if (Linked.empty())
337 return;
338
339 // Run up to 10 iterations. The edge bundle numbering is closely related to
340 // basic block numbering, so there is a strong tendency towards chains of
341 // linked nodes with sequential numbers. By scanning the linked nodes
342 // backwards and forwards, we make it very likely that a single node can
343 // affect the entire network in a single iteration. That means very fast
344 // convergence, usually in a single iteration.
345 for (unsigned iteration = 0; iteration != 10; ++iteration) {
Manman Ren709c9512014-02-28 23:05:31 +0000346 // Scan backwards, skipping the last node when iteration is not zero. When
347 // iteration is not zero, the last node was just updated.
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000348 bool Changed = false;
349 for (SmallVectorImpl<unsigned>::const_reverse_iterator I =
Benjamin Kramerb6d0bd42014-03-02 12:27:27 +0000350 iteration == 0 ? Linked.rbegin() : std::next(Linked.rbegin()),
Manman Ren709c9512014-02-28 23:05:31 +0000351 E = Linked.rend(); I != E; ++I) {
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000352 unsigned n = *I;
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000353 if (nodes[n].update(nodes)) {
354 Changed = true;
355 if (nodes[n].preferReg())
356 RecentPositive.push_back(n);
357 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000358 }
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000359 if (!Changed || !RecentPositive.empty())
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000360 return;
361
362 // Scan forwards, skipping the first node which was just updated.
363 Changed = false;
364 for (SmallVectorImpl<unsigned>::const_iterator I =
Benjamin Kramerb6d0bd42014-03-02 12:27:27 +0000365 std::next(Linked.begin()), E = Linked.end(); I != E; ++I) {
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000366 unsigned n = *I;
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000367 if (nodes[n].update(nodes)) {
368 Changed = true;
369 if (nodes[n].preferReg())
370 RecentPositive.push_back(n);
371 }
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000372 }
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000373 if (!Changed || !RecentPositive.empty())
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000374 return;
375 }
376}
377
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000378void SpillPlacement::prepare(BitVector &RegBundles) {
Jakob Stoklund Olesened47ed42011-04-09 02:59:09 +0000379 Linked.clear();
380 RecentPositive.clear();
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000381 // Reuse RegBundles as our ActiveNodes vector.
382 ActiveNodes = &RegBundles;
383 ActiveNodes->clear();
384 ActiveNodes->resize(bundles->getNumBundles());
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000385}
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000386
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000387bool
388SpillPlacement::finish() {
389 assert(ActiveNodes && "Call prepare() first");
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000390
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000391 // Write preferences back to ActiveNodes.
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000392 bool Perfect = true;
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000393 for (int n = ActiveNodes->find_first(); n>=0; n = ActiveNodes->find_next(n))
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000394 if (!nodes[n].preferReg()) {
Jakob Stoklund Olesen36b5d8a2011-04-06 19:13:57 +0000395 ActiveNodes->reset(n);
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000396 Perfect = false;
397 }
Craig Topperc0196b12014-04-14 00:51:57 +0000398 ActiveNodes = nullptr;
Jakob Stoklund Olesen8e236ea2011-01-06 01:21:53 +0000399 return Perfect;
400}