#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumInstKilled("constprop", "Number of instructions killed");
RegisterOpt<ConstantPropagation> X("constprop","Simple constant propagation");
}
-Pass *createConstantPropagationPass() {
+Pass *llvm::createConstantPropagationPass() {
return new ConstantPropagation();
}
}
return Changed;
}
-
-} // End llvm namespace
#include "Support/PostOrderIterator.h"
#include "Support/Statistic.h"
#include <algorithm>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumSetCCRemoved("cee", "Number of setcc instruction eliminated");
RegisterOpt<CEE> X("cee", "Correlated Expression Elimination");
}
-Pass *createCorrelatedExpressionEliminationPass() { return new CEE(); }
+Pass *llvm::createCorrelatedExpressionEliminationPass() { return new CEE(); }
bool CEE::runOnFunction(Function &F) {
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
#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> DIEEliminated("die", "Number of insts removed");
RegisterOpt<DeadInstElimination> X("die", "Dead Instruction Elimination");
}
-Pass *createDeadInstEliminationPass() {
+Pass *llvm::createDeadInstEliminationPass() {
return new DeadInstElimination();
}
return true;
}
-Pass *createDeadCodeEliminationPass() {
+Pass *llvm::createDeadCodeEliminationPass() {
return new DCE();
}
-} // End llvm namespace
#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");
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
return changed;
}
-FunctionPass
-*createDecomposeMultiDimRefsPass()
-{
+FunctionPass *llvm::createDecomposeMultiDimRefsPass() {
return new DecomposePass();
}
//
// 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;
return true;
}
-} // End llvm namespace
#include "llvm/Support/InstIterator.h"
#include "Support/Statistic.h"
#include <algorithm>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumInstRemoved("gcse", "Number of instructions removed");
}
// 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.
return Ret;
}
-
-} // End llvm namespace
#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 {
return Changed;
}
-} // End llvm namespace
#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");
RegisterOpt<PiNodeInserter> X("pinodes", "Pi Node Insertion");
}
-Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
+Pass *llvm::createPiNodeInsertionPass() { return new PiNodeInserter(); }
bool PiNodeInserter::runOnFunction(Function &F) {
++NumInserted;
return true;
}
-
-
-} // End llvm namespace
#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");
}
// 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;
return Changed;
}
-} // End llvm namespace
#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.
// createSCCPPass - This is the public interface to this file...
-Pass *createSCCPPass() {
+Pass *llvm::createSCCPPass() {
return new SCCP();
}
markConstant(&I, ConstantExpr::getGetElementPtr(Ptr, Operands));
}
-} // End llvm namespace
#include "llvm/Pass.h"
#include "Support/Statistic.h"
#include <set>
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumSimpl("cfgsimplify", "Number of blocks simplified");
}
// Public interface to the CFGSimplification pass
-FunctionPass *createCFGSimplificationPass() {
+FunctionPass *llvm::createCFGSimplificationPass() {
return new CFGSimplifyPass();
}
return Changed;
}
-
-} // End llvm namespace
#include "llvm/Transforms/Utils/Local.h"
#include "Support/Debug.h"
#include "Support/Statistic.h"
-
-namespace llvm {
+using namespace llvm;
namespace {
Statistic<> NumEliminated("tailduplicate",
}
// 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.
return GetValueInBlock(BB, OrigVal, ValueMap, OutValueMap);
}
-
-} // End llvm namespace
#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");
}
// createLowerAllocationsPass - Interface to this file...
-FunctionPass *createLowerAllocationsPass() {
+FunctionPass *llvm::createLowerAllocationsPass() {
return new LowerAllocations();
}
return Changed;
}
-} // End llvm namespace
#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");
}
// createLowerSwitchPass - Interface to this file...
-FunctionPass *createLowerSwitchPass() {
+FunctionPass *llvm::createLowerSwitchPass() {
return new LowerSwitch();
}
// 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 << ", ";
}
// We are now done with the switch instruction, delete it.
delete SI;
}
-
-} // End llvm namespace
#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");
// createPromoteMemoryToRegister - Provide an entry point to create this pass.
//
-Pass *createPromoteMemoryToRegister() {
+Pass *llvm::createPromoteMemoryToRegister() {
return new PromotePass();
}
-} // End llvm namespace