PromoteMemToReg.h 1.7 KB

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