summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SpillPlacement.cpp
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2014-09-19 22:46:28 +0000
committerChris Bieneman <beanz@apple.com>2014-09-19 22:46:28 +0000
commit1a98490ce560b66072a17890799d57546b8c2c64 (patch)
treec455bfdd6bfbbc14fa4bfc6a92ae8ee9f300cc90 /llvm/lib/CodeGen/SpillPlacement.cpp
parenta9865543770737c2fbb771b050c9320f32479cce (diff)
downloadbcm5719-llvm-1a98490ce560b66072a17890799d57546b8c2c64.tar.gz
bcm5719-llvm-1a98490ce560b66072a17890799d57546b8c2c64.zip
Converting SpillPlacement's BlockFrequency threshold to a ManagedStatic to avoid static constructors and destructors.
llvm-svn: 218163
Diffstat (limited to 'llvm/lib/CodeGen/SpillPlacement.cpp')
-rw-r--r--llvm/lib/CodeGen/SpillPlacement.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SpillPlacement.cpp b/llvm/lib/CodeGen/SpillPlacement.cpp
index 24e94d11f88..daaecf1f1b2 100644
--- a/llvm/lib/CodeGen/SpillPlacement.cpp
+++ b/llvm/lib/CodeGen/SpillPlacement.cpp
@@ -37,6 +37,7 @@
#include "llvm/CodeGen/Passes.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
+#include "llvm/Support/ManagedStatic.h"
using namespace llvm;
@@ -61,12 +62,12 @@ void SpillPlacement::getAnalysisUsage(AnalysisUsage &AU) const {
}
namespace {
-static BlockFrequency Threshold;
+static ManagedStatic<BlockFrequency> Threshold;
}
/// Decision threshold. A node gets the output value 0 if the weighted sum of
/// its inputs falls in the open interval (-Threshold;Threshold).
-static BlockFrequency getThreshold() { return Threshold; }
+static BlockFrequency getThreshold() { return *Threshold; }
/// \brief Set the threshold for a given entry frequency.
///
@@ -78,7 +79,7 @@ static void setThreshold(const BlockFrequency &Entry) {
// it. Divide by 2^13, rounding as appropriate.
uint64_t Freq = Entry.getFrequency();
uint64_t Scaled = (Freq >> 13) + bool(Freq & (1 << 12));
- Threshold = std::max(UINT64_C(1), Scaled);
+ *Threshold = std::max(UINT64_C(1), Scaled);
}
/// Node - Each edge bundle corresponds to a Hopfield node.
OpenPOWER on IntegriCloud