ArgumentPromotion.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. class TargetTransformInfo;
  20. /// Argument promotion pass.
  21. ///
  22. /// This pass walks the functions in each SCC and for each one tries to
  23. /// transform it and all of its callers to replace indirect arguments with
  24. /// direct (by-value) arguments.
  25. class ArgumentPromotionPass : public PassInfoMixin<ArgumentPromotionPass> {
  26. unsigned MaxElements;
  27. public:
  28. ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {}
  29. /// Checks if a type could have padding bytes.
  30. static bool isDenselyPacked(Type *type, const DataLayout &DL);
  31. PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM,
  32. LazyCallGraph &CG, CGSCCUpdateResult &UR);
  33. };
  34. } // end namespace llvm
  35. #endif // LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H
  36. #ifdef __GNUC__
  37. #pragma GCC diagnostic pop
  38. #endif