From 04142bc845c513141046e852db86670505459416 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 10 Sep 2012 11:52:08 +0000 Subject: Move bypassSlowDivision into the llvm namespace. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163503 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Transforms/Utils/BypassSlowDivision.h | 10 +++++++--- lib/Transforms/Utils/BypassSlowDivision.cpp | 10 ++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/include/llvm/Transforms/Utils/BypassSlowDivision.h b/include/llvm/Transforms/Utils/BypassSlowDivision.h index 3646d736ab..c262434b66 100644 --- a/include/llvm/Transforms/Utils/BypassSlowDivision.h +++ b/include/llvm/Transforms/Utils/BypassSlowDivision.h @@ -20,10 +20,14 @@ #include "llvm/Function.h" +namespace llvm { + /// This optimization identifies DIV instructions that can be /// profitably bypassed and carried out with a shorter, faster divide. -bool bypassSlowDivision(llvm::Function &F, - llvm::Function::iterator &I, - const llvm::DenseMap &BypassTypeMap); +bool bypassSlowDivision(Function &F, + Function::iterator &I, + const DenseMap &BypassTypeMap); + +} // End llvm namespace #endif diff --git a/lib/Transforms/Utils/BypassSlowDivision.cpp b/lib/Transforms/Utils/BypassSlowDivision.cpp index b694779a53..30d60be277 100644 --- a/lib/Transforms/Utils/BypassSlowDivision.cpp +++ b/lib/Transforms/Utils/BypassSlowDivision.cpp @@ -24,7 +24,7 @@ using namespace llvm; -namespace llvm { +namespace { struct DivOpInfo { bool SignedOp; Value *Dividend; @@ -41,7 +41,9 @@ namespace llvm { DivPhiNodes(PHINode *InQuotient, PHINode *InRemainder) : Quotient(InQuotient), Remainder(InRemainder) {} }; +} +namespace llvm { template<> struct DenseMapInfo { static bool isEqual(const DivOpInfo &Val1, const DivOpInfo &Val2) { @@ -217,9 +219,9 @@ static bool reuseOrInsertFastDiv(Function &F, // bypassSlowDivision - This optimization identifies DIV instructions that can // be profitably bypassed and carried out with a shorter, faster divide. -bool bypassSlowDivision(Function &F, - Function::iterator &I, - const llvm::DenseMap &BypassTypeMap) { +bool llvm::bypassSlowDivision(Function &F, + Function::iterator &I, + const DenseMap &BypassTypeMap) { DivCacheTy DivCache; bool MadeChange = false; -- cgit v1.2.3