PromoteMemToReg.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file exposes an interface to promote alloca instructions to SSA
  15. // registers, by using the SSA construction algorithm.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
  19. #define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
  20. namespace llvm {
  21. template <typename T> class ArrayRef;
  22. class AllocaInst;
  23. class DominatorTree;
  24. class AssumptionCache;
  25. /// Return true if this alloca is legal for promotion.
  26. ///
  27. /// This is true if there are only loads, stores, and lifetime markers
  28. /// (transitively) using this alloca. This also enforces that there is only
  29. /// ever one layer of bitcasts or GEPs between the alloca and the lifetime
  30. /// markers.
  31. bool isAllocaPromotable(const AllocaInst *AI);
  32. /// Promote the specified list of alloca instructions into scalar
  33. /// registers, inserting PHI nodes as appropriate.
  34. ///
  35. /// This function makes use of DominanceFrontier information. This function
  36. /// does not modify the CFG of the function at all. All allocas must be from
  37. /// the same function.
  38. ///
  39. void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
  40. AssumptionCache *AC = nullptr);
  41. } // End llvm namespace
  42. #endif
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif