X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSpillPlacement.cpp;h=320128a999ea8cf170a002bec46498273f503947;hb=7d2f2496c1d263eecdc104fd72e847a31d8695b9;hp=10a3c189624e0360d06db395124652a0f2356b5f;hpb=0e0a8806d49038b60a0c20427d9f410b01cbb012;p=oota-llvm.git diff --git a/lib/CodeGen/SpillPlacement.cpp b/lib/CodeGen/SpillPlacement.cpp index 10a3c189624..320128a999e 100644 --- a/lib/CodeGen/SpillPlacement.cpp +++ b/lib/CodeGen/SpillPlacement.cpp @@ -207,6 +207,17 @@ void SpillPlacement::activate(unsigned n) { return; ActiveNodes->set(n); nodes[n].clear(); + + // Very large bundles usually come from big switches, indirect branches, + // landing pads, or loops with many 'continue' statements. It is difficult to + // allocate registers when so many different blocks are involved. + // + // Give a small negative bias to large bundles such that 1/32 of the + // connected blocks need to be interested before we consider expanding the + // region through the bundle. This helps compile time by limiting the number + // of blocks visited and the number of links in the Hopfield network. + if (bundles->getBlocks(n).size() > 100) + nodes[n].Bias = -0.0625f; } @@ -241,10 +252,12 @@ void SpillPlacement::addConstraints(ArrayRef LiveBlocks) { } /// addPrefSpill - Same as addConstraints(PrefSpill) -void SpillPlacement::addPrefSpill(ArrayRef Blocks) { +void SpillPlacement::addPrefSpill(ArrayRef Blocks, bool Strong) { for (ArrayRef::iterator I = Blocks.begin(), E = Blocks.end(); I != E; ++I) { float Freq = getBlockFrequency(*I); + if (Strong) + Freq += Freq; unsigned ib = bundles->getBundle(*I, 0); unsigned ob = bundles->getBundle(*I, 1); activate(ib);