Home | History | Annotate | Download | only in Utils
      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 LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
     16 #define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
     17 
     18 namespace llvm {
     19 
     20 template <typename T> class ArrayRef;
     21 class AllocaInst;
     22 class DominatorTree;
     23 class AliasSetTracker;
     24 class AssumptionCache;
     25 
     26 /// \brief Return true if this alloca is legal for promotion.
     27 ///
     28 /// This is true if there are only loads, stores, and lifetime markers
     29 /// (transitively) using this alloca. This also enforces that there is only
     30 /// ever one layer of bitcasts or GEPs between the alloca and the lifetime
     31 /// markers.
     32 bool isAllocaPromotable(const AllocaInst *AI);
     33 
     34 /// \brief Promote the specified list of alloca instructions into scalar
     35 /// registers, inserting PHI nodes as appropriate.
     36 ///
     37 /// This function makes use of DominanceFrontier information.  This function
     38 /// does not modify the CFG of the function at all.  All allocas must be from
     39 /// the same function.
     40 ///
     41 void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
     42                      AssumptionCache *AC = nullptr);
     43 
     44 } // End llvm namespace
     45 
     46 #endif
     47