LLVM API Documentation

PromoteMemToReg.h

Go to the documentation of this file.
00001 //===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file exposes an interface to promote alloca instructions to SSA
00011 // registers, by using the SSA construction algorithm.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
00016 #define TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
00017 
00018 #include <vector>
00019 
00020 namespace llvm {
00021 
00022 class AllocaInst;
00023 class DominatorTree;
00024 class DominanceFrontier;
00025 class AliasSetTracker;
00026 
00027 /// isAllocaPromotable - Return true if this alloca is legal for promotion.
00028 /// This is true if there are only loads and stores to the alloca...
00029 ///
00030 bool isAllocaPromotable(const AllocaInst *AI);
00031 
00032 /// PromoteMemToReg - Promote the specified list of alloca instructions into
00033 /// scalar registers, inserting PHI nodes as appropriate.  This function makes
00034 /// use of DominanceFrontier information.  This function does not modify the CFG
00035 /// of the function at all.  All allocas must be from the same function.
00036 ///
00037 /// If AST is specified, the specified tracker is updated to reflect changes
00038 /// made to the IR.
00039 ///
00040 void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
00041                      DominatorTree &DT, DominanceFrontier &DF,
00042                      AliasSetTracker *AST = 0);
00043 
00044 } // End llvm namespace
00045 
00046 #endif