aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Transforms/Scalar/ConstantProp.h
blob: 0da13e9fdbd9ee52481b98807232b1e51807543b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//===-- ConstantProp.h - Functions for Constant Propogation ------*- C++ -*--=//
//
// This family of functions are useful for performing constant propogation.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H
#define LLVM_TRANSFORMS_SCALAR_CONSTANT_PROPOGATION_H

#include "llvm/BasicBlock.h"
class TerminatorInst;
class Pass;

//===----------------------------------------------------------------------===//
// Normal Constant Propogation Pass
//
Pass *createConstantPropogationPass();

// doConstantPropogation - Constant prop a specific instruction.  Returns true
// and potentially moves the iterator if constant propogation was performed.
//
bool doConstantPropogation(BasicBlock *BB, BasicBlock::iterator &I);

// ConstantFoldTerminator - If a terminator instruction is predicated on a
// constant value, convert it into an unconditional branch to the constant
// destination.  This is a nontrivial operation because the successors of this
// basic block must have their PHI nodes updated.
//
bool ConstantFoldTerminator(BasicBlock *BB, BasicBlock::iterator &I,
                            TerminatorInst *T);


//===----------------------------------------------------------------------===//
// Sparse Conditional Constant Propogation Pass
//
Pass *createSCCPPass();

#endif