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 : public PassInfoMixin<ArgumentPromotionPass> { 24 unsigned MaxElements; 25 26 public: MaxElements(MaxElements)27 ArgumentPromotionPass(unsigned MaxElements = 3u) : MaxElements(MaxElements) {} 28 29 PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager &AM, 30 LazyCallGraph &CG, CGSCCUpdateResult &UR); 31 }; 32 33 } // end namespace llvm 34 35 #endif // LLVM_TRANSFORMS_IPO_ARGUMENTPROMOTION_H 36