LLVM  13.0.0git
AlwaysInliner.h
Go to the documentation of this file.
1 //===-- AlwaysInliner.h - Pass to inline "always_inline" functions --------===//
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 /// \file
10 /// Provides passes to inlining "always_inline" functions.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
15 #define LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
16 
17 #include "llvm/IR/PassManager.h"
18 
19 namespace llvm {
20 
21 /// Inlines functions marked as "always_inline".
22 ///
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> {
30  bool InsertLifetime;
31 
32 public:
33  AlwaysInlinerPass(bool InsertLifetime = true)
34  : InsertLifetime(InsertLifetime) {}
35 
37  static bool isRequired() { return true; }
38 };
39 
40 /// Create a legacy pass manager instance of a pass to inline and remove
41 /// functions marked as "always_inline".
42 Pass *createAlwaysInlinerLegacyPass(bool InsertLifetime = true);
43 
44 }
45 
46 #endif // LLVM_TRANSFORMS_IPO_ALWAYSINLINER_H
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:155
llvm
Definition: AllocatorList.h:23
Pass
print lazy value Lazy Value Info Printer Pass
Definition: LazyValueInfo.cpp:1949
llvm::AlwaysInlinerPass::run
PreservedAnalyses run(Module &M, ModuleAnalysisManager &)
Definition: AlwaysInliner.cpp:36
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:374
llvm::createAlwaysInlinerLegacyPass
Pass * createAlwaysInlinerLegacyPass(bool InsertLifetime=true)
Create a legacy pass manager instance of a pass to inline and remove functions marked as "always_inli...
Definition: AlwaysInliner.cpp:169
llvm::AlwaysInlinerPass::isRequired
static bool isRequired()
Definition: AlwaysInliner.h:37
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::AlwaysInlinerPass::AlwaysInlinerPass
AlwaysInlinerPass(bool InsertLifetime=true)
Definition: AlwaysInliner.h:33
PassManager.h
llvm::AlwaysInlinerPass
Inlines functions marked as "always_inline".
Definition: AlwaysInliner.h:29
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:44