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 LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
00016 #define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
00017 
00018 #include "llvm/ADT/ArrayRef.h"
00019 
00020 namespace llvm {
00021 
00022 class AllocaInst;
00023 class DominatorTree;
00024 class AliasSetTracker;
00025 class AssumptionTracker;
00026 
00027 /// \brief Return true if this alloca is legal for promotion.
00028 ///
00029 /// This is true if there are only loads, stores, and lifetime markers
00030 /// (transitively) using this alloca. This also enforces that there is only
00031 /// ever one layer of bitcasts or GEPs between the alloca and the lifetime
00032 /// markers.
00033 bool isAllocaPromotable(const AllocaInst *AI);
00034 
00035 /// \brief Promote the specified list of alloca instructions into scalar
00036 /// registers, inserting PHI nodes as appropriate.
00037 ///
00038 /// This function makes use of DominanceFrontier information.  This function
00039 /// does not modify the CFG of the function at all.  All allocas must be from
00040 /// the same function.
00041 ///
00042 /// If AST is specified, the specified tracker is updated to reflect changes
00043 /// made to the IR.
00044 void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
00045                      AliasSetTracker *AST = nullptr,
00046                      AssumptionTracker *AT = nullptr);
00047 
00048 } // End llvm namespace
00049 
00050 #endif