Put all LLVM code into the llvm namespace, as per bug 109.
[oota-llvm.git] / include / llvm / Transforms / Utils / Local.h
1 //===-- Local.h - Functions to perform local transformations ----*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This family of functions perform various local transformations to the
11 // program.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TRANSFORMS_UTILS_LOCAL_H
16 #define LLVM_TRANSFORMS_UTILS_LOCAL_H
17
18 #include "llvm/Function.h"
19
20 namespace llvm {
21
22 class Pass;
23
24 //===----------------------------------------------------------------------===//
25 //  Local constant propagation...
26 //
27
28 /// doConstantPropagation - Constant prop a specific instruction.  Returns true
29 /// and potentially moves the iterator if constant propagation was performed.
30 ///
31 bool doConstantPropagation(BasicBlock::iterator &I);
32
33 /// ConstantFoldTerminator - If a terminator instruction is predicated on a
34 /// constant value, convert it into an unconditional branch to the constant
35 /// destination.  This is a nontrivial operation because the successors of this
36 /// basic block must have their PHI nodes updated.
37 ///
38 bool ConstantFoldTerminator(BasicBlock *BB);
39
40
41 //===----------------------------------------------------------------------===//
42 //  Local dead code elimination...
43 //
44
45 /// isInstructionTriviallyDead - Return true if the result produced by the
46 /// instruction is not used, and the instruction has no side effects.
47 ///
48 bool isInstructionTriviallyDead(Instruction *I);
49
50
51 /// dceInstruction - Inspect the instruction at *BBI and figure out if it
52 /// isTriviallyDead.  If so, remove the instruction and update the iterator to
53 /// point to the instruction that immediately succeeded the original
54 /// instruction.
55 ///
56 bool dceInstruction(BasicBlock::iterator &BBI);
57
58
59 //===----------------------------------------------------------------------===//
60 //  Control Flow Graph Restructuring...
61 //
62
63 /// SimplifyCFG - This function is used to do simplification of a CFG.  For
64 /// example, it adjusts branches to branches to eliminate the extra hop, it
65 /// eliminates unreachable basic blocks, and does other "peephole" optimization
66 /// of the CFG.  It returns true if a modification was made, possibly deleting
67 /// the basic block that was pointed to.
68 ///
69 /// WARNING:  The entry node of a method may not be simplified.
70 ///
71 bool SimplifyCFG(BasicBlock *BB);
72
73 } // End llvm namespace
74
75 #endif