diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SpillPlacement.cpp | 14 | ||||
-rw-r--r-- | lib/CodeGen/SpillPlacement.h | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/SpillPlacement.cpp b/lib/CodeGen/SpillPlacement.cpp index 6949618632..ce7b37bfce 100644 --- a/lib/CodeGen/SpillPlacement.cpp +++ b/lib/CodeGen/SpillPlacement.cpp @@ -239,6 +239,20 @@ void SpillPlacement::addConstraints(ArrayRef<BlockConstraint> LiveBlocks) { } } +/// addPrefSpill - Same as addConstraints(PrefSpill) +void SpillPlacement::addPrefSpill(ArrayRef<unsigned> Blocks) { + for (ArrayRef<unsigned>::iterator I = Blocks.begin(), E = Blocks.end(); + I != E; ++I) { + float Freq = getBlockFrequency(*I); + unsigned ib = bundles->getBundle(*I, 0); + unsigned ob = bundles->getBundle(*I, 1); + activate(ib); + activate(ob); + nodes[ib].addBias(-Freq, 1); + nodes[ob].addBias(-Freq, 0); + } +} + void SpillPlacement::addLinks(ArrayRef<unsigned> Links) { for (ArrayRef<unsigned>::iterator I = Links.begin(), E = Links.end(); I != E; ++I) { diff --git a/lib/CodeGen/SpillPlacement.h b/lib/CodeGen/SpillPlacement.h index 6952ad8009..9a4fc6dc97 100644 --- a/lib/CodeGen/SpillPlacement.h +++ b/lib/CodeGen/SpillPlacement.h @@ -96,6 +96,10 @@ public: /// live out. void addConstraints(ArrayRef<BlockConstraint> LiveBlocks); + /// addPrefSpill - Add PrefSpill constraints to all blocks listed. + /// @param Blocks Array of block numbers that prefer to spill in and out. + void addPrefSpill(ArrayRef<unsigned> Blocks); + /// addLinks - Add transparent blocks with the given numbers. void addLinks(ArrayRef<unsigned> Links); |