| 1 | //===- ArgumentPromotion.h - Promote by-reference arguments -----*- C++ -*-===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #ifndef LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H |
| 10 | #define LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H |
| 11 | |
| 12 | #include "llvm/Analysis/CGSCCPassManager.h" |
| 13 | #include "llvm/Analysis/LazyCallGraph.h" |
| 14 | #include "llvm/IR/PassManager.h" |
| 15 | |
| 16 | namespace llvm { |
| 17 | |
| 18 | /// Argument promotion pass. |
| 19 | /// |
| 20 | /// This pass walks the functions in each SCC and for each one tries to |
| 21 | /// transform it and all of its callers to replace indirect arguments with |
| 22 | /// direct (by-value) arguments. |
| 23 | class ArgumentPromotionPass |
| 24 | : public OptionalPassInfoMixin<ArgumentPromotionPass> { |
| 25 | unsigned MaxElements; |
| 26 | |
| 27 | public: |
| 28 | ArgumentPromotionPass(unsigned MaxElements = 2u) : MaxElements(MaxElements) {} |
| 29 | |
| 30 | LLVM_ABI PreservedAnalyses run(LazyCallGraph::SCC &C, |
| 31 | CGSCCAnalysisManager &AM, LazyCallGraph &CG, |
| 32 | CGSCCUpdateResult &UR); |
| 33 | }; |
| 34 | |
| 35 | } // end namespace llvm |
| 36 | |
| 37 | #endif // LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H |
| 38 |