ArgumentPromotion.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ArgumentPromotion.h - Promote by-reference arguments -----*- 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. #ifndef LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H
  14. #define LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H
  15. #include "llvm/Analysis/CGSCCPassManager.h"
  16. #include "llvm/Analysis/LazyCallGraph.h"
  17. #include "llvm/IR/PassManager.h"
  18. namespace llvm {
  19. /// Argument promotion pass.
  20. ///
  21. /// This pass walks the functions in each SCC and for each one tries to
  22. /// transform it and all of its callers to replace indirect arguments with
  23. /// direct (by-value) arguments.
  24. class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
  25. unsigned MaxElements;
  26. public:
  27. ArgumentPromotionPass(unsigned MaxElements = 2u) : MaxElements(MaxElements) {}
  28. PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
  29. LazyCallGraph &CG, CGSCCUpdateResult &UR);
  30. };
  31. } // end namespace llvm
  32. #endif // LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H
  33. #ifdef __GNUC__
  34. #pragma GCC diagnostic pop
  35. #endif