Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:39

0001 //===-- AlwaysInliner.h - Pass to inline "always_inline" functions --------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// \file
0010 /// Provides passes to inlining "always_inline" functions.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
0015 #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
0016 
0017 #include "llvm/IR/PassManager.h"
0018 
0019 namespace llvm {
0020 
0021 class Module;
0022 class Pass;
0023 
0024 /// Inlines functions marked as "always_inline".
0025 ///
0026 /// Note that this does not inline call sites marked as always_inline and does
0027 /// not delete the functions even when all users are inlined. The normal
0028 /// inliner should be used to handle call site inlining, this pass's goal is to
0029 /// be the simplest possible pass to remove always_inline function definitions'
0030 /// uses by inlining them. The \c GlobalDCE pass can be used to remove these
0031 /// functions once all users are gone.
0032 class AlwaysInlinerPass : public PassInfoMixin<AlwaysInlinerPass> {
0033   bool InsertLifetime;
0034 
0035 public:
0036   AlwaysInlinerPass(bool InsertLifetime = true)
0037       : InsertLifetime(InsertLifetime) {}
0038 
0039   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
0040   static bool isRequired() { return true; }
0041 };
0042 
0043 /// Create a legacy pass manager instance of a pass to inline and remove
0044 /// functions marked as "always_inline".
0045 Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
0046 
0047 }
0048 
0049 #endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H