Factor some of the constants+context related code out into a separate header, to...
[oota-llvm.git] / include / llvm / Transforms / Utils / PromoteMemToReg.h
1 //===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file exposes an interface to promote alloca instructions to SSA
11 // registers, by using the SSA construction algorithm.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
16 #define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
17
18 #include <vector>
19
20 namespace llvm {
21
22 class AllocaInst;
23 class DominatorTree;
24 class DominanceFrontier;
25 class AliasSetTracker;
26 struct LLVMContext;
27
28 /// isAllocaPromotable - Return true if this alloca is legal for promotion.
29 /// This is true if there are only loads and stores to the alloca...
30 ///
31 bool isAllocaPromotable(const AllocaInst *AI);
32
33 /// PromoteMemToReg - Promote the specified list of alloca instructions into
34 /// scalar registers, inserting PHI nodes as appropriate.  This function makes
35 /// use of DominanceFrontier information.  This function does not modify the CFG
36 /// of the function at all.  All allocas must be from the same function.
37 ///
38 /// If AST is specified, the specified tracker is updated to reflect changes
39 /// made to the IR.
40 ///
41 void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
42                      DominatorTree &DT, DominanceFrontier &DF,
43                      LLVMContext &Context,
44                      AliasSetTracker *AST = 0);
45
46 } // End llvm namespace
47
48 #endif