llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
passes
inliner.h
1
// This file if part of the llir-opt project.
2
// Licensing information can be found in the LICENSE file.
3
// (C) 2018 Nandor Licker. All rights reserved.
4
5
#pragma once
6
7
#include "core/pass.h"
8
9
class
Func
;
10
class
CallSite;
11
12
13
17
class
InlinerPass
final :
public
Pass
{
18
public
:
20
static
const
char
*
kPassID
;
21
23
InlinerPass
(
PassManager
*passManager) :
Pass
(passManager) {}
24
26
bool
Run
(
Prog
&prog)
override
;
27
29
const
char
*
GetPassName
()
const override
;
30
31
private
:
33
std::pair<unsigned, unsigned> CountUses(
const
Func
&func);
35
bool
CheckGlobalCost(
const
Func
&caller,
const
Func
&callee);
37
bool
CheckInitCost(
const
Func
&caller,
const
Func
&callee);
38
39
private
:
41
std::unordered_map<const Func *, std::pair<unsigned, unsigned>> counts_;
42
};
Func
Definition:
func.h:30
PassManager
Definition:
pass_manager.h:74
Pass
Definition:
pass.h:17
InlinerPass::InlinerPass
InlinerPass(PassManager *passManager)
Initialises the pass.
Definition:
inliner.h:23
InlinerPass::kPassID
static const char * kPassID
Pass identifier.
Definition:
inliner.h:20
InlinerPass::Run
bool Run(Prog &prog) override
Runs the pass.
Definition:
inliner.cpp:189
InlinerPass
Definition:
inliner.h:17
Prog
Definition:
prog.h:33
InlinerPass::GetPassName
const char * GetPassName() const override
Returns the name of the pass.
Definition:
inliner.cpp:355
Generated by
1.8.17