summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-01-09 06:02:20 +0000
committerChris Lattner <sabre@nondot.org>2004-01-09 06:02:20 +0000
commitd7456026629fc1760a45e6e955e9834246493147 (patch)
tree4439882743f35a55edc3808366599b8d94d763dc /lib
parent559d519549072fc7c3ca3ee5dae78733096f22c0 (diff)
downloadllvm-d7456026629fc1760a45e6e955e9834246493147.tar.gz
llvm-d7456026629fc1760a45e6e955e9834246493147.tar.bz2
llvm-d7456026629fc1760a45e6e955e9834246493147.tar.xz
Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/ConstantProp.cpp7
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp7
-rw-r--r--lib/Transforms/Scalar/DCE.cpp8
-rw-r--r--lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp21
-rw-r--r--lib/Transforms/Scalar/GCSE.cpp7
-rw-r--r--lib/Transforms/Scalar/PRE.cpp6
-rw-r--r--lib/Transforms/Scalar/PiNodeInsertion.cpp8
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp6
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp6
-rw-r--r--lib/Transforms/Scalar/SimplifyCFG.cpp7
-rw-r--r--lib/Transforms/Scalar/TailDuplication.cpp7
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp6
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp15
-rw-r--r--lib/Transforms/Utils/Mem2Reg.cpp6
14 files changed, 37 insertions, 80 deletions
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index 66e78960f7..ba084b16ea 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -26,8 +26,7 @@
#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumInstKilled("constprop", "Number of instructions killed");
@@ -43,7 +42,7 @@ namespace {
RegisterOpt<ConstantPropagation> X("constprop","Simple constant propagation");
}
-Pass *createConstantPropagationPass() {
+Pass *llvm::createConstantPropagationPass() {
return new ConstantPropagation();
}
@@ -75,5 +74,3 @@ bool ConstantPropagation::runOnFunction(Function &F) {
}
return Changed;
}
-
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index a0358b54ad..f0c4071580 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -41,8 +41,7 @@
#include "Support/PostOrderIterator.h"
#include "Support/Statistic.h"
#include <algorithm>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
@@ -285,7 +284,7 @@ namespace {
RegisterOpt<CEE> X("cee", "Correlated Expression Elimination");
}
-Pass *createCorrelatedExpressionEliminationPass() { return new CEE(); }
+Pass *llvm::createCorrelatedExpressionEliminationPass() { return new CEE(); }
bool CEE::runOnFunction(Function &F) {
@@ -1316,5 +1315,3 @@ void Relation::print(std::ostream &OS) const {
void Relation::dump() const { print(std::cerr); }
void ValueInfo::dump() const { print(std::cerr, 0); }
void RegionInfo::dump() const { print(std::cerr); }
-
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 3e63cadd3e..8d0b1db650 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -23,8 +23,7 @@
#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> DIEEliminated("die", "Number of insts removed");
@@ -54,7 +53,7 @@ namespace {
RegisterOpt<DeadInstElimination> X("die", "Dead Instruction Elimination");
}
-Pass *createDeadInstEliminationPass() {
+Pass *llvm::createDeadInstEliminationPass() {
return new DeadInstElimination();
}
@@ -122,8 +121,7 @@ bool DCE::runOnFunction(Function &F) {
return true;
}
-Pass *createDeadCodeEliminationPass() {
+Pass *llvm::createDeadCodeEliminationPass() {
return new DCE();
}
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index e110cdac8b..8fe0152ab7 100644
--- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -24,8 +24,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Pass.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumAdded("lowerrefs", "# of getelementptr instructions added");
@@ -33,17 +32,14 @@ namespace {
struct DecomposePass : public BasicBlockPass {
virtual bool runOnBasicBlock(BasicBlock &BB);
};
+ RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
+ "structure/array references");
}
-RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
- "structure/array references");
-
// runOnBasicBlock - Entry point for array or structure references with multiple
// indices.
//
-bool
-DecomposePass::runOnBasicBlock(BasicBlock &BB)
-{
+bool DecomposePass::runOnBasicBlock(BasicBlock &BB) {
bool changed = false;
for (BasicBlock::iterator II = BB.begin(); II != BB.end(); )
if (GetElementPtrInst *gep = dyn_cast<GetElementPtrInst>(II++)) // pre-inc
@@ -52,9 +48,7 @@ DecomposePass::runOnBasicBlock(BasicBlock &BB)
return changed;
}
-FunctionPass
-*createDecomposeMultiDimRefsPass()
-{
+FunctionPass *llvm::createDecomposeMultiDimRefsPass() {
return new DecomposePass();
}
@@ -81,9 +75,7 @@ FunctionPass
//
// Return value: true if the instruction was replaced; false otherwise.
//
-bool
-DecomposeArrayRef(GetElementPtrInst* GEP)
-{
+bool llvm::DecomposeArrayRef(GetElementPtrInst* GEP) {
if (GEP->getNumIndices() < 2)
return false;
@@ -135,4 +127,3 @@ DecomposeArrayRef(GetElementPtrInst* GEP)
return true;
}
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index b00d3005bf..3d700cb4da 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -22,8 +22,7 @@
#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <algorithm>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumInstRemoved("gcse", "Number of instructions removed");
@@ -56,7 +55,7 @@ namespace {
}
// createGCSEPass - The public interface to this file...
-FunctionPass *createGCSEPass() { return new GCSE(); }
+FunctionPass *llvm::createGCSEPass() { return new GCSE(); }
// GCSE::runOnFunction - This is the main transformation entry point for a
// function.
@@ -270,5 +269,3 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
return Ret;
}
-
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/PRE.cpp b/lib/Transforms/Scalar/PRE.cpp
index 770cd44d75..88d9143d07 100644
--- a/lib/Transforms/Scalar/PRE.cpp
+++ b/lib/Transforms/Scalar/PRE.cpp
@@ -35,13 +35,12 @@
#include "Support/PostOrderIterator.h"
#include "Support/Statistic.h"
#include "Support/hash_set"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumExprsEliminated("pre", "Number of expressions constantified");
Statistic<> NumRedundant ("pre", "Number of redundant exprs eliminated");
- static Statistic<> NumInserted ("pre", "Number of expressions inserted");
+ Statistic<> NumInserted ("pre", "Number of expressions inserted");
struct PRE : public FunctionPass {
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -633,4 +632,3 @@ bool PRE::ProcessExpression(Instruction *Expr) {
return Changed;
}
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp
index 89ec20e069..d8fd554de4 100644
--- a/lib/Transforms/Scalar/PiNodeInsertion.cpp
+++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp
@@ -41,8 +41,7 @@
#include "llvm/iPHINode.h"
#include "llvm/Support/CFG.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumInserted("pinodes", "Number of Pi nodes inserted");
@@ -66,7 +65,7 @@ namespace {
RegisterOpt<PiNodeInserter> X("pinodes", "Pi Node Insertion");
}
-Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
+Pass *llvm::createPiNodeInsertionPass() { return new PiNodeInserter(); }
bool PiNodeInserter::runOnFunction(Function &F) {
@@ -183,6 +182,3 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) {
++NumInserted;
return true;
}
-
-
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 9e22ec4e7e..99cd7f3165 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -33,8 +33,7 @@
#include "Support/Debug.h"
#include "Support/PostOrderIterator.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumLinear ("reassociate","Number of insts linearized");
@@ -61,7 +60,7 @@ namespace {
}
// Public interface to the Reassociate pass
-FunctionPass *createReassociatePass() { return new Reassociate(); }
+FunctionPass *llvm::createReassociatePass() { return new Reassociate(); }
void Reassociate::BuildRankMap(Function &F) {
unsigned i = 2;
@@ -295,4 +294,3 @@ bool Reassociate::runOnFunction(Function &F) {
return Changed;
}
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 44a553a01b..ee6a175278 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -32,8 +32,7 @@
#include "Support/STLExtras.h"
#include <algorithm>
#include <set>
-
-namespace llvm {
+using namespace llvm;
// InstVal class - This class represents the different lattice values that an
// instruction may occupy. It is a simple class with value semantics.
@@ -255,7 +254,7 @@ private:
// createSCCPPass - This is the public interface to this file...
-Pass *createSCCPPass() {
+Pass *llvm::createSCCPPass() {
return new SCCP();
}
@@ -587,4 +586,3 @@ void SCCP::visitGetElementPtrInst(GetElementPtrInst &I) {
markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Operands));
}
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp
index 5a8d428153..8e0f7d3307 100644
--- a/lib/Transforms/Scalar/SimplifyCFG.cpp
+++ b/lib/Transforms/Scalar/SimplifyCFG.cpp
@@ -25,8 +25,7 @@
#include "llvm/Pass.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified");
@@ -38,7 +37,7 @@ namespace {
}
// Public interface to the CFGSimplification pass
-FunctionPass *createCFGSimplificationPass() {
+FunctionPass *llvm::createCFGSimplificationPass() {
return new CFGSimplifyPass();
}
@@ -103,5 +102,3 @@ bool CFGSimplifyPass::runOnFunction(Function &F) {
return Changed;
}
-
-} // End llvm namespace
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp
index 07a3b1e492..95226a2503 100644
--- a/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/lib/Transforms/Scalar/TailDuplication.cpp
@@ -30,8 +30,7 @@
#include "llvm/Transforms/Utils/Local.h"
#include "Support/Debug.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumEliminated("tailduplicate",
@@ -56,7 +55,7 @@ namespace {
}
// Public interface to the Tail Duplication pass
-Pass *createTailDuplicationPass() { return new TailDup(); }
+Pass *llvm::createTailDuplicationPass() { return new TailDup(); }
/// runOnFunction - Top level algorithm - Loop over each unconditional branch in
/// the function, eliminating it if it looks attractive enough.
@@ -342,5 +341,3 @@ Value *TailDup::GetValueOutBlock(BasicBlock *BB, Value *OrigVal,
return GetValueInBlock(BB, OrigVal, ValueMap, OutValueMap);
}
-
-} // End llvm namespace
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index eea800ad54..222ca74ed1 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -21,8 +21,7 @@
#include "llvm/Pass.h"
#include "llvm/Target/TargetData.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumLowered("lowerallocs", "Number of allocations lowered");
@@ -56,7 +55,7 @@ namespace {
}
// createLowerAllocationsPass - Interface to this file...
-FunctionPass *createLowerAllocationsPass() {
+FunctionPass *llvm::createLowerAllocationsPass() {
return new LowerAllocations();
}
@@ -134,4 +133,3 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock &BB) {
return Changed;
}
-} // End llvm namespace
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index 24e48d4c5d..f6e6886bb5 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -22,8 +22,7 @@
#include "llvm/Pass.h"
#include "Support/Debug.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumLowered("lowerswitch", "Number of SwitchInst's replaced");
@@ -62,7 +61,7 @@ namespace {
}
// createLowerSwitchPass - Interface to this file...
-FunctionPass *createLowerSwitchPass() {
+FunctionPass *llvm::createLowerSwitchPass() {
return new LowerSwitch();
}
@@ -83,12 +82,12 @@ bool LowerSwitch::runOnFunction(Function &F) {
// operator<< - Used for debugging purposes.
//
-std::ostream& operator << (std::ostream& O, std::vector<LowerSwitch::Case>& C)
-{
+std::ostream& operator<<(std::ostream &O,
+ const std::vector<LowerSwitch::Case> &C) {
O << "[";
- for (std::vector<LowerSwitch::Case>::iterator B = C.begin(), E = C.end();
- B != E; ) {
+ for (std::vector<LowerSwitch::Case>::const_iterator B = C.begin(),
+ E = C.end(); B != E; ) {
O << *B->first;
if (++B != E) O << ", ";
}
@@ -224,5 +223,3 @@ void LowerSwitch::processSwitchInst(SwitchInst *SI) {
// We are now done with the switch instruction, delete it.
delete SI;
}
-
-} // End llvm namespace
diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp
index 4d99280805..0e411d2166 100644
--- a/lib/Transforms/Utils/Mem2Reg.cpp
+++ b/lib/Transforms/Utils/Mem2Reg.cpp
@@ -19,8 +19,7 @@
#include "llvm/Function.h"
#include "llvm/Target/TargetData.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumPromoted("mem2reg", "Number of alloca's promoted");
@@ -77,8 +76,7 @@ bool PromotePass::runOnFunction(Function &F) {
// createPromoteMemoryToRegister - Provide an entry point to create this pass.
//
-Pass *createPromoteMemoryToRegister() {
+Pass *llvm::createPromoteMemoryToRegister() {
return new PromotePass();
}
-} // End llvm namespace