1 //===-- AlwaysInliner.h - Pass to inline "always_inline" functions --------===//
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
7 //===----------------------------------------------------------------------===//
10 /// Provides passes to inlining "always_inline" functions.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
15 #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
17 #include "llvm/IR/PassManager.h"
21 /// Inlines functions marked as "always_inline".
23 /// Note that this does not inline call sites marked as always_inline and does
24 /// not delete the functions even when all users are inlined. The normal
25 /// inliner should be used to handle call site inlining, this pass's goal is to
26 /// be the simplest possible pass to remove always_inline function definitions'
27 /// uses by inlining them. The \c GlobalDCE pass can be used to remove these
28 /// functions once all users are gone.
29 class AlwaysInlinerPass
: public PassInfoMixin
<AlwaysInlinerPass
> {
33 AlwaysInlinerPass(bool InsertLifetime
= true)
34 : InsertLifetime(InsertLifetime
) {}
36 PreservedAnalyses
run(Module
&M
, ModuleAnalysisManager
&);
39 /// Create a legacy pass manager instance of a pass to inline and remove
40 /// functions marked as "always_inline".
41 Pass
*createAlwaysInlinerLegacyPass(bool InsertLifetime
= true);
45 #endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H