Move stuff out of the Optimizations directories into the appropriate Transforms
[oota-llvm.git] / include / llvm / Transforms / Scalar / ConstantProp.h
1 //===-- ConstantProp.h - Functions for Constant Propogation ------*- C++ -*--=//
2 //
3 // This family of functions are useful for performing constant propogation.
4 //
5 //===----------------------------------------------------------------------===//
6
7 #ifndef LLVM_OPT_CONSTANT_PROPOGATION_H
8 #define LLVM_OPT_CONSTANT_PROPOGATION_H
9
10 #include "llvm/Pass.h"
11 class TerminatorInst;
12
13 struct ConstantPropogation : public MethodPass {
14   // doConstantPropogation - Do trivial constant propogation and expression
15   // folding
16   static bool doConstantPropogation(Method *M);
17
18   // doConstantPropogation - Constant prop a specific instruction.  Returns true
19   // and potentially moves the iterator if constant propogation was performed.
20   //
21   static bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);
22
23   inline bool runOnMethod(Method *M) {
24     return doConstantPropogation(M);
25   }
26 };
27
28
29
30 // ConstantFoldTerminator - If a terminator instruction is predicated on a
31 // constant value, convert it into an unconditional branch to the constant
32 // destination.
33 //
34 bool ConstantFoldTerminator(TerminatorInst *T);
35
36
37 //===----------------------------------------------------------------------===//
38 // Sparse Conditional Constant Propogation Pass
39 //
40 struct SCCPPass : public MethodPass {
41   static bool doSCCP(Method *M);
42
43   inline bool runOnMethod(Method *M) {
44     return doSCCP(M);
45   }
46 };
47
48 #endif