mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that are to show up in opt or analyze * Register Analyses now * Change optimizations to use RegisterOpt instead of RegisterPass * Add support for different "PassType's" * Add new RegisterOpt/RegisterAnalysis templates for registering passes that are to show up in opt or analyze * Register Analyses now * Change optimizations to use RegisterOpt instead of RegisterPass * Remove getPassName implementations from various subclasses git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3113 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1e43516dcf
commit
a6275ccdf5
@ -23,6 +23,8 @@
|
|||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
|
|
||||||
|
static RegisterAnalysis<FindUnsafePointerTypes>
|
||||||
|
X("unsafepointertypes", "Find Unsafe Pointer Types");
|
||||||
AnalysisID FindUnsafePointerTypes::ID(AnalysisID::create<FindUnsafePointerTypes>());
|
AnalysisID FindUnsafePointerTypes::ID(AnalysisID::create<FindUnsafePointerTypes>());
|
||||||
|
|
||||||
// Provide a command line option to turn on printing of which instructions cause
|
// Provide a command line option to turn on printing of which instructions cause
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
|
|
||||||
|
static RegisterAnalysis<FindUsedTypes>
|
||||||
|
X("printusedtypes", "Find Used Types");
|
||||||
AnalysisID FindUsedTypes::ID(AnalysisID::create<FindUsedTypes>());
|
AnalysisID FindUsedTypes::ID(AnalysisID::create<FindUsedTypes>());
|
||||||
|
|
||||||
// IncorporateType - Incorporate one type and all of its subtypes into the
|
// IncorporateType - Incorporate one type and all of its subtypes into the
|
||||||
|
@ -261,7 +261,7 @@ namespace {
|
|||||||
return doFunctionInlining(F);
|
return doFunctionInlining(F);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RegisterPass<FunctionInlining> X("inline", "Function Integration/Inlining");
|
RegisterOpt<FunctionInlining> X("inline", "Function Integration/Inlining");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createFunctionInliningPass() { return new FunctionInlining(); }
|
Pass *createFunctionInliningPass() { return new FunctionInlining(); }
|
||||||
|
@ -39,8 +39,8 @@ public:
|
|||||||
bool runOnBasicBlock(BasicBlock &BB);
|
bool runOnBasicBlock(BasicBlock &BB);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<RaiseAllocations>
|
RegisterOpt<RaiseAllocations>
|
||||||
X("raiseallocs", "Raise allocations from calls to instructions");
|
X("raiseallocs", "Raise allocations from calls to instructions");
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace {
|
|||||||
bool run(Module &M);
|
bool run(Module &M);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
|
RegisterOpt<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new pass to add function table
|
// Create a new pass to add function table
|
||||||
|
@ -97,8 +97,8 @@ namespace {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Register the passes...
|
// Register the passes...
|
||||||
RegisterPass<FunctionTracer> X("tracem","Insert Function trace code only");
|
RegisterOpt<FunctionTracer> X("tracem","Insert Function trace code only");
|
||||||
RegisterPass<BasicBlockTracer> Y("trace","Insert BB and Function trace code");
|
RegisterOpt<BasicBlockTracer> Y("trace","Insert BB and Function trace code");
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -545,5 +545,5 @@ Pass *createRaisePointerReferencesPass(const TargetData &TD) {
|
|||||||
return new RaisePointerReferences(TD);
|
return new RaisePointerReferences(TD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPass<RaisePointerReferences>
|
static RegisterOpt<RaisePointerReferences>
|
||||||
X("raise", "Raise Pointer References", createRaisePointerReferencesPass);
|
X("raise", "Raise Pointer References", createRaisePointerReferencesPass);
|
||||||
|
@ -84,7 +84,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
|
RegisterOpt<ADCE> X("adce", "Aggressive Dead Code Elimination");
|
||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
|
|
||||||
Pass *createAggressiveDCEPass() { return new ADCE(); }
|
Pass *createAggressiveDCEPass() { return new ADCE(); }
|
||||||
|
@ -31,7 +31,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<ConstantPropogation> X("constprop", "Simple constant propogation");
|
RegisterOpt<ConstantPropogation> X("constprop","Simple constant propogation");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createConstantPropogationPass() {
|
Pass *createConstantPropogationPass() {
|
||||||
|
@ -42,7 +42,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
|
RegisterOpt<DeadInstElimination> X("die", "Dead Instruction Elimination");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createDeadInstEliminationPass() {
|
Pass *createDeadInstEliminationPass() {
|
||||||
@ -64,7 +64,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<DCE> Y("dce", "Dead Code Elimination");
|
RegisterOpt<DCE> Y("dce", "Dead Code Elimination");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DCE::runOnFunction(Function &F) {
|
bool DCE::runOnFunction(Function &F) {
|
||||||
|
@ -27,7 +27,7 @@ namespace {
|
|||||||
static void decomposeArrayRef(BasicBlock::iterator &BBI);
|
static void decomposeArrayRef(BasicBlock::iterator &BBI);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
|
RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
|
||||||
"structure/array references");
|
"structure/array references");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
|
RegisterOpt<GCSE> X("gcse", "Global Common Subexpression Elimination");
|
||||||
}
|
}
|
||||||
|
|
||||||
// createGCSEPass - The public interface to this file...
|
// createGCSEPass - The public interface to this file...
|
||||||
|
@ -198,7 +198,7 @@ namespace {
|
|||||||
AU.preservesCFG();
|
AU.preservesCFG();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RegisterPass<InductionVariableSimplify> X("indvars",
|
RegisterOpt<InductionVariableSimplify> X("indvars",
|
||||||
"Cannonicalize Induction Variables");
|
"Cannonicalize Induction Variables");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace {
|
|||||||
Instruction *visitInstruction(Instruction &I) { return 0; }
|
Instruction *visitInstruction(Instruction &I) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
|
RegisterOpt<InstCombiner> X("instcombine", "Combine redundant instructions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
|
RegisterOpt<LICM> X("licm", "Loop Invariant Code Motion");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createLICMPass() { return new LICM(); }
|
Pass *createLICMPass() { return new LICM(); }
|
||||||
|
@ -55,7 +55,7 @@ namespace {
|
|||||||
bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
|
bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<PiNodeInserter> X("pinodes", "Pi Node Insertion");
|
RegisterOpt<PiNodeInserter> X("pinodes", "Pi Node Insertion");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
|
Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
|
||||||
|
@ -47,7 +47,7 @@ namespace {
|
|||||||
bool ReassociateBB(BasicBlock *BB);
|
bool ReassociateBB(BasicBlock *BB);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
|
RegisterOpt<Reassociate> X("reassociate", "Reassociate expressions");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createReassociatePass() { return new Reassociate(); }
|
Pass *createReassociatePass() { return new Reassociate(); }
|
||||||
|
@ -220,7 +220,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
|
RegisterOpt<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace {
|
|||||||
struct CFGSimplifyPass : public FunctionPass {
|
struct CFGSimplifyPass : public FunctionPass {
|
||||||
virtual bool runOnFunction(Function &F);
|
virtual bool runOnFunction(Function &F);
|
||||||
};
|
};
|
||||||
RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
|
RegisterOpt<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pass *createCFGSimplificationPass() {
|
Pass *createCFGSimplificationPass() {
|
||||||
|
@ -51,14 +51,14 @@ namespace {
|
|||||||
AU.setPreservesAll();
|
AU.setPreservesAll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RegisterPass<SymbolStripping> X("strip", "Strip symbols from functions");
|
RegisterOpt<SymbolStripping> X("strip", "Strip symbols from functions");
|
||||||
|
|
||||||
struct FullSymbolStripping : public SymbolStripping {
|
struct FullSymbolStripping : public SymbolStripping {
|
||||||
virtual bool doInitialization(Module &M) {
|
virtual bool doInitialization(Module &M) {
|
||||||
return StripSymbolTable(M.getSymbolTable());
|
return StripSymbolTable(M.getSymbolTable());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
RegisterPass<FullSymbolStripping> Y("mstrip",
|
RegisterOpt<FullSymbolStripping> Y("mstrip",
|
||||||
"Strip symbols from module and functions");
|
"Strip symbols from module and functions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Pass *createLowerAllocationsPass(const TargetData &TD) {
|
|||||||
return new LowerAllocations(TD);
|
return new LowerAllocations(TD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RegisterPass<LowerAllocations>
|
static RegisterOpt<LowerAllocations>
|
||||||
X("lowerallocs", "Lower allocations from instructions to calls (TD)",
|
X("lowerallocs", "Lower allocations from instructions to calls (TD)",
|
||||||
createLowerAllocationsPass);
|
createLowerAllocationsPass);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ namespace {
|
|||||||
void FindSafeAllocas(Function &F);
|
void FindSafeAllocas(Function &F);
|
||||||
};
|
};
|
||||||
|
|
||||||
RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
|
RegisterOpt<PromotePass> X("mem2reg", "Promote Memory to Register");
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,8 +29,10 @@ using std::map;
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
static RegisterPass<PrintModulePass> X("printm", "Print module to stderr");
|
static RegisterPass<PrintModulePass>
|
||||||
static RegisterPass<PrintFunctionPass> Y("print", "Print function to stderr");
|
X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization);
|
||||||
|
static RegisterPass<PrintFunctionPass>
|
||||||
|
Y("print","Print function to stderr",PassInfo::Analysis|PassInfo::Optimization);
|
||||||
|
|
||||||
static void WriteAsOperandInternal(ostream &Out, const Value *V, bool PrintName,
|
static void WriteAsOperandInternal(ostream &Out, const Value *V, bool PrintName,
|
||||||
map<const Type *, string> &TypeTable,
|
map<const Type *, string> &TypeTable,
|
||||||
|
Loading…
Reference in New Issue
Block a user