diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-27 23:31:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-27 23:31:14 +0000 |
commit | 3596366bed2ec5e492d994f88ea76829a0e3d657 (patch) | |
tree | 3b4f5d4f89cdaceb6a160e21138093ad5ac9550c /include | |
parent | 776885f34daeffcc814163bf1c6d53b33c99d476 (diff) | |
download | llvm-3596366bed2ec5e492d994f88ea76829a0e3d657.tar.gz llvm-3596366bed2ec5e492d994f88ea76829a0e3d657.tar.bz2 llvm-3596366bed2ec5e492d994f88ea76829a0e3d657.tar.xz |
* Use the new reduce_apply_bool template
* Expose Constant Pool Merging from ConstantProp.cpp
* Include definitions for SCCP pass
* InstListType is not neccesary anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Optimizations/AllOpts.h | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/include/llvm/Optimizations/AllOpts.h b/include/llvm/Optimizations/AllOpts.h index 31a69c4253..c68ebc48c5 100644 --- a/include/llvm/Optimizations/AllOpts.h +++ b/include/llvm/Optimizations/AllOpts.h @@ -21,8 +21,7 @@ class CallInst; // static inline bool ApplyOptToAllMethods(Module *C, bool (*Opt)(Method*)) { - return reduce_apply(C->getMethodList().begin(), C->getMethodList().end(), - bitwise_or<bool>(), false, ptr_fun(Opt)); + return reduce_apply_bool(C->begin(), C->end(), ptr_fun(Opt)); } //===----------------------------------------------------------------------===// @@ -44,6 +43,36 @@ static inline bool DoConstantPropogation(Module *C) { } //===----------------------------------------------------------------------===// +// Constant Pool Merging Pass +// +// This function merges all constants in the specified constant pool that have +// identical types and values. This is useful for passes that generate lots of +// constants as a side effect of running. +// +bool DoConstantPoolMerging(ConstantPool &CP); +bool DoConstantPoolMerging(Method *M); +static inline bool DoConstantPoolMerging(Module *M) { + return ApplyOptToAllMethods(M, DoConstantPoolMerging) | + DoConstantPoolMerging(M->getConstantPool()); +} + + +//===----------------------------------------------------------------------===// +// Sparse Conditional Constant Propogation Pass +// + +bool DoSparseConditionalConstantProp(Method *M); + +static inline bool DoSparseConditionalConstantProp(Module *M) { + return ApplyOptToAllMethods(M, DoSparseConditionalConstantProp); +} + +// Define a shorter version of the name... +template <class Unit> bool DoSCCP(Unit *M) { + return DoSparseConditionalConstantProp(M); +} + +//===----------------------------------------------------------------------===// // Method Inlining Pass // @@ -67,7 +96,7 @@ static inline bool DoMethodInlining(Module *C) { // method by one level. // bool InlineMethod(CallInst *C); -bool InlineMethod(BasicBlock::InstListType::iterator CI);// *CI must be CallInst +bool InlineMethod(BasicBlock::iterator CI); // *CI must be CallInst //===----------------------------------------------------------------------===// |