From 0ab5d0ee5b13514a939d9131e9a6227eb6014bae Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sat, 23 Jul 2011 03:10:19 +0000 Subject: [PATCH] Add a simple method for marking blocks with interference in and out. This method matches addLinks - All the listed blocks are considered to have interference, so they add a negative bias to their bundles. This could also be done by addConstraints, but that requires building a separate BlockConstraint array. llvm-svn: 135844 --- llvm/lib/CodeGen/SpillPlacement.cpp | 14 ++++++++++++++ llvm/lib/CodeGen/SpillPlacement.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/llvm/lib/CodeGen/SpillPlacement.cpp b/llvm/lib/CodeGen/SpillPlacement.cpp index 694961863261..ce7b37bfce5e 100644 --- a/llvm/lib/CodeGen/SpillPlacement.cpp +++ b/llvm/lib/CodeGen/SpillPlacement.cpp @@ -239,6 +239,20 @@ void SpillPlacement::addConstraints(ArrayRef LiveBlocks) { } } +/// addPrefSpill - Same as addConstraints(PrefSpill) +void SpillPlacement::addPrefSpill(ArrayRef Blocks) { + for (ArrayRef::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 Links) { for (ArrayRef::iterator I = Links.begin(), E = Links.end(); I != E; ++I) { diff --git a/llvm/lib/CodeGen/SpillPlacement.h b/llvm/lib/CodeGen/SpillPlacement.h index 6952ad800965..9a4fc6dc9700 100644 --- a/llvm/lib/CodeGen/SpillPlacement.h +++ b/llvm/lib/CodeGen/SpillPlacement.h @@ -96,6 +96,10 @@ public: /// live out. void addConstraints(ArrayRef 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 Blocks); + /// addLinks - Add transparent blocks with the given numbers. void addLinks(ArrayRef Links);