Branch data Line data Source code
1 : : // This file is a part of Julia. License is MIT: https://julialang.org/license 2 : : 3 : : #ifndef JL_PASSES_H 4 : : #define JL_PASSES_H 5 : : 6 : : #include <llvm/IR/PassManager.h> 7 : : #include <llvm/Transforms/Scalar/LoopPassManager.h> 8 : : 9 : : using namespace llvm; 10 : : 11 : : // Function Passes 12 : : struct DemoteFloat16 : PassInfoMixin<DemoteFloat16> { 13 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 14 : 0 : static bool isRequired() { return true; } 15 : : }; 16 : : 17 : : struct CombineMulAdd : PassInfoMixin<CombineMulAdd> { 18 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 19 : : }; 20 : : 21 : : struct LateLowerGC : PassInfoMixin<LateLowerGC> { 22 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 23 : 0 : static bool isRequired() { return true; } 24 : : }; 25 : : 26 : : struct AllocOptPass : PassInfoMixin<AllocOptPass> { 27 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 28 : : }; 29 : : 30 : : struct PropagateJuliaAddrspacesPass : PassInfoMixin<PropagateJuliaAddrspacesPass> { 31 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 32 : 0 : static bool isRequired() { return true; } 33 : : }; 34 : : 35 : : struct LowerExcHandlers : PassInfoMixin<LowerExcHandlers> { 36 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 37 : 0 : static bool isRequired() { return true; } 38 : : }; 39 : : 40 : : struct GCInvariantVerifierPass : PassInfoMixin<GCInvariantVerifierPass> { 41 : : bool Strong; 42 : 0 : GCInvariantVerifierPass(bool Strong = false) : Strong(Strong) {} 43 : : 44 : : PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 45 : 0 : static bool isRequired() { return true; } 46 : : }; 47 : : 48 : : // Module Passes 49 : : struct CPUFeatures : PassInfoMixin<CPUFeatures> { 50 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 51 : 0 : static bool isRequired() { return true; } 52 : : }; 53 : : 54 : : struct RemoveNI : PassInfoMixin<RemoveNI> { 55 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 56 : : }; 57 : : 58 : : struct LowerSIMDLoop : PassInfoMixin<LowerSIMDLoop> { 59 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 60 : : }; 61 : : 62 : : struct FinalLowerGCPass : PassInfoMixin<FinalLowerGCPass> { 63 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 64 : 0 : static bool isRequired() { return true; } 65 : : }; 66 : : 67 : : struct MultiVersioning : PassInfoMixin<MultiVersioning> { 68 : : bool external_use; 69 : 0 : MultiVersioning(bool external_use = false) : external_use(external_use) {} 70 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 71 : 0 : static bool isRequired() { return true; } 72 : : }; 73 : : 74 : : struct RemoveJuliaAddrspacesPass : PassInfoMixin<RemoveJuliaAddrspacesPass> { 75 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 76 : 0 : static bool isRequired() { return true; } 77 : : }; 78 : : 79 : : struct RemoveAddrspacesPass : PassInfoMixin<RemoveAddrspacesPass> { 80 : : std::function<unsigned(unsigned)> ASRemapper; 81 : : RemoveAddrspacesPass(); 82 : 0 : RemoveAddrspacesPass(std::function<unsigned(unsigned)> ASRemapper) : ASRemapper(std::move(ASRemapper)) {} 83 : : 84 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 85 : : static bool isRequired() { return true; } 86 : : }; 87 : : 88 : : struct LowerPTLSPass : PassInfoMixin<LowerPTLSPass> { 89 : : bool imaging_mode; 90 : 0 : LowerPTLSPass(bool imaging_mode=false) : imaging_mode(imaging_mode) {} 91 : : 92 : : PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 93 : 0 : static bool isRequired() { return true; } 94 : : }; 95 : : 96 : : // Loop Passes 97 : : struct JuliaLICMPass : PassInfoMixin<JuliaLICMPass> { 98 : : PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, 99 : : LoopStandardAnalysisResults &AR, LPMUpdater &U); 100 : : }; 101 : : 102 : : #endif