1 //===-- ConstantProp.h - Functions for Constant Propogation ------*- C++ -*--=//
3 // This family of functions are useful for performing constant propogation.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_OPT_CONSTANT_PROPOGATION_H
8 #define LLVM_OPT_CONSTANT_PROPOGATION_H
10 #include "llvm/Pass.h"
13 struct ConstantPropogation : public MethodPass {
14 // doConstantPropogation - Do trivial constant propogation and expression
16 static bool doConstantPropogation(Method *M);
18 // doConstantPropogation - Constant prop a specific instruction. Returns true
19 // and potentially moves the iterator if constant propogation was performed.
21 static bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);
23 inline bool runOnMethod(Method *M) {
24 return doConstantPropogation(M);
30 // ConstantFoldTerminator - If a terminator instruction is predicated on a
31 // constant value, convert it into an unconditional branch to the constant
34 bool ConstantFoldTerminator(TerminatorInst *T);
37 //===----------------------------------------------------------------------===//
38 // Sparse Conditional Constant Propogation Pass
40 struct SCCPPass : public MethodPass {
41 static bool doSCCP(Method *M);
43 inline bool runOnMethod(Method *M) {