File indexing completed on 2026-05-10 08:44:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef LLVM_TRANSFORMS_SCALAR_LICM_H
0033 #define LLVM_TRANSFORMS_SCALAR_LICM_H
0034
0035 #include "llvm/Analysis/LoopAnalysisManager.h"
0036 #include "llvm/IR/PassManager.h"
0037 #include "llvm/Support/CommandLine.h"
0038
0039 namespace llvm {
0040
0041 class LPMUpdater;
0042 class Loop;
0043 class LoopNest;
0044
0045 extern cl::opt<unsigned> SetLicmMssaOptCap;
0046 extern cl::opt<unsigned> SetLicmMssaNoAccForPromotionCap;
0047
0048 struct LICMOptions {
0049 unsigned MssaOptCap;
0050 unsigned MssaNoAccForPromotionCap;
0051 bool AllowSpeculation;
0052
0053 LICMOptions()
0054 : MssaOptCap(SetLicmMssaOptCap),
0055 MssaNoAccForPromotionCap(SetLicmMssaNoAccForPromotionCap),
0056 AllowSpeculation(true) {}
0057
0058 LICMOptions(unsigned MssaOptCap, unsigned MssaNoAccForPromotionCap,
0059 bool AllowSpeculation)
0060 : MssaOptCap(MssaOptCap),
0061 MssaNoAccForPromotionCap(MssaNoAccForPromotionCap),
0062 AllowSpeculation(AllowSpeculation) {}
0063 };
0064
0065
0066 class LICMPass : public PassInfoMixin<LICMPass> {
0067 LICMOptions Opts;
0068
0069 public:
0070 LICMPass(unsigned MssaOptCap, unsigned MssaNoAccForPromotionCap,
0071 bool AllowSpeculation)
0072 : LICMPass(LICMOptions(MssaOptCap, MssaNoAccForPromotionCap,
0073 AllowSpeculation)) {}
0074 LICMPass(LICMOptions Opts) : Opts(Opts) {}
0075
0076 PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
0077 LoopStandardAnalysisResults &AR, LPMUpdater &U);
0078
0079 void printPipeline(raw_ostream &OS,
0080 function_ref<StringRef(StringRef)> MapClassName2PassName);
0081 };
0082
0083
0084 class LNICMPass : public PassInfoMixin<LNICMPass> {
0085 LICMOptions Opts;
0086
0087 public:
0088 LNICMPass(unsigned MssaOptCap, unsigned MssaNoAccForPromotionCap,
0089 bool AllowSpeculation)
0090 : LNICMPass(LICMOptions(MssaOptCap, MssaNoAccForPromotionCap,
0091 AllowSpeculation)) {}
0092 LNICMPass(LICMOptions Opts) : Opts(Opts) {}
0093
0094 PreservedAnalyses run(LoopNest &L, LoopAnalysisManager &AM,
0095 LoopStandardAnalysisResults &AR, LPMUpdater &U);
0096
0097 void printPipeline(raw_ostream &OS,
0098 function_ref<StringRef(StringRef)> MapClassName2PassName);
0099 };
0100 }
0101
0102 #endif