Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / Transforms / Utils / BasicBlockUtils.h
1 //===-- Transform/Utils/BasicBlockUtils.h - BasicBlock Utils ----*- 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 manipulations on basic blocks, and
11 // instructions contained within basic blocks.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TRANSFORMS_UTILS_BASICBLOCK_H
16 #define LLVM_TRANSFORMS_UTILS_BASICBLOCK_H
17
18 // FIXME: Move to this file: BasicBlock::removePredecessor, BB::splitBasicBlock
19
20 #include "llvm/BasicBlock.h"
21 class Instruction;
22
23 // ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
24 // with a value, then remove and delete the original instruction.
25 //
26 void ReplaceInstWithValue(BasicBlock::InstListType &BIL,
27                           BasicBlock::iterator &BI, Value *V);
28
29 // ReplaceInstWithInst - Replace the instruction specified by BI with the
30 // instruction specified by I.  The original instruction is deleted and BI is
31 // updated to point to the new instruction.
32 //
33 void ReplaceInstWithInst(BasicBlock::InstListType &BIL,
34                          BasicBlock::iterator &BI, Instruction *I);
35
36 // ReplaceInstWithInst - Replace the instruction specified by From with the
37 // instruction specified by To.
38 //
39 void ReplaceInstWithInst(Instruction *From, Instruction *To);
40
41
42 // RemoveSuccessor - Change the specified terminator instruction such that its
43 // successor #SuccNum no longer exists.  Because this reduces the outgoing
44 // degree of the current basic block, the actual terminator instruction itself
45 // may have to be changed.  In the case where the last successor of the block is
46 // deleted, a return instruction is inserted in its place which can cause a
47 // suprising change in program behavior if it is not expected.
48 //
49 void RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum);
50
51 #endif