Jlm
inlining.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_LLVM_OPT_INLINE_HPP
7 #define JLM_LLVM_OPT_INLINE_HPP
8 
10 
11 namespace jlm::rvsdg
12 {
13 class SimpleNode;
14 class LambdaNode;
15 }
16 
17 namespace jlm::llvm
18 {
19 
25 {
26 public:
27  class Statistics;
28  struct Context;
29 
30  ~FunctionInlining() noexcept override;
31 
33 
35 
37  operator=(const FunctionInlining &) = delete;
38 
39 private:
46  static void
47  inlineCall(
48  rvsdg::SimpleNode & callNode,
49  rvsdg::LambdaNode & caller,
50  const rvsdg::LambdaNode & callee);
51 
59  static bool
60  canBeInlined(rvsdg::Region & region, bool topLevelRegion);
61 
69  bool
71  rvsdg::SimpleNode & callNode,
72  rvsdg::LambdaNode & caller,
73  rvsdg::LambdaNode & callee);
74 
81  void
82  considerCallForInlining(rvsdg::SimpleNode & callNode, rvsdg::LambdaNode & callerLambda);
83 
90  void
91  visitIntraProceduralRegion(rvsdg::Region & region, rvsdg::LambdaNode & lambda);
92 
98  void
99  visitLambda(rvsdg::LambdaNode & lambda);
100 
106  void
107  visitInterProceduralRegion(rvsdg::Region & region);
108 
109 public:
115  static void
116  inlineCall(rvsdg::SimpleNode & callNode, const rvsdg::LambdaNode & callee);
117 
122  static bool
123  canBeInlined(const rvsdg::LambdaNode & callee);
124 
125  void
126  Run(rvsdg::RvsdgModule & module, util::StatisticsCollector & statisticsCollector) override;
127 
128 private:
129  std::unique_ptr<Context> context_;
130 };
131 
132 }
133 
134 #endif
Performs function inlining on functions that are determined to be good candidates,...
Definition: inlining.hpp:25
bool shouldInline(rvsdg::SimpleNode &callNode, rvsdg::LambdaNode &caller, rvsdg::LambdaNode &callee)
Definition: inlining.cpp:401
void visitInterProceduralRegion(rvsdg::Region &region)
Definition: inlining.cpp:486
void visitLambda(rvsdg::LambdaNode &lambda)
Definition: inlining.cpp:467
void considerCallForInlining(rvsdg::SimpleNode &callNode, rvsdg::LambdaNode &callerLambda)
Definition: inlining.cpp:411
void Run(rvsdg::RvsdgModule &module, util::StatisticsCollector &statisticsCollector) override
Perform RVSDG transformation.
Definition: inlining.cpp:504
static bool canBeInlined(rvsdg::Region &region, bool topLevelRegion)
Definition: inlining.cpp:344
void visitIntraProceduralRegion(rvsdg::Region &region, rvsdg::LambdaNode &lambda)
Definition: inlining.cpp:443
static void inlineCall(rvsdg::SimpleNode &callNode, rvsdg::LambdaNode &caller, const rvsdg::LambdaNode &callee)
Definition: inlining.cpp:278
~FunctionInlining() noexcept override
std::unique_ptr< Context > context_
Definition: inlining.hpp:129
Represents an RVSDG transformation.
Global memory state passed between functions.