llir-opt
0.0.1
Low-Level Post-Link Optimiser for OCaml and C
core
analysis
init_path.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 <unordered_set>
8
9
class
Func
;
10
class
Block
;
11
class
CallGraph
;
12
13
14
18
class
InitPath
final {
19
public
:
21
InitPath
(
Prog
&prog,
Func
*entry);
22
24
bool
operator[]
(
Block
&block)
const
25
{
26
return
executedAtMostOnce_.count(&block) == 1;
27
}
28
29
private
:
31
bool
IsSingleUse(
const
Func
*f);
32
33
private
:
35
std::unordered_set<Block *> executedAtMostOnce_;
37
std::unordered_map<const Func *, bool> singleUse_;
38
};
Func
Definition:
func.h:30
CallGraph
Definition:
call_graph.h:20
InitPath::InitPath
InitPath(Prog &prog, Func *entry)
Build the path from the entry node.
Definition:
init_path.cpp:20
Prog
Definition:
prog.h:33
InitPath::operator[]
bool operator[](Block &block) const
Check if a block is on the init path.
Definition:
init_path.h:24
InitPath
Definition:
init_path.h:18
Block
Definition:
block.h:29
Generated by
1.8.17